virt-lightning / freebsd-cloud-images

Shell script to build the FreeBSD cloud images
31 stars 13 forks source link

Cloud-init can't growpart in FreeBSD 14.0 with ZFS #7 #9

Open oneumyvakin opened 3 months ago

oneumyvakin commented 3 months ago

There is a VM with scsi disk driver and 50G disk, but after vm creation / part is not grow:

# df -h
Filesystem            Size    Used   Avail Capacity  Mounted on
zroot/ROOT/default    1.5G    1.1G    441M    72%    /
devfs                 1.0K      0B    1.0K     0%    /dev
zroot                 441M     24K    441M     0%    /zroot
/dev/cd0              3.8M    3.8M      0B   100%    /mnt/cd0
#  geom disk list
Geom name: cd0
Providers:
1. Name: cd0
   Mediasize: 3985408 (3.8M)
   Sectorsize: 2048
   Mode: r1w0e0
   descr: QEMU QEMU CD-ROM
   ident: (null)
   rotationrate: unknown
   fwsectors: 0
   fwheads: 0

Geom name: da0
Providers:
1. Name: da0
   Mediasize: 53687091200 (50G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r2w2e4
   descr: QEMU QEMU HARDDISK
   ident: (null)
   rotationrate: unknown
   fwsectors: 63
   fwheads: 255
ls /dev/da0
/dev/da0    /dev/da0p1  /dev/da0p2  /dev/da0p3  /dev/da0p4
2024-07-03 09:45:12,709 - modules.py[DEBUG]: Running module growpart (<module 'cloudinit.config.cc_growpart' from '/usr/local/lib/python3.9/site-packages/cloud_init-24.1.5-py3.9.egg/cloudinit/config/cc_growpart.py'>) with frequency always
2024-07-03 09:45:12,709 - handlers.py[DEBUG]: start: init-network/config-growpart: running config-growpart with frequency always
2024-07-03 09:45:12,709 - helpers.py[DEBUG]: Running config-growpart using lock (<cloudinit.helpers.DummyLock object at 0x3cbdf51bcbb0>)
2024-07-03 09:45:12,710 - subp.py[DEBUG]: Running command ['growpart', '--help'] with allowed return codes [0] (shell=False, capture=True)
2024-07-03 09:45:12,711 - subp.py[DEBUG]: Running command ['gpart', 'help'] with allowed return codes [0, 1] (shell=False, capture=True)
2024-07-03 09:45:12,716 - subp.py[DEBUG]: Running command ['mount'] with allowed return codes [0] (shell=False, capture=True)
2024-07-03 09:45:12,719 - util.py[DEBUG]: found line in mount -> devpth: zroot/ROOT/default, mount_point: /, fs_type: zfs, options: 'local,nfsv4acls'
2024-07-03 09:45:12,719 - util.py[DEBUG]: resize_devices took 0.003 seconds
2024-07-03 09:45:12,719 - cc_growpart.py[DEBUG]: '/dev/vtbd0p4' SKIPPED: stat of '/dev/vtbd0p4' failed: [Errno 2] No such file or directory: '/dev/vtbd0p4'
2024-07-03 09:45:12,719 - cc_growpart.py[DEBUG]: '/' SKIPPED: stat of 'zroot/ROOT/default' failed: [Errno 2] No such file or directory: 'zroot/ROOT/default'
2024-07-03 09:45:12,719 - handlers.py[DEBUG]: finish: init-network/config-growpart: SUCCESS: config-growpart ran successfully

Not sure what to do to grow / part.

There is no such issue with UFS.

goneri commented 3 months ago

Ah, you don't use the virtio driver? This seems to be the problem. Can you adjust that?

goneri commented 3 months ago

The problem comes from this line: https://github.com/virt-lightning/freebsd-cloud-images/blob/master/build.sh#L125

For some reason I had to hard code the partition, but I'm not sure if we still need that. Overall, it's a cloud-init problem or misconfiguration.