Trim in the VM

stenzelprox

Member
Jan 11, 2018
28
6
8
23
Hello everybody,
i have some questions regarding Trim in VMs on ZFS.

In VM Config discard is enabled
Code:
root@fal-pve01:~# cat /etc/pve/qemu-server/107.conf
agent: 1
bootdisk: scsi0
cores: 6
cpu: host
memory: 12288
name: fal-mail01
net0: virtio=XXXXXXXXXXXX,bridge=vmbr1
numa: 0
onboat: 1
ostype: l26
scsi0: local-zfs:vm-107-disk-1,cache=writeback,discard=on,size=99G
scsihw: virtio-scsi-pci
smbios1: uuid=286ed534-4141-4730-bd1f-ac3a82XXXXX
sockets: 1
Does discard=on only say that it is possible ?
Do I still have to activate VM Trim ?

The system runs on two NVME SSDs (TOSHIBA KXG50ZNV512G).
 
  • Like
Reactions: Atila Vasconcelos
Thanks for the info.

I have now added discard in the fstab as mount option.

Code:
root@fal-mail01 ~ # cat /etc/fstab
...
UUID=d5b559e4-4ef1-45a5-813c-ecXXXXXX1 /               ext4    discard,errors=remount-ro 0       1
...

And once entered
Code:
fstrim / -v
 
  • Like
Reactions: Atila Vasconcelos
note that your don't need discard option in /etc/fstab to have fstrim working.

discard option in /etc/fstab discard directly when you delete a file. but be carefull, only recent linux kernel are doing this async. (>=4.7).
if not, you'll wait on each file delete that discard is finished.
 
Thanks again for the information.
The kernel shouldn't be a problem as far as I know we have nothing older than Debian Stretch.
But is batched discard or online discard better recommended ?
And if I use batched discard how often should it run the trim ?
 
  • Like
Reactions: Atila Vasconcelos

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!