Intel X25-M Gen2 on linux – migrating to btrfs on kernel 2.6.33

This comes with no warranty whatsoever! Don't come to me if this breaks and deletes all your data. Back it up!

Why BTRFS on the X25-M ?
I decided to write this article because it's very hard to find information about the X25-M or high performance SSDs in general. Under linux, it's nearly impossible. Information on btrfs however is more promising and they even have a nice wiki.

BTRFS is said to have stabilised since the 2.6.32 kernel and has been included since the 2.6.29 kernel. It should not change structure unless a major bug is found is stated on the wiki. You can upgrade to BTRFS from ext4. Therefore if you are more worried about your data than me, then you can use ext4 and when you deem btrfs stable enough upgrade to it.

Some people claim that anything with a journal will damage their SSD. Now this may be true of cheaper SSDs found in netbooks, and basic 2.5" drives sold cheap (you know which ones I mean) that got slower and seemed to stutter after many writes. However the Intel X25-M is said by intel to have a Minimum useful life of 5 years (or 35TB). You can write to it 20GB/day for 5 years! it has a Mean time between failures of 1.2 Million hours. People should probably have been more worried about their normal hard drives to fail than worrying about this SSD.

I'm not saying you should put a swap file on your SSD. Keep that on a normal drive or just don't have one! I like to keep a big swap file to have /tmp as tmpfs. I also keep /var/log on a conventional JFS partition on a rotational drive because it can be nice to be able to mount it under any OS and not just a recent linux kernel.

Performance has been tested on the Intel X25-E SSD under linux by here. However NILFS2 nor BTRFS where present and only default mount options where used. So barrier disabled ext4 was quite good... (disabling barriers on ext is NEVER a good idea). XFS seemed to do quite well but has no SSD mode.

Part 1 - Making your system BTRFS friendly
This will only work on Arch Linux. However have a look here for ubuntu. The rest of the guide should work on any linux distribution however.
install mkinitcpio-btrfs and btfs-progs from the AUR. Remake boot images.
Be carefull to remake the right image. I use kernel26-rc from AUR (2.6.33-rc8 at time of posting). Normal Arch kernel will be kernel26

packer -S mkinitcpio-btrfs btrfs-progs
mkinitcpio -p kernel26-rc

I'm working with a seperate /boot partition. This is probably a better idea until btrfs support gets more common.
Part2 - Moving / and /boot to the new SSD
Format your new drive as you wish. use fdisk -l to see which one is your new drive.
I always use 200MB as /boot and then left the rest for /. You may want to use a seperate /home. I decided leaving the biggest partition would mean less wear as the wear levelling alogrithms would have more room to work. Decide what your opinion is on this ;-)

Make the btrfs partition as well as /boot

mkfs.btrfs /dev/sdb2
mkfs.ext2 /dev/sdb1

I will use -o ssd but you can use -o ssd_spread if you are really worried your precious drive will die too soon!

mkdir /mnt/boot
mkdir /mnt/slash
mount -o ssd /dev/sdb2 /mnt/slash
mount /dev/sdb1 /mnt/boot

Now comes the boring long bit... Then we just create /dev/console and /dev/null
Notice we copy over /boot twice and remove it. it's not like it will take any time to copy a few MBs

find / -xdev | cpio -pm /mnt/slash
rm -rf /mnt/slash/boot
find /boot -xdev | cpio -pm /mnt/boot
mknod /mnt/slash/dev/console c 5 1
mknod /mnt/slash/dev/null c 1 3

Part 3 - Grub
Now we will install grub on the master boot record of the SSD. You don't have to, but otherwise you will be wasting a few precious seconds.
please be carefull. Make sure it's the right drive!!! hd0 should be /dev/sda, hd1 will be /dev/sdb and so on

grub> root (hd1,0)
grub> setup (hd1)

Next edit your /mnt/boot/grub/menu.lst file. Make sure that you change your boot options to the new SSD. The great thing about this is that if everything messes up you can just boot straight onto the old drive with the old files!

Part 4 - fstab
Always use UUIDs and not direct names.

blkid /dev/sdb1
blkid /dev/sdb2

then edit /mnt/slash/etc/fstab
and add the two lines for something like this:

# SSD is root and /boot
UUID=c05d5ae2-9eb9-4b6e-9e13-d99ea589933b / btrfs ssd 0 1
UUID=33a46c0e-ad6f-4526-b628-f477aa36e73e /boot ext2 defaults 0 1

The ssd option for / is actually not neccessary. BTRFS is capable of detecting wether or not you have an SSD.

cat /sys/block/sdb/queue/rotational

If this is a 0 then your SSD is correctly detected!

Part 5 - BIOS
Make sure that your sata controller is in AHCI mode. This will probably mean that if you have windows on a sata drive installed as IDE will just not boot anymore. If you don't have this one, the SSD won't have all the advanced commands available. And your SATAII drives won't have NCQ and similar working. No TRIM in IDE mode ;-)

Finished, Enjoy the speed!

Tags: , , , , ,

3 Responses to “Intel X25-M Gen2 on linux – migrating to btrfs on kernel 2.6.33”

  1. » Blog Archive » Intel X25-M Gen2 on linux – migrating … | Linux Affinity Says:

    [...] more: » Blog Archive » Intel X25-M Gen2 on linux – migrating … Posted in: Kernels ADD [...]

  2. ivan_kalmar Says:

    it was very interesting to read
    I want to quote your post in my blog. It can?
    And you et an account on Twitter?

  3. Brendan Says:

    sure you can quote my post, and my twitter account info is in the about me page.

Leave a Reply