Shrinking XP disks

Apr 26, 2018
111
10
23
What is the exact syntax to shrink an XP virtual disk?

I'm looking at shrinking XP KVM disks of unused disk space. There is a wiki topic, but the topic lacks specific information.

The example shows:

cp image.qcow2 image.qcow2_backup

There are no files on the host with a qcow2 file extension. There are files using the naming convention of vm-XXX-disk-1, where XXX is the VM ID.

The QEMU guest agent is installed. The qm man page shows the following to discard unused space:

qm guest cmd <vmid> fstrim

Is all that is needed is run sdelete inside the XP guest and then run the qm guest cmd <vmid> fstrim command?
 
Last edited:
Hi,

There are no files on the host with a qcow2 file extension. There are files using the naming convention of vm-XXX-disk-1, where XXX is the VM ID.

which storage do you use, lvm, zfs, ...? Can you post a qm config VMID of that VM?

qm guest cmd <vmid> fstrim

Is all that is needed is run sdelete inside the XP guest and then run the qm guest cmd <vmid> fstrim command?

fstrim makes the guest OS just tell the host which blocks on the disk it doesn't actually uses, so it may free up some space on sparse storage but the disk size won't be touched by this.
 
Using LVM. Don't use ZFS.

lvs:

Code:
LV            VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
vm-223-disk-1 pve Vwi-aotz--  60.00g data        20.69

223.conf:

Code:
#Windows XP
agent: 1
balloon: 0
bootdisk: ide0
cores: 2
cpu: kvm32
ide0: local-lvm:vm-223-disk-1,size=60G
ide2: none,media=cdrom
memory: 2048
name: xxxxxxxxxxxxxxx
net0: e1000=FE:C4:BB:D9:38:64,bridge=vmbr1
numa: 0
onboot: 1
ostype: wxp
smbios1: uuid=bc888a6d-9172-4801-bec6-a92c1761e3e2
sockets: 1

fstrim makes the guest OS just tell the host which blocks on the disk it doesn't actually uses, so it may free up some space on sparse storage but the disk size won't be touched by this.

I understand the assigned/allotted disk size remains the same. My goal with freeing unused blocks is to shrink the reported used space so the vzdumps don't keep growing in size.