Feb 222011
 
  • Use the mount option relatime (or noatime if you are brave) for the SSD partitions in /etc/fstab.
  • Replace several directories (those, the system writes to frequently) with a tmpfs file system as shown below.
  • Disable Firefox caching by setting browser.cache.disk.enable to false in about:config.
    Alternatively create the entry browser.cache.disk.parent_directory and set it to /tmp.
  • Tell grub2 to boot the kernel without optimisation for regular HDDs by adding elevator=noop to the GRUB_CMDLINE_LINUX_DEFAULT= parameter in /etc/default/grub. Afterwards run sudo update-grub2.
    If you want to use the elevator deadline (not noop) you may enable the fifo_batch for sda: echo 1 > /sys/block/sda/queue/iosched/fifo_batch
  • Try write-back caching instead of write-through by running hdparm -W1 /dev/sda. If this succeeds add it to /etc/rc.local.
  • Disable hibernation (writes large amounts of data to the SSD): See above.

Append this to /etc/fstab in order to replace /tmp, /var/tmp and /var/log with ramdisk folders:

1
2
3
4
# mount /tmp to ram (tmpfs)  
tmpfs   /tmp   tmpfs   nodev,nosuid,noexec,relatime,mode=1777,size=15%    0    0
tmpfs    /var/tmp    tmpfs    defaults,size=5%    0  0
tmpfs    /var/log    tmpfs    defaults,size=5%    0  0

But you also need to recreate some folders (in order for some programs to be happy). So add the following script in your /etc/rc.local just above exit 0:

1
2
3
4
5
6
7
#!/bin/sh
# you may want to add more folders to be checked/created to this list:
for dir in apparmor apt ConsoleKit cups dist-upgrade fsck gdm installer news ntpstats samba speech-dispatcher unattended-upgrades; do
  if [ ! -e /var/log/$dir ] ; then
    mkdir /var/log/$dir
  fi
done

To disable hibernation completely, tell Policy Kit hibernation is forbidden for all users:

1
2
3
4
5
6
7
8
cat << EOF | sudo tee /etc/polkit-1/localauthority/50-local.d/02-disable-hibernation.pkla
  [Disable hibernate/suspend for all groups]
  Identity=unix-group:*
  Action=org.freedesktop.upower.hibernate
  ResultActive=no
  ResultInactive=no
  ResultAny=no
EOF

resources

VN:F [1.9.17_1161]
Rating: 10.0/10 (1 vote cast)
SSD optimizations on Linux, 10.0 out of 10 based on 1 rating

Related Posts:

  2 Responses to “SSD optimizations on Linux”

  1. [...] the installation you might follow my guide for SSD optimizations on Linux that I wrote after I optimized my the ASUS eeePC [...]

  2. [...] file systems need to go on the HDD to minimize the number of writes to the SSD? Tips on blogs such as this one suggest putting /tmp/ and /var/tmp/ in a ramdisk but I will be burning a lot of DVDs so that isn't [...]

 Leave a Reply

(required)

(required)


8 + = sixteen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>