I have a few Proxmox clusters, all running a mix of LXCs and VMs. Most of them have their disks on Ceph, but some are on ZFS or LVM-thin. Almost all of the containers/VMs are running debian 12/13.
I know how disk trimming works when it comes to VMs:
- I enable the "discard" option of the virtual disk
- Inside the debian VM, the service "fstrim.timer" runs once a week and trims the disk
- I can see the fstrim service run each week in the logs, it does the thing
Now my question: how does this work for LXC containers? How can I verify that it's working? I can find very little documentation, nor forum posts. Most info is about VMs and not LXC containers.
Old post i found: https://forum.proxmox.com/threads/is-it-possible-to-auto-trim-for-lxc-disks.57195/
I know that the fstrim.timer is disabled inside the LXC, because the container doesn't have enough rights to run fstrim on the file system. So we need to do it from the host and Proxmox provides a command for this: pct fstrim <id>
BUT I'm just wondering whether Proxmox runs this automatically somehow? Like the weekly fstrim.timer for VMs. I know the Proxmox host also has an fstrim.timer, but I don't see that trimming any LXC containers in the logs.
If Proxmox doesn't run this weekly, what is the recommended way of doing it? Cron job? Systemd timer?
Personally, I feel like this should be a Proxmox feature. VMs have it... so why not LXC containers?
Kind regards,
Alexander
I know how disk trimming works when it comes to VMs:
- I enable the "discard" option of the virtual disk
- Inside the debian VM, the service "fstrim.timer" runs once a week and trims the disk
- I can see the fstrim service run each week in the logs, it does the thing
Now my question: how does this work for LXC containers? How can I verify that it's working? I can find very little documentation, nor forum posts. Most info is about VMs and not LXC containers.
Old post i found: https://forum.proxmox.com/threads/is-it-possible-to-auto-trim-for-lxc-disks.57195/
I know that the fstrim.timer is disabled inside the LXC, because the container doesn't have enough rights to run fstrim on the file system. So we need to do it from the host and Proxmox provides a command for this: pct fstrim <id>
BUT I'm just wondering whether Proxmox runs this automatically somehow? Like the weekly fstrim.timer for VMs. I know the Proxmox host also has an fstrim.timer, but I don't see that trimming any LXC containers in the logs.
If Proxmox doesn't run this weekly, what is the recommended way of doing it? Cron job? Systemd timer?
Personally, I feel like this should be a Proxmox feature. VMs have it... so why not LXC containers?
Kind regards,
Alexander