trim container filesystem on lvm-thin

michabbs

Active Member
May 5, 2020
132
19
38
What is the "correct" way to automatically trim filesystems residing in lvm-thin pool?

I can see there is "pct fstrim" command and I can run it manually (and it works!), but... it seems strange that such important functionality have to be done manually. Is there any "standard way" of doing it automatically? Or should i simply put it to cron and forget?
 
Hi,

i put it in a cron job which is executed once a week, works great so far.

Bash:
#!/bin/bash
PCT=/usr/sbin/pct
for i in $($PCT list | grep running | awk '/^[0-9]/ {print $1}'); do
  $PCT fstrim $i
done
 
Last edited:
  • Like
Reactions: michabbs

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!