HOWTO: Optimize Linux For SSDs

Linux LogoBE SURE TO USE EXT2 WITH NOATIME

Journaling adds writes. If possible, specify ext2 with the noatime option during install. If you specified ext3, you can switch over to ext2 with no hassle. If you didn’t specify ext2 and/or noatime at install, you can do it afterwards by editing /etc/fstab.

sudo nano /etc/fstab

Look at the line that contains partitions that are on the SSD. It should look something like this:

UUID=1eea26d7-6893-4779-827b-150412c94703 / ext2 relatime 0 1

Replace ext3 with ext2 and relatime or defaults with noatime

CHANGING THE TASK SCHEDULING ALGORITHM

sudo nano /boot/grub/menu.list

Press CTRL+W to find the string # kopt. It should look something like this:

# kopt=root=UUID=1eea26d7-6893-4779-827b-150412c94703 ro

Add the option elevator=noop so that it looks like this:

# kopt=root=UUID=1eea26d7-6893-4779-827b-150412c94703 ro elevator=noop

Make the changes take effect.

sudo update-grub

SAVING WRITES WITH TMPFS

sudo gedit /etc/fstab

Insert these lines into the file:

tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0

This will cause some packages to fail mysteriously when they cannot access the log directories that were installed with the packages and then disappeared at reboot. To rebuild the directory structure inside /var/log on each reboot, add these lines to /etc/rc.local above the ‘exit 0’ line:

for dir in apache apparmor apt cups dist-upgrade fsck gdm installer news samba unattended-upgrades ; do
mkdir -p /var/log/$dir
done

MOVE FIREFOX’S CACHE TO RAM

Open Firefox, type about:config in the address bar, and press Enter. In an empty space on the screen, right-click and create a new String value browser.cache.disk.parent_directory and set it to /tmp. This will have to be done for each user.