Optimizing Ubuntu 14.04 for SSD usage or how not to abuse

Print Friendly, PDF & Email

On revamping a netbook from the grave, in fact just the only thing working about it is the motherboard! I decided to swap out the SSD in my Dell Studio 1737 which was in the second drive bay as my Ubuntu boot up.

So on ebay I found a Kingston S200 30GB SSD drive for £30 GBP. But for some reason instead of just popping it in, preparing a USB with Ubuntu and getting on with it I decided to do a bit of reading. To my horror I discovered I’ve been guilty of ssd abuse… For quite some time.

Read all the four source pages before attempting anything.

  • Create your swap partition on a conventional hard drive
  • Consider /var/log partition on a conventional hard drive
  • Consider /tmp partition on a conventional hard drive
  • Leave 7% of your EXT4 main Ubuntu partition unallocated at the end
  • With “noatime” in /etc/fstab, you disable the write action “access tim//e stamp”

An adapted line may look like this:

UUID=cf741928-1eb0-4253-91c6-cea28105dbef           /         ext4   noatime,errors=remount-ro      0       1

The cleaning action TRIM is necessary for the good performance of your SSD in the long run. Otherwise it’ll become very slow after some time.

/etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
fstrim -v /
exit 0

  • Disable the superfluous weekly cron job for TRIM
    • sudo mv -v /etc/cron.weekly/fstrim /fstrim

Sources:
http://askubuntu.com/questions/1400/how-do-i-optimize-the-os-for-ssds
https://sites.google.com/site/easylinuxtipsproject/ssd#TOC-During-installation:-select-EXT4

Create a RAM disk to optimise Chrome and FireFox

Chrome
sudo mkdir -p /media/ramdisk
sudo vi /etc/fstab
tmpfs /media/ramdisk tmpfs rw,size=512M 0 0

double check chrome cache location:

ls -ls ~/.cache/google-chrome

rm -rf ~/.cache/google-chrome
ln -s /media/ramdisk/ ~/.cache/google-chrome

Firefox
type
about:config
in address bar create
browser.cache.disk.parent_directory
By right-clicking over the variables list
Right-click somewhere in the list and select “New > String”
For the name of the preference type or copy’n paste: browser.cache.disk.parent_directory
Enter the string value

/media/ramdisk/

Next locate the preference browser.cache.disk.enable, it must be set to true, if it is not, double-click on it to change its value
By default firefox stores cache in cacheme whereas chrome in Cache folder.

Restart firefox, you’ll find new folder in /media/ramdisk/

Note: for caching to work make sure browser.cache.disk.capacity is set to true

Sources:
http://askubuntu.com/questions/152868/how-do-i-make-a-ram-disk
http://www.linuxreaders.com/2011/01/firefox-chrome-cache-on-ram-drive-fedora-ubuntu.html

Posted in Pure Tech.

Leave a Reply

Your email address will not be published. Required fields are marked *