LXD 5.0.3 does not handle root disk sizes in ZFS correctly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxd |
Fix Released
|
Unknown
|
|||
lxd (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Hi, I encounter issue when I manually override the disk size. I got real ZFS backed pool
The snap version is 5.0.3 from 5.0/stable channel
$ snap info lxd |grep install
installed: 5.0.3-babaaf8 (27948) 91MB -
When specify 24GB it's ok
mastier@drakkar:~$ lxc init ubuntu:22.04 testvm --vm -c limits.cpu=1 -c limits.memory=2GiB
mastier@drakkar:~$ lxc config device override testvm root size=24GB
Device root overridden for testvm
mastier@drakkar:~$ lxc config device list testvm
root
mastier@drakkar:~$ lxc start testvm
mastier@drakkar:~$ lxc exec testvm bash
root@testvm:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 22G 1.4G 21G 7% /
tmpfs 991M 0 991M 0% /dev/shm
tmpfs 397M 612K 396M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 50M 14M 37M 27% /run/lxd_agent
/dev/sda15 105M 6.1M 99M 6% /boot/efi
root@testvm:~#
exit
mastier@drakkar:~$ lxc delete --force testvm
When I set 15 or 16GB.
mastier@drakkar:~$ lxc init ubuntu:22.04 testvm --vm -c limits.cpu=1 -c limits.memory=2GiB
Creating testvm
mastier@drakkar:~$ lxc config device override esa-vpn root size=15GB
Error: Failed to update device "root": Failed to run: zfs set volsize=15000002560 rpool/lxd/
mastier@drakkar:~$ lxc config device override testvm root size=16GB
Error: Failed to update device "root": Failed to run: zfs set volsize=16000000000 rpool/lxd/
Changed in lxd (Ubuntu): | |
status: | Incomplete → Confirmed |
Changed in lxd: | |
status: | Unknown → New |
Changed in lxd: | |
status: | New → Fix Released |
@Bartosz it seems you were lucky with 24GB ends being with a multiple of 16KiB (ZFS uses K and G to mean KiB and GiB btw):
$ lxc config device override testvm root size=24GB virtual- machines/ testvm. block virtual- machines/ testvm. block volsize 24000004096 local
Device root overridden for testvm
$ zfs get -p volsize default/
NAME PROPERTY VALUE SOURCE
default/
15 and 16GB are not multiple of 16KiB. You can generally avoid such issues by defining the storage sizes by using MiB or GiB units. Like here:
$ lxc config device override testvm root size=15GiB
Device root overridden for testvm
$ lxc config device set testvm root size=16GiB
Could you check if using GiB works for you too? I'll mark the bug as incomplete until you can test and report. Thank you.