Hi all,
I’ve been experimenting with Incus VMs on the TrueNAS Fangtooth RC and really enjoying the experience! You might have noticed the convenient “Increase” button next to your VM’s root disk size. While it’s a great feature, it doesn’t automatically resize your filesystem. This brief tutorial covers how to properly increase your VM’s filesystem size after you’ve used the “Increase” button.
Knowing this process can help you be more conservative when initially allocating your root disk size, since you can easily expand it later. However, keep in mind that this change is irreversible, as shrinking an existing filesystem is complicated and often impractical.
This tutorial specifically covers resizing the primary OS filesystem on TrueNAS Fangtooth VMs using an ext4 filesystem. You can verify your filesystem type by running lsblk -l
and checking the FSTYPE column. I’ve tested these steps on Arch Linux, but they should work similarly on other major Linux distributions with ext4. If you’re using a different filesystem, the process may vary.
1. Power Down the VM and Increase the Root Disk size
- In the TrueNAS Instances panel, locate the VM that you want to resize.
- Power off the VM (click Stop or power it down from within the VM).
- After it is fully stopped, find the Root Disk entry. Click Increase next to its size.
- Enter the new size for your disk and confirm.
Important: In Fangtooth (at least for now), the VM’s ISO is attached when you create the VM. Leave that ISO attached so you can boot from it in the next step.
2. Boot into the Installer ISO
- Start the VM again. In the boot order, the ISO should load first.
- Once at the initial ISO boot screen, select the live/installer environment.
- Open the Installer Shell. On Arch, this is typically available by default once you are in the live environment.
- This ensures your VM’s OS disk is not actively mounted, letting you safely modify partitions.
3. Identify Your Disk and Partition Numbers
-
Run
lsblk
in the shell to see all attached block devices. For example:> lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 50G 0 disk ├─sda1 8:1 0 512M 0 part └─sda2 8:2 0 49.5G 0 part sr0 11:0 1 677M 0 rom
- Here,
sda
is the disk. The root partition issda2
. - Your setup may differ, e.g.,
nvme0n1
(disk) andnvme0n1p1
(partition).
- Here,
-
Make sure you identify both:
- The disk (e.g.,
/dev/sda
,/dev/nvme0n1
) - The root partition number (e.g.,
/dev/sda2
,/dev/nvme0n1p2
)
- The disk (e.g.,
4. Resize the Partition with parted
-
Start
parted
, specifying the disk (not the partition):> parted /dev/sda
(Replace
/dev/sda
with your disk name if it is different.) -
Within
parted
, check the partitions:(parted) print
You will see something like:
Model: Virtio Block Device Disk /dev/sda: 53.7GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 538MB 537MB fat32 boot boot 2 538MB 50.0GB 49.5GB ext4 root
-
Resize the target partition (usually the root partition). For example, if you want to resize partition 2:
(parted) resizepart 2
For older versions of
parted
, it isresize
notresizepart
. The prompt will differ, but the idea is the same: resize your partition number. -
When prompted for
End?
, enter the new end size that matches the new size you chose in the TrueNAS UI. For example, if you increased the disk from 50GB to 60GB, set the partition end at60GB
:End? 60GB
-
Once done, type:
(parted) quit
to exit.
5. Run a Filesystem Check (e2fsck
)
Perform a filesystem check before resizing the filesystem. Use the partition name (e.g., /dev/sda2
)—now with the partition number:
> e2fsck -f /dev/sda2
This ensures your filesystem is healthy and can be safely resized.
6. Resize the Filesystem (resize2fs
)
Finally, expand the actual ext4 filesystem to fill the newly resized partition:
> resize2fs /dev/sda2
This step is critical; otherwise, your operating system will still see the old partition size.
7. Reboot into Your Newly Resized Root Disk
-
Exit the live ISO environment and reboot.
-
Once the VM is up, run:
df -h
You should see the new larger size for your root filesystem.