From 5b4f4779ea56d34c858213d30fab0558010c2003 Mon Sep 17 00:00:00 2001 From: Richard Laager Date: Mon, 31 Aug 2020 01:16:27 -0500 Subject: [PATCH] Ubuntu 20.04 Pi: Simplify SD card clearing Zeroing the entire disk takes a long time. These steps _should_ be sufficient. --- ...ntu 20.04 Root on ZFS for Raspberry Pi.rst | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS for Raspberry Pi.rst b/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS for Raspberry Pi.rst index 3d02e16..601f03f 100644 --- a/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS for Raspberry Pi.rst +++ b/docs/Getting Started/Ubuntu/Ubuntu 20.04 Root on ZFS for Raspberry Pi.rst @@ -157,20 +157,26 @@ be deleted. DISK=/dev/mmcblk0 -#. Clear the disk:: +#. Clear old ZFS labels:: - sudo dd if=/dev/zero of=${DISK} bs=1M status=progress + sudo zpool labelclear -f ${DISK} + + If a ZFS label still exists from a previous system/attempt, expanding the + pool will result in an unbootable system. + + **Hint:** If you do not already have the ZFS utilities installed, you can + install them with: ``sudo apt install zfsutils-linux`` Alternatively, you + can zero the entire SD card with: + ``sudo dd if=/dev/zero of=${DISK} bs=1M status=progress`` + +#. Delete existing partitions:: + + echo "label: dos" | sudo sfdisk ${DISK} sudo partprobe ls ${DISK}* - # Make sure there are no partitions, just the file for the disk itself. - **WARNING:**: You must follow this step if the disk was previously used. - If a filesystem with the ``writable`` label from the Ubuntu image is still - present in partition 2, the system will not boot initially. If a ZFS label - still exists from a previous system/attempt, expanding the pool will result - in an unbootable system. - - The ``No space left on device`` error from ``dd`` is expected. + Make sure there are no partitions, just the file for the disk itself. This + step is not strictly necessary; it exists to catch problems. #. Create the partitions:: @@ -185,6 +191,13 @@ be deleted. sudo dd if=${IMG}p1 of=${DISK}p1 bs=1M +#. Clear old label(s) from partition 2:: + + sudo wipefs ${DISK}p2 + + If a filesystem with the ``writable`` label from the Ubuntu image is still + present in partition 2, the system will not boot initially. + #. Copy the root filesystem data:: # NOTE: the destination is p3, not p2.