written by cail • posted in How-To • 13,244 views 3 comments


SSD is getting common. I have two SSD disks: 64GB SSD PATRIOT, 30G OCZ Vertex Series SATA II OCZSSD2-1VTX30G. One for Ubuntu (x61s), the other for Windows XP (eeepc). It is time to write down what I did for the optimization.

My Ubuntu notebook is loaded with Karmic 9.10, using ext4 file system.

Notes about this page were taken for the web: (via aspireonezg5, loxal, kubuntuforums, wiki.debian.org.hk)

Edit /etc/fstab, add the following

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
none /var/tmp aufs noatime,br:/tmp=rw:/var/tmp=ro 0 0
none /var/log aufs noatime,br:/tmp=rw:/var/log=ro 0 0
none /var/cache aufs noatime,br:/tmp=rw:/var/cache=ro 0 0

* Add either "elevator=noop" or "elevator=deadline" to the line that starts "GRUB_CMDLINE_LINUX_DEFAULT" of /etc/default/grub, then run "sudo update-grub2". It can also be done by edit /etc/rc.local file as mentioned below.

GRUB_CMDLINE_LINUX_DEFAULT="elevator=noop quiet splash"

* If NOT edit grub as mentioned above, edit /etc/rc.local file

# Set sda to use deadline scheduler
# Note: if these changes don't seem to take, try pasting them into a root console
#       (or with sudo) manually once then reboot
echo deadline > /sys/block/sda/queue/scheduler
echo 1 > /sys/block/sda/queue/iosched/fifo_batch

Tell Firefox to cache data in /tmp: open Firefox and type "about:config" in the browser window; click "I'll be careful, I promise!" and then create (or edit) the key browser.cache.disk.parent_directory and give it the value "/tmp". Use "about:cache" to verify.

Tweak /etc/sysctl.conf file

# I added to reduce disk activity to 240 seconds
vm.dirty_ratio = 40
vm.dirty_background_ratio = 1
vm.dirty_writeback_centisecs = 24000
# I added to reduce the use of swap space
vm.swappiness = 0

Modify /etc/rc.local file, before "exit 0"

# mount ramdrives to /var/tmp
for dir in "/var/tmp" ; do
	test=`mount | grep " on $dir "`
	if [ "$test" = "" ]; then
		case "$dir" in
			/var/tmp )
		mount -t tmpfs -o size=$sz,noatime,mode=$md tmpfs $dir

Tune /etc/fstab for ext4 file system performance

UUID=xx / ext4 noatime,barrier=0,nobh,commit=100,nouser_xattr 0 1
UUID=xx /home ext4 noatime,barrier=0,data=writeback,nobh,commit=100,nouser_xattr 0 2

If you don't have a battery-backed storage environment, you should not deactivate this mount option.

(I actually didn't apply any of them)

Modify /etc/fstab file

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

Modify /etc/rc.local file

for dir in apparmor apt news cups dist-upgrade fsck gdm installer samba unattended-upgrades
    if [ ! -e /var/log/$dir ]
            mkdir /var/log/$dir

via hwarf

Edit /etc/fstab file for tmpfs and noatime/nodiratime modification

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

/dev/sda2     /     ext4   defaults,noatime,nodiratime     0 0

Edit the /etc/grub.conf file. Add "elevator=noop" to the kernel line.

The following to /etc/rc.local file

# Economize the SSD
sysctl -w vm.swappiness=1               # Strongly discourage swapping
sysctl -w vm.vfs_cache_pressure=50      # Don't shrink the inode cache aggressively

# As in the rc.last.ctrl of Linpus
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate

echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo 20 > /proc/sys/vm/dirty_ratio
echo 10 > /proc/sys/vm/dirty_background_ratio

echo 1 > /sys/devices/system/cpu/sched_smt_power_savings
echo 10 > /sys/module/snd_hda_intel/parameters/power_save
echo 5 > /proc/sys/vm/laptop_mode

<a href="http://twitter.com/#search?q=%23Decrease" target="_blank" class="litwitter">#Decrease</a> power usage of USB while idle
[ -w /sys/bus/usb/devices/1-5/power/level ] && echo auto > /sys/bus/usb/devices/1-5/power/level
[ -w /sys/bus/usb/devices/5-5/power/level ] && echo auto > /sys/bus/usb/devices/5-5/power/level

/sbin/setpci -d 197b:2381 AE=47
/sbin/modprobe pciehp
/sbin/modprobe sdhci

by the way, this page at ocztechnologyforum is worthy checking.


Leave a Reply

You must be logged in to post a comment.