clear unused space on thin-lvm

andy77

Renowned Member
Jul 6, 2016
248
14
83
41
Hello @ all,

I have a few Windows VMs on a thin-lvm storage. Now some temporary files where written on the drives that took much space, and my lvm storage on the node is almost empty. I have now deleted the temp files of windows but it is still using the space on the lvm storage. How to clear this?

Thanks a lot
 
OK, it seems that the "Discard" function does not works with "virtIO" driver.

Does someone have an idea? I am really in trouble because my space is running out.....
 
OK, the thin-lvm storage is full...... F***
I am actually moving one disk to another "slow" storage to have a temporary fix but would really need a solution for shrinking the disks.

I tried to do it with

Code:
qm resize <vimid> <disk> <size>

But this is only telling me

Code:
unable to shrink disk size
 
So the only way I figured out actually is to change the disks from "virtIO" to "virtIO_scsi" and enable "Discard" option. But how to acomplish that?
 
First add some NFSserver as storage for disks. Move the affected disk to NFSstorage as RAW. Then shrink the disk, and move the disk back (movebutton on webinterface). Do change from virio to scsi, at some 1GB disk to Windows, install drivers from virtio.iso, then shutdown and change to bus from bootdisk.
 
Hello, thx for your answer. I yesterday found after a very long time trying, a solution. Maybe it helps somebody:

Code:
1) Change controller type to "VirtIO SCSI" in options of the VM
2) Mount the newest VirtIO driver ISO
3) Create a new (small) SCSI drive
4) Boot Windows VM, Install the VIOSCSI driver form the CD
5) Go in Windows to "Disk Management" and activate the new SCSI Drive to check if driver works.
6) Shutdown VM
7) On node open "/etc/pve/nodes/nodename/quemu_config/100.conf" and change "boot" and all drives to "scsi
8) Activate the "discard" option for the drives
9) The VM schould boot now. Now go again to "Disk Management" and set the other drives to "Online" because they are maybe offline.
10) Check if your dirve letters changed
11) In Explorer right click on your drive - > tools - > optimize. Now you can force Windows to do the trim.

This way the space should be immediately free on your thin-lvm storage.
 
Hello, I have the same problem, i'm trying to trim 2 windows 7 vm's that i've migrated to virtio-scsi controller, i have the drivers installed and it seems to work (95% data usage in the lvm-thin of the vm) but it doesn't correspond to the amount of free disk.

In other clean installs of windows 10 all seems to be correct, the free space corresponds to data usage.

I can't find a way to trim the windows 7 machines with the optimize tool, i only have defrag.
Hello, thx for your answer. I yesterday found after a very long time trying, a solution. Maybe it helps somebody:

I've also tried the solutions on this link: https://pve.proxmox.com/wiki/Shrink_Qcow2_Disk_Files

Any clue? Thanks.
 
You issue trim to free space on lvm-thin regardless of storage disk type spinner or ssd.
On windows vm to force trim run in powershell:
Code:
Optimize-Volume -DriveLetter C -ReTrim -Verbose
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!