TrueNAS VM – resize disk without downtime

TrueNAS VM – resize disk without downtime
created with ChatGPT

The disk of my Ubuntu VM kept filling up, so it was time to resize it. Luckily, the steps are very simple and — yes — no downtime is required.
Still, it’s always a good idea to have a backup! ⚠️

Overview

┌───────────────────────┐
│ TrueNAS (ZFS) │
│ Dataset / Zvol │
└───────────┬───────────┘
│ resize Zvol

┌───────────────────────┐
│ Virtual Disk │
│ (VM Block Device) │
└───────────┬───────────┘
│ online resize

┌───────────────────────┐
│ Ubuntu VM │
│ LVM / Partition │
└───────────┬───────────┘
│ lvextend / growpart

┌───────────────────────┐
│ Filesystem (EXT4) │
│ resize2fs │
└───────────────────────┘

Step 1: Resize the Zvol

The VM disk is stored in a Zvol. You can find its name in the VM device list.

In the TrueNAS Web UI:

  • Virtual Machines → select your VM → Devices
  • Note the Zvol name

First we need to resize the Zvol. The Zvol is where the VM disk is stored.

Now go to:

  • Datasets → select the Zvol → Edit Zvol
  • Enter the new size and click Save

At this point, the virtual disk has been resized — no VM reboot needed.

Inside the VM: extend partition and filesystem

SSH into your VM and continue there.

LVM

I use LVM in my Ubuntu VM. The steps are:

df -h .
sudo lvdisplay
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

# Verify the new size
df -h .

No LVM

If you’re not using LVM, you can still extend the disk online.

# update repos and install cloud-guest-utils, which allows online disk extension
apt update
apt install cloud-guest-utils

# Check which partition your root filesystem uses
df -h .

# Grow the partition (note the space — not a typo)
growpart /dev/sda 3

# Resize the filesystem (can be done online)

# EXT4
resize2fs /dev/sda3

# XFS
xfs_growfs /

# Verify the new size
df -h .

Final thoughts

It only takes a couple of minutes to resize your VM disk — completely online.
And while this example uses TrueNAS, the same approach works for any VM backed by block storage, not just TrueNAS.

Privacy Policy Cookie Policy Terms and Conditions