Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] fstrim doesn't stick
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
etnull
Apprentice
Apprentice


Joined: 26 Mar 2019
Posts: 288

PostPosted: Mon Jun 17, 2019 1:14 am    Post subject: [solved] fstrim doesn't stick Reply with quote

I have an encrypted install with luks SSD volume being mounted with --allow-discards. When I run "fstrim -v /" it trims 80% of my drive (seems like all "empty" space apart of the system), but next time after boot I can run fstrim again and it trims the exact same space. Any ideas what's the problem here?

Last edited by etnull on Tue Jun 18, 2019 2:07 am; edited 1 time in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6342

PostPosted: Mon Jun 17, 2019 4:49 am    Post subject: Reply with quote

man 8 fstrim:
       -v, --verbose
              Verbose execution.  With this option fstrim will output the num‐
              ber  of bytes passed from the filesystem down the block stack to
              the device for potential discard.  This number is a maximum dis‐
              card  amount  from  the  storage  device's  perspective, because
              FITRIM ioctl called repeated will keep sending the same  sectors
              for discard repeatedly.

          *** fstrim  will  report the same potential discard bytes each time, ***
              but only sectors which had been written to between the  discards
              would actually be discarded by the storage device.  Further, the
              kernel block layer reserves the  right  to  adjust  the  discard
              ranges  to fit raid stripe geometry, non-trim capable devices in
              a LVM setup, etc.  These reductions would not  be  reflected  in
              fstrim_range.len (the --length option).
Back to top
View user's profile Send private message
etnull
Apprentice
Apprentice


Joined: 26 Mar 2019
Posts: 288

PostPosted: Mon Jun 17, 2019 6:08 am    Post subject: Reply with quote

Still can't quite grasp what it means, if I pass fstrim, it doesn't do it right away, but only during the next write? What's the point then? Didn't trim suppose to prepare blocks in advance for faster write??
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44921
Location: 56N 3W

PostPosted: Mon Jun 17, 2019 5:51 pm    Post subject: Reply with quote

etnull,

There is no problem.

When you run fstrim after a reboot, it reports all the free space as trimmable.
If its already trimmed, the drive will know that. You don't get any extra erase cycles because of it.
The drive keeps track of trimmed space, not the filesystem.

Trim does not compel the drive to perform an erase. The when is up to the drive.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum