Some optimization tips

The following tips are collected over the last couple of months using an Acer One ZG5 netbook with a 8GB SSD disk. They are usefull on this netbook, but maybe other users/netbooks will also find something usefull here. All tips are meant to let the SSD disk perform better, in other words: to write as least as possible. Read speed is high enough.

(Special thanks to the original writer of these SSD tips )

1. Ext2 versus ext4

Filesystem during installation: Use Ext2 for a non-journalling system

Ext4 is new fileformat for linux. It is a journalling system however, which makes a system much slower on a SSD disk. In theory you can turn journalling off (run from Live USB/CD):

sudo tune2fs -o journal_data_writeback /dev/sda1

(See External Link)

At the same time, there is some discussion whether user should turn journalling off or not: See discussion of kernel.org mailing list, and Arch people's discussion

People who have large enough SSD don't have to worry too much about wear and tear on their SSD. But it's also important to reduce wear and tear. So using RAM and moving the browser's cache to RAM may make difference.

If you have a newer SSD which can use TRIM feature, you should use ext4. Learning how to use TRIM, see below link (We will write essential of this later on this article).

See Ext4 Howto

2. Change the file system mount options on SSDs to "noatime"

Edit /etc/fstab (gksudo leafpad /etc/fstab) and change the the option “relatime” to “noatime”. The line for the root partition should then be something like:

UUID=f0ae2c59-83d2-42e7-81c4-2e870b6b255d / ext2 noatime,errors=remount-ro 0 1

If your SSD supports TRIM and you want to use this feature, also put “discard” option (ext4 format is neccessary). The line would then look like this:

UUID=f0ae2c59-83d2-42e7-81c4-2e870b6b255d / ext4 discard,noatime,errors=remount-ro 0 1

(see 3.)

3. Reduce SSD disk IO use tmpfs

To reduce the disk IO use tmpfs for directories /tmp /var/tmp and /var/logs

Add the following lines to /etc/fstab: (Terminal: gksudo leafpad /etc/fstab)

tmpfs    /var/log    tmpfs    defaults    0 0
tmpfs    /tmp        tmpfs    defaults    0 0
tmpfs    /var/tmp    tmpfs    defaults    0 0

Because the installed applications can complain about missing log-directories you can add the var/log directories as follows:

(original post by sneeze_k on Bodhi forums)

(Terminal: gksudo leafpad /etc/rc.local)

for dir in apparmor apt cups dist-upgrade ConsoleKit fsck gdm installer samba unattended-upgrades ;
do
if [ ! -e /var/log/$dir ] ; then
mkdir /var/log/$dir
fi
done

Put these codes before exit 0 line. You may want to edit for ~ line depending what application you installed.

4. Use the "noop" I/O scheduler

An elevator is a mechanism built into the kernel which, when engaged, orders disk I/O so that to minimize HDD head seek runs. In case of an SSD drive, though, it barely makes sense. So, we turn it off. Note: It seems Karmic will include 'elevator=noop' option by default if a machine has SSD disk. If it isn't the case then follow the below instructions. To see what is the current scheduler use the following command in Terminal:

cat /sys/block/sda/queue/scheduler

GRUB2

Edit /etc/default/grub using your favorite editor, and add “elevator=noop” to the list of GRUB_CMDLINE_LINUX_DEFAULT values. The corresponding line will then look like:

GRUB_CMDLINE_LINUX_DEFAULT="elevator=noop quiet splash"

Then rebuild GRUB2 configuration files:

$ sudo update-grub

5. Reduce wear and tear on SSD

Use swap space as least as possible:

a. Edit /etc/sysctl.conf Add the following lines, at the bottom of the document:

    
#
# Verminder de swapneiging ten zeerste
vm.swappiness=0
# Krimp de inode cache niet agressief in
vm.vfs_cache_pressure=50
vm.dirty_writeback_centisecs=1500
vm.laptop_mode=5
 

b. Save and close file

6. Concurrency

Obsolete since version 0.1.7 of Bodhi. CONCURRENCY=shell is now default. Chapter for reference only.

The first hack only works with multi-core processors, so if you fall into that category, feel free to try this one. This hacks allows certain processes to use both processors in some situations. In a terminal, using sudo and a text editor, open the /etc/init.d/rc file.

For example:

sudo leafpad /etc/init.d/rc

Scroll down looking for the line that says

CONCURRENCY=none

and replace “none” with the word “shell” like this:

CONCURRENCY=shell

7. Moving browser cache to RAM disk

(User sneeze_k contributed the following)

Moving browser cache to RAM helps to reduce wear and tear on an SSD. It's also great for battery life. But it also needs a much larger capacity than say, log files. Probably minimum 1 GB, recommend larger than 2 GB RAM (I assume half of RAM using for RAM disk).

Side note: RAM is much much cheaper than SSD.

If you don't have more than 2 GB RAM and consider buying a new SSD, you have to consider buying more RAM first.

(Tips below are not only great for SSD but also for HDD.)

For Firefox:

Enter about:config into the address bar (and click through the warning message) Right-click anywhere in the parameter listing, selecting New → string. Assign its value:

browser.cache.disk.parent_directory

Double-click the newly created string and Assign its value:

/tmp

Restart Firefox and you would notice your “heavy” Firefox is no longer feeling like a walking giant. Enjoy!


(original SSD article by Dick aka brood)

User Feedback

running_bodhi_from_ssd_disk
Did you find this article helpful?
Yes, right on the money!
 
92%(24)
Somewhat. Needs work.
 
4%(1)
Not really
0%(0)
Not at all.
 
4%(1)

If you would like to comment or make further suggestions, please leave a note on our Comments page (you will have to Create an Account if you haven't already).

 
ssd_disk_-_run_bodhi_from.txt · Last modified: 2011/06/13 13:50 by brood · [Old revisions]


© Copyright Bodhi Linux 2012. All Rights Reserved - Hosted by vaultnetworks