Updating Root Storage of an LXD Instance

Resize the root filesystem of an LXD instance after its virtual disk has been increased.

Warning

Ensure you have a current backup before resizing the partition.

Run the following commands inside the VM.

Step 1: Install the required tool

sudo apt update
sudo apt install -y cloud-guest-utils

Step 2: Expand the root partition

sudo growpart /dev/sda 1

Step 3: Expand the ext4 filesystem

sudo resize2fs /dev/sda1

Step 4: Confirm the new size

lsblk
df -h /

The root filesystem should now show the additional storage.