Repository navigation
Disk tools
The Disk file row on a VM's Hardware tab shows how much space its disk takes and has two tools: Grow disk and Compact. It shows up once the VM has been powered on at least once, since that's when the disk file is made.
VM disks are thin: a 64 GB disk starts out as a tiny file and only gets bigger as the guest writes to it. The bar shows how much of the full size is really used on your PC, for example "18.2 GB on this PC · up to 64 GB".
It also says when the disk has snapshots (your profiles, and a save state if there is one), and for a linked clone which base file it's built on.
- Power off the VM.
- Type the new size in GB and click Grow disk.
That makes the disk bigger from the outside. The guest still has its old partition, so to use the new space you have to extend it inside the guest:
-
Linux:
sudo growpart /dev/vda 1thensudo resize2fs /dev/vda1(names differ by distro and disk type, check withlsblk) - Windows: Disk Management, right-click the C: partition, Extend Volume
Disks can only grow. Shrinking a disk under the guest's partitions would destroy data, so the app refuses a smaller size.
Deleting files inside the guest doesn't make the disk file smaller on its own. Compact rewrites the disk into a fresh file that leaves out the free space, and shows how big it was before and after.
- It takes a while for big disks, about as long as copying the file. The VM can't be started until it's done.
- It needs enough free space on your drive for a second copy of the used part of the disk.
- Linux guests give back more space if you run
sudo fstrim -avin the guest first.
- The VM is running. Power it off first.
- You have unsaved changes on the Hardware tab. Save or revert them first. Growing saves the new size into the VM's settings and reloads them.
- "Delete this VM's profiles / save state first": qemu-img can't resize a disk that has snapshots, and compacting would drop them. Launch or delete the profiles you don't need (see Save state and profiles).
- "This disk is a linked clone": compacting it would copy the whole shared base into it, which makes it bigger, not smaller. Grow works.