round image on layout top

Tweaking SSD Performance in Linux Netbooks

June 18, 2010 by admin divider image

Here are some tips submitted by a guest author/Linux guru on how to tweak your netbook’s SSD when running Ubuntu. Disclaimer: Use carefully! This website takes no responsibility if you mess up you Linux installation. Always create a full backup before attempting to modify system-critical files.

Disable file access time updates to reduce writes

When a file is accessed, many file systems update the “last accessed time”. This update generates additional I/O for all file reads, and has little benefit. So, it’s probably a good idea to disable these updates. To disable file access time updates, you’ll need to edit the “/etc/fstab” file, which tells the system what file systems to use and how to use them. Since screwing up “fstab” can seriously mess up your system, I recommend backing the file up, and having a boot able Linux USB drive waiting will make it easier to fix the worse screw-ups.

To edit “fstab”, you’ll need to launch a text editor with root privileges. One easy way to do that is to open a run dialog via Alt+F2, then execute “gksudo gedit /etc/fstab”. Enter your password when prompted. You’ll see a text file with several lines, each with several white space separated fields. The first line describes the format of each line. The first line starts with a “#” to indicate that it’s a comment.

Each non-comment line describes a file system. The default Dell Ubuntu install, for example, only uses a single partition. The line describing that single partition has a second field (mount point) of “/”. The fourth field is a comma-separated list of mount options. Add “noatime” to the list of mount options.

Code:

/dev/sda2 / ext3 defaults,noatime 0 0
proc /proc proc defaults 0 0

(The amount of white space between fields doesn’t matter.)

Reboot or run “sudo mount -o remount /” in a terminal to see the results of your change.

Move temporary files to a RAM disk to avoid unnecessary SSD I/O.

Create a RAM disk and set it to be mounted at “/tmp” by adding the following line to “/etc/fstab”.

Code:

tmpfs /tmp tmpfs mode=1777

When you reboot, a dynamically-sized RAM disk will be created with a maximum size of 1/2 your total RAM amount. It will be mounted at “/tmp”.

Some programs, like Firefox, will still need a setting changed to use the RAM disk as temporary file storage. In Firefox, enter “about:config” in the address bar, and add the preference “browser.cache.disk.parent_directory” with the value “/tmp”. Or disable Firefox’s disk cache entirely, and only rely on its own memory cache. Be aware that files under “/tmp” will be completely lost on reboot, power down, or power loss.

Change the I/O scheduler to one more suited for a SSD’s quick seeks

The I/O scheduler manages I/O requests. The default I/O scheduler in Linux is CFQ, the Completely Fair Scheduler. However, it’s designed to maximize performance on conventional hard drives, not solid state drives.
Based on what I’ve read, the dumb “noop” scheduler or the “deadline” scheduler may offer improved performance on SSDs.
Add the following line to “/etc/rc.local” before “exit 0″ to enable the “noop” scheduler on the internal SSD.
Code:

echo noop > /sys/block/sda/queue/scheduler

Add the following lines instead to use the “deadline” scheduler.

Code:

echo deadline > /sys/block/sda/queue/scheduler
echo 1 > /sys/block/sda/queue/iosched/fifo_batch

Adjusting the “fifo_batch” value for the “deadline” scheduler is another tweak which I’ve read about. A higher value should reduce seeks, but also increase latency. SSDs don’t need to worry about excessive seeks, so we can set the value low. I’m using the “deadline” scheduler myself. Because when I had the “noop” scheduler enabled on an SD card with my music, a large file copy was able to interrupt my music playback for several seconds.

Unfortunately, my technique sets the I/O scheduler late in the boot process. So, booting will still use the default CFQ scheduler. You can override the default by setting options in GRUB’s config file, but overall I prefer my solution.

No related posts.


Share this post



bottom round image

footer blue big nice

footertop right
© 2010 Mini Laptop Zone | All Trademarks Acknowledged