TRIM Host, CT & Windows VMs

Henry

Member
Jan 1, 2016
83
0
6
50
After reading many posts I am still unclear on the best use of Trim with SSDs.

I have two RAID1 SSDs on a Perc H730 controller which supports trim:
http://i.dell.com/sites/doccontent/...ments/Dell-PowerEdge-RAID-Controller-H730.pdf

Currently my server boots with SAS disks and my Windows VMs sit on an SSD LVM VG called virtual-machines.

I have read the following on the difference and performance impacts of auto vs manual trim:
http://askubuntu.com/questions/205930/automatic-trim-vs-manual-trim

What is the process to trim my PVE host, CTs and WIndows VMs? Do the VMs need to be trimmed from within the VM or can I simply run fstrim-all inside cron.weekly?
 
Windows can use TRIM starting with Windows 7 if the underlying disk supports this, so you only need to have discard enabled on the virtual disks. This uses then the appropriate trim calls if the whole storage stack supports this (should be in your case).

I do not know if fstrim-all will also trim your CTs, but it could be. Normally the CTs are "mounted", so it should work. I do not have fstrim-all inside cron.weekly, could you please share it here? Afterwards it'll be easier to give an opinion.

I only want to state that TRIM is nowadays considered obsolete and sometimes even dangerous, depending on the firmware or controller version. You have to check if you should run TRIM or not!
 
I was referring to the following article:
http://askubuntu.com/questions/18903/how-to-enable-trim

/etc/cron.weekly/fstrim

#! /bin/sh

# By default we assume only / is on an SSD.
# You can add more SSD mount points, separated by spaces.
# Make sure all mount points are within the quotes. For example:
# SSD_MOUNT_POINTS='/ /boot /home /media/my_other_ssd'

SSD_MOUNT_POINTS='/'

for mount_point in $SSD_MOUNT_POINTS
do
fstrim $mount_point
done​


I am still unsure of how to trim my LVM CTs & VMs.

I have just checked my VM virtual disks and can see a "Discard" option, does this option TRIM discards within the VM?
 
The KVM option enabled the discard option, if it is not already propagated to the KVM VM. Try to trim inside with normal fstrim. Try the same in your containers.
 
So if I select "discard" on the VM virtual disk in Proxmox then my Windows VM will discard internally without me doing anything and Proxmox will pass this down to the SSD?

Have I understood correctly?
 
Yes, if your whole storage stack supports this, then it'll work.

Yet please remind: TRIM is not always a good idea. I've never seen TRIM/discard in an enterprise environment. Normally, this is no longer necessary.
 
Thanks LnxBil, one further question if I may.

I understand TRIM informs the SSD of which areas of the disk are available for reuse. Having now enabled discard on my VMs virtual disks any future changes will be notified to the SSD as being available.

What about the areas that were written to date without the discard option, how can I notify the SSD of this space as being available and is there a way to tell if my SSD is fully trimmed?
 
If you want to fully trim, you can use blkdiscard in Linux. This trims the whole device and is as dangerous as it sounds.

Normally, you trim regularly (e.g. via cron) and not every time you delete a block. The later can decrease performance significantly. I do not know how M$ implemented this. If you've already enabled discard can be seen in Windows if you want to defrag your disk. SSD-based disks are not supported for defragmentation.
 
Does this mean that to trim correctly I cannot use the VirtIO driver for my disks?

I understood this was required to get maximum performance in Windows VMs.
 
Yes, windows is always something special :-D

Yet, you still use virtio, a virtio emulated scsi controller. You can easily try this without a real SSD if you use ZFS and discard option.
 

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!