Debian/Ubuntu: Expand disk clearing steps
This covers more scenarios, including the need to stop md arrays and wipe MD partitions. Signed-off-by: Richard Laager <rlaager@wiktel.com> Requested-by: Larry Wagner <larrywagner0@gmail.com>
This commit is contained in:
@@ -167,15 +167,28 @@ Step 2: Disk Formatting
|
||||
|
||||
#. If you are re-using a disk, clear it as necessary:
|
||||
|
||||
If the disk was previously used in an MD array, zero the superblock::
|
||||
If the disk was previously used in an MD array::
|
||||
|
||||
apt install --yes mdadm
|
||||
|
||||
# See if one or more MD arrays are active:
|
||||
cat /proc/mdstat
|
||||
# If so, stop them (replace ``md0`` as required):
|
||||
mdadm --stop /dev/md0
|
||||
|
||||
# For an array using the whole disk:
|
||||
mdadm --zero-superblock --force $DISK
|
||||
# For an array using a partition:
|
||||
mdadm --zero-superblock --force ${DISK}-part2
|
||||
|
||||
Clear the partition table::
|
||||
|
||||
sgdisk --zap-all $DISK
|
||||
|
||||
If you get a message about the kernel still using the old partition table,
|
||||
reboot and start over (except that you can skip this step).
|
||||
|
||||
|
||||
#. Partition your disk(s):
|
||||
|
||||
Run this if you need legacy (BIOS) booting::
|
||||
|
||||
@@ -197,15 +197,27 @@ Step 2: Disk Formatting
|
||||
|
||||
#. If you are re-using a disk, clear it as necessary:
|
||||
|
||||
If the disk was previously used in an MD array, zero the superblock::
|
||||
If the disk was previously used in an MD array::
|
||||
|
||||
apt install --yes mdadm
|
||||
|
||||
# See if one or more MD arrays are active:
|
||||
cat /proc/mdstat
|
||||
# If so, stop them (replace ``md0`` as required):
|
||||
mdadm --stop /dev/md0
|
||||
|
||||
# For an array using the whole disk:
|
||||
mdadm --zero-superblock --force $DISK
|
||||
# For an array using a partition (e.g. a swap partition per this HOWTO):
|
||||
mdadm --zero-superblock --force ${DISK}-part2
|
||||
|
||||
Clear the partition table::
|
||||
|
||||
sgdisk --zap-all $DISK
|
||||
|
||||
If you get a message about the kernel still using the old partition table,
|
||||
reboot and start over (except that you can skip this step).
|
||||
|
||||
#. Create bootloader partition(s)::
|
||||
|
||||
sgdisk -n1:1M:+512M -t1:EF00 $DISK
|
||||
|
||||
Reference in New Issue
Block a user