As more small computing devices have started using SSDs (Solid State Drives), a concern is the fact that over time, if used in the same way as traditional hard drives, SSDs start to see noticeable performance degradation. This is due to how SSDs treat deleting and formatting, compared to how standard mechanical hard drives. The solution to this is called TRIM, which tells the SSD to wipe specific sectors immediately, or close to it, when a file is erased or a partition formatted.
Some operating systems, like Windows XP, are not set up to support TRIM at all. Linux is a different matter. For Linux users using kernel 2.6.33 and the Ext4 file system, TRIM support is built-in, although it is not activated by default. Fortunately for those using a device with a SSD drive, this is a pretty simple thing to accomplish.
First, go ahead and open up your Terminal.
We’ll be eding the file system table, which is where Linux keeps track of the different file systems on your hard drive, such as the boot partition, a separate Home directory (if present), a swap partition, and any others. Before we do that, however, we’ll want to make a copy of the file system table, so type sudo cp /etc/fstab /etc/fstab_backup (or something similar.
This will take your original file and make a copy of it, in the same location, but with “_backup” added to the end of its name. You’ll want to hang onto this copy, just in case something goes wrong with the rest of the procedure.
Now type gksudo gedit /etc/fstab to open up the file system table, using Gedit (the default Ubuntu text editor), as the administrator.
You’ll need to enter your password, so do this when asked.
You should now see your file system table in Gedit, able to be edited as the administrator, or root, user.
Now simply find a partition using the Ext4 file system. On this system, you’ll notice just the one, which we use as our root, or boot partition.
To force this file system to start using TRIM, add discard and a comma (but no space after the comma) to the beginning of the partition’s options. Below you’ll see what the line looks like after the change, which is highlighted in yellow.
Once this is done, go ahead and save your changes, then close Gedit.
Finally, reboot your computer for the changes to go into effect.
You’re now finished! If you do run into problems, simply delete the file you made changes to, and rename the original file (which you renamed in one of the earlier steps), and everything should return to normal.