When I installed my SSD I just mounted with discard
and didn't sweat it. However today I was reading about the pros and cons of using fstrim
instead and decided to run the program to get an idea of how long it would actually take (still with my partitions mounted with discard
). The command took several minutes on both my root and home partitions. For my home partition I used -v
and got this:
$ sudo fstrim -v /home
/home: 137494052864 bytes were trimmed
This is more than the amount of free space on the partition!
$ df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 206G 78G 118G 40% /home
Subsequent runs finish in less than a second, eg:
$ sudo fstrim -v /home
/home: 0 bytes were trimmed
Surely if I have always had the partition mounted with discard
, fstrim
should not trim a large amount of data like that? The discard
option is definitely enabled, here are the relevant fstab
lines:
UUID=xxxxxxxx... / ext4 noatime,discard,errors=remount-ro 0 1
UUID=xxxxxxxx... /home ext4 noatime,discard,errors=remount-ro 0 2
And mount
output lines:
/dev/disk/by-uuid/xxxxxxxx... on / type ext4 (rw,noatime,discard,errors=remount-ro,stripe=128,data=ordered)
/dev/sda2 on /home type ext4 (rw,noatime,discard,errors=remount-ro,stripe=128,data=ordered)
The SSD is a TOSHIBA THNSNS256GMCP. Why does this happen?