Here’s a full guide titled “Free Up Disk Space on Compute Resource (SolusIO)” with all the necessary steps and context.
📘 Introduction
SolusIO uses file-based storage (e.g. qcow2
) to manage virtual machines (VPSes). While this allows for disk overcommitment and flexibility, it also introduces challenges with reclaiming unused space.
When files are deleted inside a VPS, their storage blocks are marked as reusable by the OS, but the actual disk image file (e.g. qcow2) does not shrink automatically. The space remains allocated from the host perspective unless additional steps are taken.
🛠️ Why Disk Space Isn’t Freed Automatically
SolusIO uses qemu-img
to create qcow2
images with a maximum allocated size. However:
- Deleting files inside the VPS doesn’t reduce the qcow2 image size.
- That’s because qcow2 images are unaware of guest filesystem changes.
- Space marked as “deleted” inside the VM must be explicitly reclaimed.
✅ Solution Overview
To free up disk space from the host’s perspective, you must:
🔹 Step 1: Run fstrim
Inside the VPS
This notifies the disk which blocks are unused and can be discarded.
fstrim -av
📌 Run this inside the VPS while it is running.
🔹 Step 2: Stop the VPS in SolusIO
Before performing any image-level operations:
- Go to the SolusIO Panel
- Stop the VPS you are working with
🔹 Step 3: Run virt-sparsify
on the Host (Compute Resource Node)
This tool will reduce the physical size of the qcow2 image file in place, based on the trimming done earlier.
✅ Install virt-sparsify
if not already installed:
yum -y install libguestfs-tools*
🔧 Then run:
virt-sparsify --in-place /var/lib/libvirt/images/vm123.qcow2
🧠 Replace
/var/lib/libvirt/images/vm123.qcow2
with the actual path to the VPS disk image.
📌 Notes
virt-sparsify
makes the VM image sparse, meaning free blocks are returned to the host.- This is non-destructive if used correctly, but you should back up the image before if it’s production-critical.
- Can be automated with cronjobs or integrated into routine maintenance workflows.
🧰 Optional: Check Disk Usage Before and After
To compare how much space is reclaimed:
du -h /var/lib/libvirt/images/vm123.qcow2
Before and after running virt-sparsify
.
🔚 Conclusion
While qcow2 images support overcommitment, manual cleanup is required to free disk space after file deletion inside a VPS. Combining fstrim
within the guest and virt-sparsify
on the host ensures unused space is reclaimed effectively.