3

I've noticed from time-to-time that running fstrim on mounted ext4 filesystems yields massive amounts of trimmed space even when these filesystems are mounted with the discard option. I thought the discard mount option was supposed to trim ext4 right away. Why does this not seem to be the case? NOTE: scd1 is on a pass-through disk behind an Areca RAID controller if that makes the difference.

# fstrim -v /mnt/cache/
/mnt/cache/: 1351144587264 bytes were trimmed

# mount | grep cache
/dev/sdc1 on /mnt/cache type ext4 (rw,noatime,nodiratime,discard)
Server Fault
  • 3,714
  • 12
  • 54
  • 89
  • 1
    To find out why, run `fstrim` twice in succession. – Michael Hampton Dec 21 '16 at 18:43
  • 1
    It is also recommended to not use the `discard` mount option but rather let a `cronjob` do the work or a `systemd-timer` once a week which once Ted T'so [recommended](http://article.gmane.org/gmane.comp.file-systems.ext4/41974). – Thomas Dec 21 '16 at 18:57
  • 1
    Thanks for the link. Had no idea discard was problematic. – Server Fault Dec 22 '16 at 20:03
  • 2
    @MichaelHampton - first run: 3658035200 bytes trimmed, second run: 0 bytes trimmed. Seems to make sense. What have I missed? – Server Fault Dec 22 '16 at 20:21

0 Answers0