Trim virtio block hdd

Bestbeast

Well-Known Member
Jul 29, 2016
163
5
58
29
Hello guys,

I was currently trying to free up space in the node, and have deleted multiple files in my VMs however it seems that fstrim -va command is showing no output, and lvs -a in proxmox node shows still the same amount of occupied space in my VMs.
I am currently running virtio block for my VMs, and I saw in the proxmox docs that trim should be supported only for kernels above 5.X, sadly mine is below that one.
I guess there is no other way to free up space in proxmox if it is not with trim option?

Thanks in advance
 
VirtIO SCSI had earlier support for trim. You could try switching your disks to it, but I cannot guarantee that it will work for your VM.
 
VirtIO SCSI had earlier support for trim. You could try switching your disks to it, but I cannot guarantee that it will work for your VM.

But I guess that means reinstalling everything I have on my VMs to move to VirtIO SCSI, doesn't it?
So, the way to use thin proviosioning correctly is just to make trimming working on the VMs always?
I guess this has nothing to do with the physical disk itself or it does? I mean, in case I had an HDD and not an SSD, for proxmox to know how much space does it need to free up, it will be needed also for trim to work inside the VM, even the main disk not being SSD?
 
Last edited:
But I guess that means reinstalling everything I have on my VMs to move to VirtIO SCSI, doesn't it?
Linux usually has not too much trouble with switching drives from /dev/vda to /dev/sda, but you might have to make changes to /etc/fstab. Make sure your Linux has support for VirtIO SCSI (but I expect it will if it supports VirtIO Block).
So, the way to use thin proviosioning correctly is just to make trimming working on the VMs always?
I guess this has nothing to do with the physical disk itself or it does? I mean, in case I had an HDD and not an SSD, for proxmox to know how much space does it need to free up, it will be needed also for trim to work inside the VM?
In principle yes, but you have to make sure every domino lines up.
 
In principle yes, but you have to make sure every domino lines up.
But does it go VM >> HDD/SSD >> Proxmox, or VM >> Proxmox >> SSD

Just asking since HDD don't usually support trim actions. So if it goes VM >> HDD/SSD >> Proxmox, I currently don't trim thin provisioning will work correclty with an HDD, doesn't it?
 
But does it go VM >> HDD/SSD >> Proxmox, or VM >> Proxmox >> SSD

Just asking since HDD don't usually support trim actions. So if it goes VM >> HDD/SSD >> Proxmox, I currently don't trim thin provisioning will work correclty with an HDD, doesn't it?
I don't fully understand the question. The VM trims/discards the blocks that are not used by the filesystem (inside the VM), which allows thin provisioning underneath it to free some of the blocks of the virtual disks.
Whether or not your storage is file-based or block-based on SSD or HDD is a separate thing, which might wants/needs to be trimmed also (or is trimmed automatically, depending on your setup).
 
I don't fully understand the question. The VM trims/discards the blocks that are not used by the filesystem (inside the VM), which allows thin provisioning underneath it to free some of the blocks of the virtual disks.
Whether or not your storage is file-based or block-based on SSD or HDD is a separate thing, which might wants/needs to be trimmed also (or is trimmed automatically, depending on your setup).
Oki then I guess it goes from VM >> Promox.

Do you know how can I check if proxmox is also trimming the information in the main server disk?
 

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!