Re: Automatic SSD trim script

Karel Zak
2014-01-13T12:12:34Z

On Tue, Dec 17, 2013 at 07:46:35PM +0000, Marcos Mello wrote:
> Karel Zak <kzak@...> writes:
>
> >
> > On Mon, Dec 09, 2013 at 02:43:32PM +0100, Lukáš Czerner wrote:
> > > > All we need is to link fstrim with libmount and lib/sysfs.c, add a new
> > > > option --all and check non-zero
> /sys/block/≤name>/queue/discard_granularity
> > > > (or so).
> > >
> > > Yes and yes. This is the ultimate solution. Simply being able to run
> > > fstrim --all to discard free space on all the mounted supported file
> > > systems is great idea. In that case we do not need any scripts at
> > > all.
> >
> > Implemented. Sten, maybe you can try fstrim --all from git tree
> > in your crontab.
> >
>
> Thanks, Karel!
>
> Would it be possible add an option for the "--all" mode to tell fstrim skip
> mountpoints witch have "discard" option in fstab?

It seems like unnecessary optimization -- the overhead on filesystem with
active discard is minimal.

(And according to Lukas in some cases FSTRIM ioctl can help you
with deleted files smaller than than discard_granularity.)

Karel

--
Karel Zak <kzak@redhat.com>