Fstrim & Discard on Raw Disk

daftlink

Member
Mar 14, 2021
20
0
6
31
Hello
Since I've enable a replication between a remote server and one of my VM I notice a constant increase of the storage. In fact, when I discovered it when I reach 100% of my Thin-provisionning capacity on the data pool. So after reading a couple of thread, I found that I need to enable Discard option and do 'fstim' command inside the guest.

However as there's a continuous sync, the size increase around 5GB by hour which makes it necessary for me to rerun the command every 4-6 h. Is there a way to automatically free unused storage.
I'm also wondering about the impact on my hardware which is an NVMe and especially about lifespan.

Below VM config:

Code:
boot: order=scsi0
cores: 2
memory: 4096
name: laura
net0: virtio=4E:63:E8:31:F4:5D,bridge=vmbr0
numa: 0
onboot: 1
ostype: l26
scsi0: local-lvm:vm-100-disk-0,size=10G
scsi1: local-lvm:vm-100-disk-1,backup=0,discard=on,size=650G
scsi2: local-lvm:vm-100-disk-2,discard=on,size=11G
scsi3: local-lvm:vm-100-disk-3,size=3G,ssd=1
scsihw: virtio-scsi-pci
smbios1: uuid=8aa2682b-6e4f-4461-ba2f-cba235c78151
sockets: 1
startup: order=1
vmgenid: 64ff41b1-5a4b-4177-94fd-e6800d6cc98c

Below storage.cfg
Code:
dir: local
        path /var/lib/vz
        content backup,iso,vztmpl

lvmthin: local-lvm
        thinpool data
        vgname pve
        content images,rootdir
 
You could add "discard" to the options of your ext4 partitions in your guests /etc/fstab. Then every write to that partition will send a TRIM command.
Or you could use crontab to for example run "fstrim -a" every hour.

Discard should't hurt your SSD life expecation but it should increase it, because an emptier drive can better handle wear leveling and SLC caching.
But if that SSD drives that much you should really monitor it using SMART.
 
You could add "discard" to the options of your ext4 partitions in your guests /etc/fstab. Then every write to that partition will send a TRIM command.
Or you could use crontab to for example run "fstrim -a" every hour.

Discard should't hurt your SSD life expecation but it should increase it, because an emptier drive can better handle wear leveling and SLC caching.
But if that SSD drives that much you should really monitor it using SMART.
Thank you, yes I think about cron job but I was wondering if there is any other option to do it automatically and directly from PVE.
 

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!