From c9e868af21c7e854c95d413ebe9204cb6ce59f47 Mon Sep 17 00:00:00 2001 From: Richard Laager Date: Sat, 30 May 2020 13:26:53 -0500 Subject: [PATCH] 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 Requested-by: Larry Wagner --- .../Debian/Debian Buster Root on ZFS.rst | 15 ++++++++++++++- .../Ubuntu/Ubuntu 20.04 Root on ZFS.rst | 14 +++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/Getting Started/Debian/Debian Buster Root on ZFS.rst b/docs/Getting Started/Debian/Debian Buster Root on ZFS.rst index 7915682..5d91124 100644 --- a/docs/Getting Started/Debian/Debian Buster Root on ZFS.rst +++ b/docs/Getting Started/Debian/Debian Buster Root on ZFS.rst @@ -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:: diff --git a/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS.rst b/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS.rst index c384322..737e94c 100644 --- a/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS.rst +++ b/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS.rst @@ -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