Fujitsu's employed me, which means I'm empowered to make bad financial decisions at a larger scale than previous — in this case, a OneMix 3 Pro, which has only one disk in it, but I'd still prefer to zoot it in less than twenty hours over USB or whatever.
Thankfully, I've finally figured out how zpool(8) import -e/autoexpand=on works. This is not for lack of trying – indeed, this is not my first or third attempt, but, well, the manpage said
expandsize:
Amount of uninitialized space within the pool or device
that can be used to increase the total capacity of the pool.
Uninitialized space consists of any space on an EFI labeled vdev
which has not been brought online (e.g, using zpool online -e).
This space occurs when a LUN is dynamically expanded.
Which, frankly, makes no fucking sense, especially, since that invocation didn't claim unpartitioned space inside the GPT.
However, what it did do was handle expanding entire drives (i.e. ones with space beyond the GPT), as well as manually grown partitions. And so, I've updated the manpage, which should land in 2.0.0-rc6 to some semblance of sense:
expandsize:
Amount of uninitialized space within the pool or device
that can be used to increase the total capacity of the pool.
On whole-disk vdevs, this is the space beyond the end of the GPT –
typically occurring when a LUN is dynamically expanded
or a disk replaced with a larger one.
On partition vdevs, this is the space appended to the partition
after it was added to the pool – most likely by resizing it in-place.
The space can be claimed for the pool by bringing it online
with autoexpand=on or using zpool online -e.
That doesn't mean I'm quite sure what a LUN is, but it gets the point across much better.
This doesn't change much during
Except that the initial destination filesystem must go at the end of the free space, leaving a hole big enough to fit the initial pool at the beginning.
What does change significantly, though, is the
Since currently there's no partition for the pool to occupy:
root@zoot:~# fdisk -l /dev/sda
Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Disk identifier: 7CA96D41-9F58-41BB-8867-BC2FF8A7CBCC
Device Start End Sectors Size Type
/dev/sda1 2048 487423 485376 237M EFI System
/dev/sda2 9940992 16775167 6834176 3.3G Linux filesystem
I'm using fdisk(8)
(mainly because I'm too small-brain for parted(8)
),
other home nations are available.
root@zoot:~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.36).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition number (3-128, default 3):
First sector (487424-16777182, default 487424):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (487424-9940991, default 9940991):
Created a new partition 3 of type 'Linux filesystem' and of size 4.5 GiB.
Command (m for help): x
Expert command (m for help): n
Partition number (1-3, default 3):
New name: zoot-zoot
Partition name changed from '' to 'zoot-zoot'.
Expert command (m for help): f
Partitions order fixed.
Expert command (m for help): r
Command (m for help): t
Partition number (1-3, default 3):
Partition type or alias (type L to list all): 24
Changed type of partition 'Linux filesystem' to 'Linux root (x86-64)'.
Command (m for help): w
The partition table has been altered.
Failed to remove partition 2 from system: Device or resource busy
Failed to add partition 2 to system: Device or resource busy
Failed to add partition 3 to system: Device or resource busy
The kernel still uses the old partitions. The new table will be used at the next reboot.
Syncing disks.
Command (m for help): w
The partition table has been altered.
Syncing disks.
Of note:
PARTLABEL=
or "Partition name" is the hardest to fuck up way to spec a partition vdev.The table is as follows for now:
root@zoot:~# fdisk -x /dev/sda
Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Disk identifier: 7CA96D41-9F58-41BB-8867-BC2FF8A7CBCC
Device Start End Sectors Type Name Attrs
/dev/sda1 2048 487423 485376 EFI System zoot-EFI
/dev/sda2 487424 9940991 9453568 Linux root (x86-64) zoot-zoot
/dev/sda3 9940992 16775167 6834176 Linux filesystem zoot-root
This means, that the creation command turns into
zpool create -O mountpoint=/ -O canmount=off -R /mnt zoot zoot-zoot
Besides this, everything continues as previous until rebooted with ZFS as rootfs, when it's time for
Which consists of removing the partition with the previous rootfs and expanding the one with the vdev, being sure to not wipe it:
root@zoot:~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.36).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1-3, default 3):
Partition 3 has been deleted.
Command (m for help): d
Partition number (1,2, default 2):
Partition 2 has been deleted.
Command (m for help): n
Partition number (2-128, default 2):
First sector (487424-16777182, default 487424):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (487424-16777182, default 16777182):
Created a new partition 2 of type 'Linux filesystem' and of size 7.8 GiB.
Partition #2 contains a zfs_member signature.
Do you want to remove the signature? [Y]es/[N]o: n
Command (m for help): x
Expert command (m for help): n
Partition number (1,2, default 2):
New name: zoot-zoot
Partition name changed from '' to 'zoot-zoot'.
Expert command (m for help): r
Command (m for help): t
Partition number (1,2, default 2):
Partition type or alias (type L to list all): 24
Changed type of partition 'Linux filesystem' to 'Linux root (x86-64)'.
Command (m for help): w
The partition table has been altered.
Syncing disks.
Which yields a vdev partition the size of the rest of the disk, but ZFS will not recognise it until after a reboot:
root@zoot:~# fdisk -l /dev/sda
Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Disk identifier: 7CA96D41-9F58-41BB-8867-BC2FF8A7CBCC
Device Start End Sectors Size Type
/dev/sda1 2048 487423 485376 237M EFI System
/dev/sda2 487424 16777182 16289759 7.8G Linux root (x86-64)
root@zoot:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zoot 4.50G 1.20G 3.30G - - 3% 26% 1.00x ONLINE -
But after one, the rest of the partition is recognised and can be claimed:
root@zoot:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zoot 4.50G 1.20G 3.30G - 3G 3% 26% 1.00x ONLINE -
root@zoot:~# zpool online -e zoot zoot-zoot
root@zoot:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zoot 7.50G 1.20G 6.30G - - 2% 15% 1.00x ONLINE -
Nit-pick? Correction? Improvement? Annoying? Cute? Anything?
Mail,
post, or open!