# Solid State/TRIM/Erase free space



## waksmundzki (Sep 12, 2010)

While there is the -E flag of newfs to TRIM solid state drives when making a new filesystem, I wonder: would it be possible to add a flag like that to fsck? That way we could TRIM a live filesystem (hopefully in the backgroud).

This would be very helpful for those using SSDs on busy database servers. It would restore the full speed of the SSDs without the need to backup/stop/newfs -E/start/restore cycle that is necessary right now.

This could also double as "zero out free space" application useful for the privacy freaks. (Even or regular old hard drives)

Implementation wise this should not be that hard as fsck must know already which blocks are free, right?

IMHO this could be a great "quick fix" while we wait for UFS2. Not that much new code I hope.

What do you guys think?


----------



## aragon (Sep 13, 2010)

I wonder if, in the mean time, a script could be crafted that takes the output of dumpfs(8) (-f) and generates a batch of ATA CDBs for camcontrol(8)'s cmd command?


----------



## waksmundzki (Sep 13, 2010)

Crazy enough to work but the filesystem must be dropped down to read only. Otherwise say goodbye to your data


----------

