trim your ssd

September 16, 2011 § 1 Comment

if you are building a system that uses solid state drive (ssd) which is a must if you are making industrial equipment that needs storage, make sure the operating system you use supports trimming. now that the solid state drives are widely used because of their price being comparable to the traditional drives’, operating system companies are adding the trim command support to their oses.

the trim command is introduced due to the difference in writing and over-writing performances on the solid state drives as opposed to the traditional moving parts drives that treat over-write as a write function. mlc nand flash based ssd’s (the common ssd drives in the market) smallest unit of storage is called a page which is 4kb. 128 pages comprise a block which is the ssd’s smallest erasable unit. this means that even though you are removing a small file, the whole block will not be erased if there are used pages in that block. the traditional way of removing files in oses is just by marking the page as not-in-use in os side, so the drive will not have any idea which pages are in use and which ones are not. these two facts will result in the drive not be able to wipe the blocks that are completely not-in-use. for example when you want to modify a small file on an ssd, the file will be marked not-in-use in os (traditional delete process) and then it will be written on a different block because the drive doesn’t know the current block can be wiped. this process is fine until the drive gets to a point that it goes out of empty blocks and needs to write to the already marked-as-delete pages. now the whole block has to be read into the memory then be erased from the ssd, the new data has to be inserted into the block and the block to be written to the disk again. this extra overhead is what kills the performance of the drives over long term.

trim is a command that lets the drive know which blocks are not in use and ready for garbage collection, this way the erase can be done when you delete a file rather than when you want to write on that block which result in avoiding the extra overhead.

linux started supporting the trim from version 2.6.33 onward, and windows with server 2008 server r2. for a complete list of the supporting oses see the wiki like here.

to add the support on linux you also need ext4 file system, for how to add trim support on linux please see this link.

Advertisements

Tagged: , , , , , , , ,

§ One Response to trim your ssd

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading trim your ssd at artang.

meta