A solid state drive (SSD) is often the cheapest way to improve all-round performance in a computer.
There are many guides for setting up an SSD for each operating system. When I did a recent reinstall of Xubuntu, I looked through a few of the guides and picked what I felt were the most important things. To my mind, these are the two biggest things:
- Ensure that the drive controller is running in ACHI mode. This is an option in the BIOS. (Note: With Windows, you need to change this mode before installing. I haven't tried changing it with a Linux install, but it will trash a Windows install).
- Edit /etc/fstab to add "noatime,nodiratime,discard" options for the SSD partitions.
Since SSDs have a lifetime measured in "number of writes", much of the tuning advice is aimed at reducing the number of unnecessary writes.
Here's a few other things I did.
WARNING: I based doing this on the principle of "OS/applications on SSD, data/media on HDD", and "reduce unnecessary writes". Whether or not they are good things to do (particularly, mapping /tmp to a different drive while the system was running), I have no idea. It worked for me, but I didn't base this activity on any existing guide.
I have one SSD (Samsung 830 128GB) and one HDD (Seagate Barracuda 2TB). During installation, I partitioned the SSD into ~80GB for the "primary" OS and the remainder for "experimental" OS installs.
I allocated the swap space to the HDD, since this could case a lot of writes if the system ever needs to swap out (probably rare, given the RAM available). I mounted the HDD as "/files".
Mapping Files in User Home Directory
By default /home contains all the user's files. When I was using Mint, it automatically created "Documents", "Downloads", "Pictures", "Videos" etc. in the user home directory. I maintained this with Xubuntu (can't remember if Ubuntu variants do this by default), but replaced the true directories with symbolic links to the equivalent directories in the HDD (in the /files partition).
$ rmdir Documents $ ln -s /files/ashley/Documents Documents
This means that all these files are stored on the HDD, keeping the SSD free from associated writes.
Mapping Email and Browser Data
The user's home directory also contains email and browser data. So I symbolic linked my thunderbird mailbox to the HDD as well. This Firefox support post explains how to move the Firefox cache to another drive. In hindsight, I probably should have just linked the entire Firefox folder as well.
I remapped /tmp from the SSD to the HDD. This one was a bit of an experiment. It could have killed my system, I suppose, but everything seemed okay, so I'll explain what I did.
The system uses the directory /tmp to store random runtime stuff as needed. It's a special directory in that anyone can write to it. You need to set the "sticky" flag for this. If you do an "ls -l" on it, you'll see something like this:
drwxrwxrwt 2 user user 4096 Nov 19 20:13 tmp
The "t" character at the end of the first column indicates the sticky bit is set. This is what I did to move my /tmp directory:
$ sudo mkdir /files/tmp $ sudo chmod 777 /files/tmp $ sudo chmod +t /files/tmp $ sudo rm -rf /tmp $ sudo ln -s /files/tmp /tmp
The reason I noticed I needed to set the sticky flag (the "chmod +t"), is that without it, filename completion in the terminal stopped working. I imagine a whole heap of other stuff would have to.
Also, when I look at my tmp folder now, the "t" flag no longer appears. Not sure why, but everything still seems to work.
So, there it is: cowboy setup for reducing SSD writes.