
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
sz="50K"
md="1777"
case "$dir" in
/var/tmp )
sz="500M"
md="1777"
;;
esac
mount -t tmpfs -o size=$sz,noatime,mode=$md tmpfs $dir
fi
done
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
do
if [ ! -e /var/log/$dir ]
then
mkdir /var/log/$dir
fi
done
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.
2 Responses to “Karmic Koala with Solid State Disk: How to Optimize Ubuntu for SSD”
Leave a Reply
blog by cail
- » Buy Chinese Painting
- » a page for 99life, fdu
- » 2shRNA - design oligos for RNAi
- » Feed collection of leading biology journals
- » How to use ImageJ to analyze images?
- » Play background music
- » About CaiLog
New in 'How-To'
- http://pubmeder.appspot.com/ open to public
- PubMed-er : ease your paper reading in browser
- Use vUSBbus to backup and emulate Sentinel and HASP dongles (HASP3/HASP4/Hasp HL USB keys) #getkey
- Install Snow Leopard on EeePC 1000HA (for Google Contact Sync with photo)
- How to setup Exchange ActiveSync account on #htc #evo 4G (should work for other #android phone with HTC Sense)
- Sprint HTC #evo running on Verizon network … and speed comparison
- HTC #evo: #root from @toastcfh, RUU stocks, OTA update and @unrevoked
Hot in 'How-To'
- analog – analog/digital – digital, VGA – DVI – HDMI - 26,386 views
- Ez-12 windsurfer antenna - 14,546 views
- How to add new ringtones to iPhone - 12,326 views
- Air Video, video stream and live convert your favorites to iPod Touch, iPhone and iPad (How to setup the server for Ubuntu and OpenSolaris) - 9,504 views
- mac osx 10.5.1 kalway on Lenovo Thinkpad T43 2668AJU - 8,399 views


[...] The experience is great with these SSD drives. Superior speed increase! However, I did find some stuttering with the old warp, even after the system wide optimization. [...]
[...] SWAP Partition, Journaling Filesystems, … on a SSD? Karmic Koala with Solid State Disk: How to Optimize Ubuntu for SSD How to optimize Ubuntu for SSD? Linux – Tips, tweaks and [...]