Open candlerb opened 3 days ago
This workaround seems to do the trick:
runcmd:
- growpart $(zpool status -LP rpool | awk '/\/dev/ {print $1}' | sed -E 's/([0-9]+)$/ \1/') || true
- zpool online -e rpool $(zpool status -P rpool | awk '/\/dev/ {print $1}' | sed 's/.*\///') || true
The first command resolves to /dev/vda4
, which it splits to growpart /dev/vda 4
The second resolves to the block identifier used by the vdev.
Thank you for the detailed bug report and workaround!
Bug report
Given a ZFS image, where the rpool vdev is
XXXX
referring to/dev/disk/by-partuuid/XXXX
, growfs tries (and fails) to grow/dev/XXXX
instead.Steps to reproduce the problem
The image that I'm booting has ZFS as per the Ubuntu root on ZFS documentation, using partition uuids:
The reason for using partuuids is because I found that
/dev/disk/by-id/scsi-SATA_disk1
was not stable between different virtualization environments, causing it to fail to boot. It boots fine everywhere using the partition uuid.The original disk image was 10GiB, which I've resized to 60GiB using qemu-img, and I want cloud-init to grow into that space.
The vdev device reference there is a partition UUID:
vda4 is the last partition on disk, and that's what I want cloud-init to expand.
cloud-init data has no growpart config, so it's using the default
{'mode': 'auto', 'devices': ['/'], 'ignore_growroot_disabled': False}
which should use all available free space.The problem is that cloud-init is trying to grow
/dev/d2250236-f96c-4664-97a2-75369a4c8e47
instead of/dev/disk/by-partuuid/d2250236-f96c-4664-97a2-75369a4c8e47
(see logs below).Environment details
cloud-init logs
cloud-init-output.log shows:
cloud-init.log shows:
Workaround
I can grow the partition by hand (and therefore potentially as a cmd in cloud-init)
Growing the zfs vdev requires the partition uuid to be used as the vdev identifier:
Suggestion
Given a vdev device name without a/dev
prefix, I think it would be reasonable for cloud-init to try it in turn under:There's a simpler answer: use the
-P
and/or-L
flags to get the full path and/or the resolved device name.