07/01/2010

UPDATE4: Kubuntu/Ubuntu: OCZ SSD, swap, memory, 64 bit, or how to pimp your life with a Panasonic CF-R8...

Here is some overview on how to get a new Panasonic CF-R8 to work with Ubuntu and an OCZ-Vertex SSD...

First, you need to open up your laptop in order to change the drive. I will come back on this pictures in another article later...

Then, you need to make sure that the OCZ partitions are aligned properly (that is before you install the Ubuntu/Kubuntu). Before you start, make sure that you have backed up all the partition (i.e., use rsync -ax / /mnt/USB) and  then, in a console/shell with fdisk:
fdisk -H 32 -S 32 /dev/sda

And of course, the creation of the partition (use :
Command (m for help): o
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15711, default 1): 2
Be sure to start from cylinder 2 (to have it aligned) as discussed also in some forums.

Another good tip is to create the filesystem with the extended options for the RAID strip of 64k. Here is the command for it (assuming that you have the sda1 as the partiotion):
mkfs.ext4 -E stripe-width=128 /dev/sda1

Since the SSD is fast enough, you can also tweak the /etc/fstab for better through output and make the logs go to memory (volatile):
/dev/sda1       /               ext4 noload,noatime,nodiratime,data=writeback,nobh,commit=100,barrier=0 0       1
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
Though, make sure that every now and then, you rebuild the cache...

Other optimizations for boot time can be committed via /etc/default/grub (to run update-grub after) to speed up also the kernel loading, with some nice tweaks:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash=silent resume=/dev/sda2 fastboot elevator=deadline raid=noautodetect rootflags=noload,data=writeback,nobh,commit=100,barrier=0"
You will need to update the grub via update-grub command...

Add swappiness to fix some default behavior, and switch back now from noop to deadline that is more cpu/write friendly-with fifo_batch option for io scheduller:
cat << EOF| sudo tee -a /etc/sysctl.conf
# Peter added swapiness...
vm.swappiness = 0
vm.laptop_mode = 5
vm.dirty_writeback_centisecs = 1500
vm.vfs_cache_pressure = 50
EOF

And last, we need some optimizations after booting:
cat << EOF| sudo tee /etc/init/ssd-optimizations.conf
# ssd-optimizations - Set the parameters

description     "Set required ssd parameters"

start on starting dm

script
#       echo deadline > /sys/block/sda/queue/scheduler
        echo 1 > /sys/block/sda/queue/iosched/fifo_batch
        echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
end script
EOF

Well, believe it or not, but with these settings, I got X starting at sec. 2, so, it is pretty fast (no initrd!)...

Some good links:
  1. OCZ Firmware update
  2. Ted Tso guide to partitioning...
  3. http://www.ocztechnologyforum.com/forum/showthread.php?t=54379&page=17
  4. http://www.ocztechnologyforum.com/forum/showpost.php?p=373226&postcount=98
  5. http://ata.wiki.kernel.org/index.php/ATA_Secure_Erase