Where can I find fstrim?


I set up LEDE 17.01.4 on a new x86/64 based machine. It's installed on a SSD, so I would like to use filesystem trimming. I know LEDE/OpenWrt doesn't do many writes to the filesystem. But I also would like to use a seperate partition with more filesystem activity.

I've looked though the packages, but couldn't find any package for fstrim? Is it hidden in some package I didn't see yet?

Btw. the package table on the wiki doesn't work for me at the moment, only the index....


Fixed, working again.

1 Like

Take a look at blkdiscard


The blkdiscard is used to discard device sectors. This is useful for solid-state drivers (SSDs) and thinly-provisioned storage. Unlike fstrim, this command is used directly on the block device.

Doesn't blkdiscard basically delete everything?

If I read the man page further it says:

By default, blkdiscard will discard all blocks on the device. [...] WARNING: All data in the discarded region on the device will be lost!

It does have options to define an offset and a size of the region to be discarded, but I don't see an option that would limit it to unused or unallocated space only. So, it doesn't look like the right tool for the job to me, or am I missing something?

For a longer time I'm using a patched util-linux version for my APU2 ... yesterday I've opened a pull request with this patch (see here), perhaps it will be accepted.

1 Like

Awesome, thanks! I hope this will be backported to 17.01 as well, as I'd like to stick with the "stable" release and not start compiling my own builds again just because of one package.