Storage expansion

Hi All,

I want to expand the storage i use on 8 containers. How can we do this? (i am on debian buster)

±-----±------------±-------±---------------------------------------±--------+
| NAME | DESCRIPTION | DRIVER | SOURCE | USED BY |
±-----±------------±-------±---------------------------------------±--------+
| lxd | | btrfs | /var/snap/lxd/common/lxd/disks/lxd.img | 8 |
±-----±------------±-------±---------------------------------------±--------+

info:
description: “”
driver: btrfs
name: lxd
space used: 1.28TB
total space: 1.50TB
used by:
containers:

  • controller
  • dcfs01
  • ex02
  • kms
  • kopano
  • opsi
  • zwave
    profiles:
  • default

Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 18M 1.6G 2% /run
/dev/mapper/vg0-root 1.8T 1.3T 464G 74% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/loop2 89M 89M 0 100% /snap/core/7396
/dev/loop0 55M 55M 0 100% /snap/lxd/11985
/dev/loop3 90M 90M 0 100% /snap/core/7713
/dev/sda2 488M 5.1M 482M 2% /boot/efi
/dev/mapper/sda_crypt 932G 711G 221G 77% /home/usb_backup
tmpfs 1.0M 0 1.0M 0% /var/snap/lxd/common/ns
/dev/loop5 55M 55M 0 100% /snap/lxd/12100
tmpfs 1.6G 0 1.6G 0% /run/user/1000

I would like to add 200GB from the root device.

sudo truncate +200GB  /var/snap/lxd/common/lxd/disks/lxd.img
sudo nsenter -t $(pgrep daemon.start) -m -- /snap/lxd/current/bin/btrfs filesystem resize max /var/snap/lxd/common/lxd/storage-pools/lxd

should do it.

For production using dedicated partitions is recommended for performance and convenience (while growing a loop file backed storage is doable, reducing it is a pain)

Thank you for your info.

Can i do this while containers are running or should i stop the containers?

resizing should work with running containers. Not for moving to partition based storage, obviously.

Huh, that’s truncate -s. Sorry.