fstrim doesn't trim my /home separate partition

Bug #1932305 reported by Francisco T.
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
util-linux (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

My system is Kubuntu 20.04

I have 3 partitions in my nvme:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 465,8G 0 disk
├─nvme0n1p1 259:1 0 251M 0 part /boot/efi
├─nvme0n1p2 259:2 0 53,7G 0 part /
├─nvme0n1p4 259:3 0 7,6G 0 part [SWAP]
└─nvme0n1p5 259:4 0 357G 0 part /home

I have activated fstrim.service and fstrim.timer:
sudo systemctl list-timers
...
Mon 2021-06-21 00:00:00 CEST 3 days left Mon 2021-06-14 00:00:03 CEST 3 days ago fstrim.timer fstrim.service

But home partition is not trimmed:
...
jun 14 00:00:10 moon fstrim[5137]: /: 29,1 GiB (31264600064 bytes) trimmed on /dev/nvme0n1p2
jun 14 00:00:10 moon fstrim[5137]: /boot/efi: 239,1 MiB (250755584 bytes) trimmed on /dev/nvme0n1p1
jun 14 00:00:10 moon systemd[1]: fstrim.service: Succeeded.
...

The fstrim.service is Protected for home:
sudo systemctl cat fstrim.service
# /lib/systemd/system/fstrim.service
[Unit]
Description=Discard unused blocks on filesystems from /etc/fstab
Documentation=man:fstrim(8)
ConditionVirtualization=!container

[Service]
Type=oneshot
ExecStart=/sbin/fstrim --fstab --verbose --quiet
ProtectSystem=strict
ProtectHome=yes
PrivateDevices=no
PrivateNetwork=yes
PrivateUsers=no
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
MemoryDenyWriteExecute=yes
SystemCallFilter=@default @file-system @basic-io @system-service

I think the problem is:
https://github.com/karelzak/util-linux/commit/61b384b36105fe682ddf16b9379f446d935603bc

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
Steve Dodd (anarchetic) wrote :

This is due to "ProtectHome=yes" in the .service file; the workaround is to add:

[Service]
ProtectHome=no

In e.g. /etc/systemd/system/fstrim.service.d/allow-home.conf

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.