fstrim.service no longer trims /home partition

Bug #1858152 reported by Jeffery To
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Util-Linux-ng
Fix Released
Undecided
Unassigned
util-linux (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

When I was running disco, fstrim.service would trim all of my partitions:

Oct 21 00:00:18 computer systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Oct 21 00:00:37 computer fstrim[9588]: /home: 25 GiB (26797150208 bytes) trimmed on /dev/mapper/ubuntu--vg-home
Oct 21 00:00:37 computer fstrim[9588]: /boot: 805.4 MiB (844546048 bytes) trimmed on /dev/sda5
Oct 21 00:00:37 computer fstrim[9588]: /: 5.5 GiB (5929816064 bytes) trimmed on /dev/mapper/ubuntu--vg-root
Oct 21 00:00:37 computer systemd[1]: fstrim.service: Succeeded.
Oct 21 00:00:37 computer systemd[1]: Started Discard unused blocks on filesystems from /etc/fstab.

After upgrading to eoan, my /home partition is no longer trimmed:

Oct 28 00:00:21 computer systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Oct 28 00:00:32 computer fstrim[24667]: /boot: 781.1 MiB (819011584 bytes) trimmed on /dev/sda5
Oct 28 00:00:32 computer fstrim[24667]: /: 7.2 GiB (7696994304 bytes) trimmed on /dev/mapper/ubuntu--vg-root
Oct 28 00:00:32 computer systemd[1]: fstrim.service: Succeeded.
Oct 28 00:00:32 computer systemd[1]: Started Discard unused blocks on filesystems from /etc/fstab.

Checking the unit file (/lib/systemd/system/fstrim.service), I noticed there is a "ProtectHome=yes" option. Removing this option caused my /home partition to be trimmed once again.

I believe the "ProtectSystem=strict" option may also cause partitions in non-standard partition schemes to be skipped by fstrim.service (although I have not tested this).

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in util-linux (Ubuntu):
status: New → Confirmed
Revision history for this message
Matt Vickers (mattyv) wrote :

I can confirm this bug. Viewing systemd logs on my system showed the weekly TRIM of /home stopped around the end of October 2019 as reported by Jeffery.

This bug was filed upstream (https://github.com/karelzak/util-linux/issues/824) and will affect users with /home on a separate partition.

It was patched with the following one-line commit c64d452b3eb85fe55e238144082247b05cc143ea:
-ProtectHome=yes
+ProtectHome=read-only

Revision history for this message
Jeffery To (jefferyto) wrote :

Thanks Matt. Looks like the fix will be in the next upstream release (2.35).

Revision history for this message
Jeffery To (jefferyto) wrote :

At this moment, this issue is still present in focal. It would be nice if this can be fixed for an LTS release.

Revision history for this message
Jeffery To (jefferyto) wrote :

groovy has been released with 2.36 so I will mark this issue as fixed.

Changed in util-linux (Ubuntu):
status: Confirmed → Fix Released
Changed in util-linux-ng:
importance: Unknown → Undecided
status: Unknown → New
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.