From: Christian Ebner <c.ebner@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: Re: [RFC proxmox{,-backup} 0/6] add scheduled fstrim job for datastore's backing filesystems
Date: Wed, 25 Mar 2026 09:22:03 +0100 [thread overview]
Message-ID: <66706ce3-ba66-4acb-b9d1-677071978040@proxmox.com> (raw)
In-Reply-To: <ddc325db-cbc9-4173-b125-f6c97e1afb4b@proxmox.com>
On 3/25/26 8:08 AM, Thomas Lamprecht wrote:
> Am 19.03.26 um 15:37 schrieb Christian Ebner:
>> As reported in the community forum [0], the default systemd service
>> to run fstrim does not cover datastores mounted via systemd mount
>> unit, since the fstrim command is invoked via:
>> ```
>> fstrim --listed-in /etc/fstab:/proc/self/mountinfo ...
>> ```
>> which however only considers the list up to the first non-empty
>> file according to the man page [1].
>
> But basically that means systemd would already be totally fine with
> fstrim'ing all mounted file-systems, not sure if its really worth to
> reimplement this ourselves, especially given that a single datastore
> doesn't exactly map to one filesystem. Also, ZFS, a popular choice for
> datastores, comes with it's own trim handling triggering every first
> Sunday of a month (see /etc/cron.d/zfsutils-linux).
The initial idea was to simply drop the /etc/fstab part in an override
and therefore trim all mounted filesystems. There were however valid
concerns for doing that in case of e.g. co-installations of PBS with PVE.
> I'd rather prefer leveraging what's existing compared to carry our own
> implementation here, not just for the (probably not *that* big)
> maintenance burden, but also because it increases complexity in general
> by re-implementing parts of systemd ourselves (can be fine, if there's
> a good reason, I'm not yet convinced that this is one).
>
> I'd rather hook into fstrim.service/timer (e.g. through an override that
> can add another ExecStart). If it turns out that this is so frequently
> in need for per-datastore configuration with good use cases where such
> an approach really falls short, we can still provide actual integration
> into api/ui/... and OTOH, we cannot easily drop such an integration like
> here again.
Okay, then let's go down this route: So if I understand your suggestion
correctly, you would simply write or append the systemd overwrite on
datastore creation, identifying the underlying filesystem and adding the
additional fstrim command invocation for this datastore backing
filesystem? ZFS filesystems excluded, that is...
>> To allow for easy configuration of scheduled fstrims also on
>> filesystems backing datastores in PBS, implement a scheduled job
>> with per-datastore schedule configuration. Enable and default to
>> executing the fstrim job for new datastores (except crated via ZFS
>> dialog).
>>
>> Open question remaining:
>> How to best handle datastores located on ZFS? Should the command default
>> to zpool trim? Should it set `autotrim=on` on datastore creation instead
>> and silently ignore as it is now?
>
> see above, it's already handled.
I see, thanks for pointing this out!
prev parent reply other threads:[~2026-03-25 8:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 14:36 Christian Ebner
2026-03-19 14:36 ` [PATCH proxmox 1/1] pbs-api-types: define fstrim schedule on datastore config Christian Ebner
2026-03-19 14:36 ` [PATCH proxmox-backup 1/5] tools: add helper to run fstrim command on path or mountpoint Christian Ebner
2026-03-19 14:36 ` [PATCH proxmox-backup 2/5] api: config: expose fstrim schedule for datastores Christian Ebner
2026-03-19 14:36 ` [PATCH proxmox-backup 3/5] bin: proxy: periodically schedule fstrim on datastore's filesystems Christian Ebner
2026-03-19 15:02 ` Christian Ebner
2026-03-24 14:02 ` Fabian Grünbichler
2026-03-19 14:36 ` [PATCH proxmox-backup 4/5] ui: expose per-datastore fstrim job schedule Christian Ebner
2026-03-19 14:36 ` [PATCH proxmox-backup 5/5] api: set default fstrim schedule on datastore create Christian Ebner
2026-03-25 7:09 ` [RFC proxmox{,-backup} 0/6] add scheduled fstrim job for datastore's backing filesystems Thomas Lamprecht
2026-03-25 8:22 ` Christian Ebner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=66706ce3-ba66-4acb-b9d1-677071978040@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
--cc=t.lamprecht@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.