Commit cecfb7b6 authored by Ryan Jackson's avatar Ryan Jackson
Browse files

Wipe out the first 8K on disks at reload to erase stale LVM data

parent 8ea0419e
...@@ -56,11 +56,11 @@ tweakmbr() { ...@@ -56,11 +56,11 @@ tweakmbr() {
_CUR=1 _CUR=1
;; ;;
12305790s) 12305790s)
_CUR=2 _CUR=2
;; ;;
s) s)
# special case: no part1 so probably no MBR at all, make sure we install # special case: no part1 so probably no MBR at all, make sure we install
echo "Found no MBR on $_DSK, installing version $_NEW" echo "Found no MBR on $_DSK, installing version $_NEW"
_CUR=1000000 _CUR=1000000
;; ;;
*) *)
...@@ -211,7 +211,7 @@ loadone() { ...@@ -211,7 +211,7 @@ loadone() {
# #
if [ -x /dev/MAKEDEV -a ! -e /dev/$DISK ]; then if [ -x /dev/MAKEDEV -a ! -e /dev/$DISK ]; then
(cd /dev; ./MAKEDEV $DISK ${DISK}s2a ${DISK}s3a ${DISK}s4a) (cd /dev; ./MAKEDEV $DISK ${DISK}s2a ${DISK}s3a ${DISK}s4a)
fi fi
if [ x"$ADDRESS" != x ]; then if [ x"$ADDRESS" != x ]; then
isurl=`echo $ADDRESS | grep http -` isurl=`echo $ADDRESS | grep http -`
...@@ -225,7 +225,7 @@ loadone() { ...@@ -225,7 +225,7 @@ loadone() {
echo "Need to create or mount /images directory!" echo "Need to create or mount /images directory!"
return 1 return 1
fi fi
# #
# This needs a lot more work ... # This needs a lot more work ...
# #
...@@ -233,7 +233,7 @@ loadone() { ...@@ -233,7 +233,7 @@ loadone() {
imagefile="/images/$imagefile" imagefile="/images/$imagefile"
elif [ x"$ispath" != x ]; then elif [ x"$ispath" != x ]; then
ispath=1 ispath=1
if [ ! -e $ADDRESS ]; then if [ ! -e $ADDRESS ]; then
echo "$ADDRESS does not exist!" echo "$ADDRESS does not exist!"
return 1 return 1
...@@ -251,7 +251,7 @@ loadone() { ...@@ -251,7 +251,7 @@ loadone() {
isurl=0 isurl=0
ispath=0 ispath=0
fi fi
# #
# ZFILL==1: use frisbee # ZFILL==1: use frisbee
# ZFILL==2: separate disk-wipe pass (not yet implemented) # ZFILL==2: separate disk-wipe pass (not yet implemented)
...@@ -440,7 +440,7 @@ case $STATUS in ...@@ -440,7 +440,7 @@ case $STATUS in
mount | grep "^/dev/$d" > /dev/null && continue mount | grep "^/dev/$d" > /dev/null && continue
zapsuperblocks $d zapsuperblocks $d
echo "Invalidating MBR on $d" echo "Invalidating MBR on $d"
dd if=/dev/zero of=/dev/$d bs=512 count=1 dd if=/dev/zero of=/dev/$d bs=512 count=16
done done
;; ;;
esac esac
......
...@@ -85,7 +85,7 @@ tweakmbr() ...@@ -85,7 +85,7 @@ tweakmbr()
echo "WARNING: cannot find MBR version $new_mbr_ver, not installed" echo "WARNING: cannot find MBR version $new_mbr_ver, not installed"
return 255 return 255
fi fi
echo "Installing MBR version $new_mbr_ver ..." echo "Installing MBR version $new_mbr_ver ..."
dd if=$MBR_PATH/mbr${new_mbr_ver}.dd of=$disk bs=512 count=1 dd if=$MBR_PATH/mbr${new_mbr_ver}.dd of=$disk bs=512 count=1
...@@ -115,7 +115,7 @@ find_disks() { ...@@ -115,7 +115,7 @@ find_disks() {
zapsuperblocks() zapsuperblocks()
{ {
local disk=${1##*/} local disk=${1##*/}
echo "Invalidating old potential superblocks on $disk" echo "Invalidating old potential superblocks on $disk"
partitions=`echo /sys/block/$disk/$disk* 2>/dev/null` partitions=`echo /sys/block/$disk/$disk* 2>/dev/null`
for part in $partitions; do for part in $partitions; do
...@@ -262,7 +262,7 @@ handle_loadinfo() ...@@ -262,7 +262,7 @@ handle_loadinfo()
[hs]d[a-z]) [hs]d[a-z])
;; ;;
*) *)
DISK=`$BINDIR/freebsd_to_linux_disk $DISK 0` DISK=`$BINDIR/freebsd_to_linux_disk $DISK 0`
DISK=${DISK%% *} DISK=${DISK%% *}
;; ;;
esac esac
...@@ -345,7 +345,7 @@ get_loadinfo() ...@@ -345,7 +345,7 @@ get_loadinfo()
if [ $time -eq 0 ]; then if [ $time -eq 0 ]; then
return 1 return 1
fi fi
return 0 return 0
} }
...@@ -409,7 +409,7 @@ case $STATUS in ...@@ -409,7 +409,7 @@ case $STATUS in
mount | grep "^/dev/$d" > /dev/null && continue mount | grep "^/dev/$d" > /dev/null && continue
zapsuperblocks /dev/$d zapsuperblocks /dev/$d
echo "Invalidating MBR on /dev/$d" echo "Invalidating MBR on /dev/$d"
dd if=/dev/zero of=/dev/$d bs=512 count=1 dd if=/dev/zero of=/dev/$d bs=512 count=16
done done
;; ;;
esac esac
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment