I have lxd 3.9 on Debian Stretch (9.7). Yesterday I created a new container, and configured it. The one mistake I made is that the container is only 100 GB. I’d like to increase that to 700 GB. If I understand how this works correctly, there’s a single image, in my case it’s in:
/var/snap/lxd/common/lxd/disks/default.img
The size of that file was 100 GB. I was able to resize it to 700 GB using:
sudo truncate -s +600G /var/snap/lxd/common/lxd/disks/default.img
But still, inside the container, I seem to be limited to 100GB (94 GB actually):
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/loop2 94G 18G 75G 19% /
none 492K 0 492K 0% /dev
udev 7.8G 0 7.8G 0% /dev/tty
tmpfs 100K 0 100K 0% /dev/lxd
tmpfs 100K 0 100K 0% /dev/.lxd-mounts
tmpfs 7.9G 8.0K 7.9G 1% /dev/shm
tmpfs 7.9G 272K 7.9G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
tmpfs 1.6G 0 1.6G 0% /run/user/1001
I have tried to resize this container in many ways, including:
sudo btrfs filesystem resize max /var/snap/lxd/common/lxd/storage-pools/default/
which is a valid directory, but I get the error:
ERROR: not a btrfs filesystem: /var/snap/lxd/common/lxd/storage-pools/default/
Then from this post I tried to use this to resize:
nsenter -t $(pgrep daemon.start) -m – btrfs filesystem resize max /var/snap/lxd/common/lxd/storage-pools/default
as root, but I get the error: nsenter: failed to execute –: No such file or directory
My device is loop6
. I know that from:
$ sudo btrfs filesystem show
Label: 'default' uuid: ...
Total devices 1 FS bytes used 16.82GiB
devid 1 size 93.13GiB used 23.02GiB path /dev/loop2
But honestly I don’t understand how resizing this will help (as the guy did in the link). He used trancate
, which I’m not sure is the right thing to do.
How can I resize the file system of my container to the maximum capacity of the image?