Hurrah for SSD fans! Ubuntu 14.04 will have TRIM turned on
Canonical’s Martin Pitt brings a bit of late season cheer to GNU/Linux fans: the next release of Ubuntu, 14.04, will have TRIM enabled by default. If you’re not a tux-head you might struggle to understand why this news has had the internet celebrating this week, so let us explain.
If you have a solid state drive (SSD) in your computer, and if you’ve bought it in the last 12 months or so the chances are high that you do – you want to have TRIM switched on. On a traditional hard drive, where data is stored on a magnetic disc, it’s easy to free up space. When you delete a file, you aren’t actually removing it from the disk, you’re just telling your computer to forget where you stored it. When you write a new file to that space, it simply gets written over the top of the old one – what’s happening inside the drive is that the polarity of the physical bits is changed by a single pass of the read/write head.
On a solid state drive, things aren’t quite so simple. Bits are stored in memory cell transistors rather than as physical molecules which are moved around by a big magnet, and those transistors have to be wiped clean before new data can be written to them. What that means is that when your PC wants to overwrite old data that it thinks has been deleted, it needs to send two commands to the drive rather than one – the first one to clean the data cell, the second to write the data.
This is obviously not optimal, and means that as SSDs get older and areas are written to then written over repeatedly, they actually slow down. Which is why TRIM was invented. What TRIM does is to wait until you’re not using your SSD, then it goes on the hunt for data cells which have information in them which the operating system believes has been deleted. It nukes the data in those cells, leaving them nice and clean for the next write operation which can happen at full speed.
Windows, Mac OSX and GNU/Linux have all supported TRIM for several years now – as far back as 2009 for Windows, in fact. The difference is that most Linux distributions – including Ubuntu – have required you to turn TRIM on manually, by going into the command line options for booting up and adding extra parameters for specific disks.
It’s not a particularly difficult thing to do, but it does mean you’re kultzing around in parts of the operating system that can break everything if you aren’t careful. Also, in my experience, it doesn’t work very well – if at all in most cases.
According to Pitt, however, the Canonical devs have finally got round to sorting out what should have been a basic feature for Ubuntu. Most likely they were motivated by the push to get 14.04 on to phones and tablets, all of which use exclusively SSD storage. Whatever the reason, it’s a blessed relief for those of us who use GNU/Linux for our day jobs but have never quite found the time to troubleshoot dodgy TRIM commands.