1

When I boot in my guest Debian it says it size is 2.7G.

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            718M     0  718M   0% /dev
tmpfs           147M  6.2M  141M   5% /run
/dev/vda1        98G  2.7G   91G   3% /
tmpfs           734M  4.0K  734M   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
none             10M  4.0K   10M   1% /run/msgcollector
tmpfs           147M  4.0K  147M   1% /run/user/1000

This is a sparse 100GB disk. In my host OS I see it as 4.5G.

sudo du -sh generic.qcow2
4.5G   generic.qcow2

I tried to boot from live cd and run

zerofree guestdisk

Then I tried

sudo virsh-sparsify --in-place generic.qcow2

But it's still 4.5G

user574429
  • 11
  • 2

3 Answers3

2

Try this

qemu-img convert -f qcow2 -O qcow2 -c orig.qcow2 new.qcow2

-c = Compress

0

Qemu-convert works fine from CLI but you cannot have any snapshots present.

The easiest way is to simply clone the vm from the gui (virt-manager)- that automatically compacts the qcow2 - then delete the original.

Peleion
  • 303
  • 1
  • 7
-1

That file system has the metadata for a 100 GB volume. Approximately the size of the entire disk minus df's reported total Size, or the sparse file's real size minus Used. Either way, roughly 2 GB.

To reduce it, create a new smaller file system, do file based backup restore to the new volume, and delete the larger disk.

Or, as the only disk on this instance, may be faster to create a new OS instance on a smaller /, then restore only data and customization.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34