Ubuntu 11 on Kingston SV100S2/256G SSD

Here are some notes about my attempt to install Ubuntu 11 on Kingston SV100S2/256G SSD (on Dell Latitude E6510 laptop). Just in case somebody else finds it useful.

I have Googled around for information about SSD disk optimization for Linux and found that there are two main things to consider: partition alignment and filesystem options.

It appears to be important to (try to) align disk writes by the boundaries of SDD erase block size. This [1] article talks about LVM volumes alignment.

Most tutorials out there seems to blindly assume SSD erase block size is 128KB, unclear on what ground. This post [3] suggest the kind of disk I have features 1MB erase block size. I decided to take use this value.

Finally, I have ended up with the following partition layout, with alignment by 1MB:

$ sudo fdisk -S 64 -H 32 /dev/sdb
...
Command (m for help): p

Disk /dev/sdb: 256.1 GB, 256060514304 bytes
32 heads, 63 sectors/track, 248074 cylinders
Units = cylinders of 2016 * 512 = 1032192 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xfeb3c9c1

Device Boot Start End Blocks Id System
/dev/sdb1 1 103 103792+ 83 Linux
/dev/sdb2 104 248074 249954768 8e Linux LVM

Creating LVM physical volume, with its meta-data size set to align start offset of its extents to with 1MB boundary.

$ sudo pvcreate --metadatasize 994k /dev/sdb2
Physical volume "/dev/sdb2" successfully created
$ sudo pvs /dev/sdb2 -o+pe_start
PV VG Fmt Attr PSize PFree 1st PE
/dev/sdb2 lvm2 -- 238.38g 238.38g 1.00m

Create physical volume group and logical volume.

$ sudo vgcreate e6510-ssd1 /dev/sdb2
Volume group "e6510-ssd1" successfully created
$ sudo lvcreate --size 32G --name root e6510-ssd1
Logical volume "root" created

Finally, create a file system, with stripe width set to 1MB (256 x 4K blocks). "Resize" parameter limits the maximum size your filesystem can grow live, it is optional parameter, just saves a few megabytes.

$ sudo mke2fs -t ext4 -E stripe-width=256,resize=250G /dev/e6510-ssd1/root

To make use the instructions above, you will need to use alternative installer CD which lets you interfere with partitioning/filesystem creation process.

References:
[1] http://thunk.org/tytso/blog/2009/02/20/aligning-filesystems-to-an-ssds-e... (also available at http://web.archive.org/web/20101130200444/http://thunk.org/tytso/blog/20...)
[2] http://williamscott.me/blog/2010/12/ssd-tweaks-linux-align-partitions/
[3] http://forum.notebookreview.com/notebook-news-reviews/395398-kingston-ss...

Comments

To activate TRIM, 'discard' filesystem option has to be set. I've just realized I've forgot to activate it on LVM volumes I've created after the initial setup, so I only had it on my root filesystem :(.

Now I have the following options in my fstab for all filesystems residing on SSD:

discard,noatime,nodiratime

The next step is to figure out whether I need to secure-erase my whole SSD to take advantage of TRIM on my disk J. Looks like I need to go through https://wiki.archlinux.org/index.php/SSD_Memory_Cell_Clearing, ughhh.

Here is a useful post related to TRIM: http://www.ocztechnologyforum.com/forum/showthread.php?82648-software-RA.... It focuses of RAID, but contains info relevant to SSD in Linux in general.

Another very useful webpage is https://wiki.archlinux.org/index.php/Solid_State_Drives . It contains hints about optimising encrypted volumes and MacOS-related issues, and a bunch of other useful stuff.