Introduction

Using a solid state drive (SSD) can speed up your system by about 200%.
The reason is that a SSD has a reading speed that is higher than a hard disk and it has a average access time of only 0.2ms.

The physical medium used in an SSD can only be written a limited number of times, but modern/decent drives do wear levelling so this is not a concern.

This page describes how to migrate from an hard disk to a SSD. Note that this page describes one way of doing so - there are other ways to do this.

Preparation

To copy your running hard disk installation to the SSD, you must do it when it is unmounted (this means, inaccessible to the user and the operating system).

You will have to download, burn to a CD, DVD or USB drive then boot a "Live" version of some GNU/Linux distribution such as Debian, although any distribution should work, to do the steps described here.

WARNING: be very careful when doing this, and note that the partition and drive names will almost always differ from this page!

Most of the write processes will be done in the /home directory by several applications.
The rest of the permanent write operations will be done by the system in the /var directory.

This example hard disk installation of Debian is on /dev/sda1 - it is mounted now under /media/sda1.
The SSD is on /dev/sdb1 - it is mounted now under /media/sdb1.
This installation's /srv directory is in a separate partition - it is mounted now under /media/sda7.

One would want to permanently mount the SSD under /ssd in that example hard disk installation. One would add this to their /etc/fstab:

 # /dev/sdb1 SSD
 UUID=5c902625-e63e-446f-a5c5-c24a1176dec7 /ssd          ext4    defaults        0       2

One can get the UUID's with the command blkid as root.

 /dev/sdb1: LABEL="SSD" UUID="5c902625-e63e-446f-a5c5-c24a1176dec7" TYPE="ext4"

Now, one would copy the /home and /var directory on the harddisk to the SSD.
One would these 2 directories to the path /srv/ssd.

 mkdir /media/sda7/ssd
 cd /media/sda1
 cp -pvr home /media/sda7/ssd/.
 cp -pvr var /media/sda7/ssd/.

Backup

It is generally a good idea to make a backup of the hard disk partition and use this backup on the SSD disk.

 cd /media/sda1
 mkdir /media/sda7/Backup
 tar cvfz /media/sda7/Backup/Backup_Debian_sda1_120907.tgz *

Installation

Unpack the backup now to the SSD:

 cd media/sdb1
 tar xvf /media/sda7/Backup/Backup_Debian_sda1_120907.tgz

Alternative to the backup you can copy the installation direct to the SSD:

 cd /media/sda1
 cp -axv . /media/sdb1/.

Now we can delete the /home and /var on the SSD and replace it with links:
(Be careful to be on the right SSD-path!)

 cd media/sdb1
 rm -rf home
 ln -s /srv/ssd/home home
 rm -rf var
 ln -s /srv/ssd/var var

Configuration

The final configuration is to adapt the config files to the SSD drive.

One must edit the /media/sdb1/etc/fstab and alter the mountpoint of the root path:

 UUID=5c902625-e63e-446f-a5c5-c24a1176dec7    /    ext4    errors=remount-ro    0       1

This was the main stuff for the migration.

Now you must look to boot from your SSD drive.
It is possible to boot grub from your harddisk or from the SSD.

Now you should boot your normal Debian installation again.
Run grub-update as root to get the SSD in your boot list.

At this time there is a bug in the grub-generator, so you should fix the wrong UUID.
I opened a bug for it with a description of the error: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686754

It is a good idea to update the initrd.img as root now.

 update-initramfs -t -u

With the correct /boot/grub/grub.cfg you can boot from your harddisk the SSD now.

When you want to boot from the SSD, you can alter it with this steps in the running harddisk installation:

Copy the /boot/grub/grub.cfg to the SSD as root:

 cp /boot/grub/grub.cfg /ssd/boot/grub/grub.cfg

Now you must install the grub on the SSD via chroot:

 mount --bind /dev /ssd/dev
 mount --bind /proc /ssd/proc
 chroot /ssd
 grub-install /dev/sdb

Normally you have to change the settings in your BIOS to boot from the SSD.
You should be able to boot the SSD now.
After you have booted, don't forget to update the initrd.img on the SSD either.

Benchmarks

You can get an idea of the performance increase trying these benchmarks:

 root@PC# echo 3 > /proc/sys/vm/drop_caches
 
 root@PC# hdparm -Tt /dev/sda
 
    /dev/sda:
    Timing cached reads:   7216 MB in  2.00 seconds = 3609.64 MB/sec
    Timing buffered disk reads: 292 MB in  3.01 seconds =  96.91      MB/sec
 
 root@PC# hdparm -Tt /dev/sdb
 
    /dev/sdb:
    Timing cached reads:   7138 MB in  2.00 seconds = 3570.42 MB/sec
    Timing buffered disk reads: 464 MB in  3.00 seconds = 154.51      MB/sec

The reads from the disks may not reflect the reality, because you read from the cache of the disks.

You should have a close look to the read-speeds of the SSD disks, because the speed is dependent on the disk size.

 8GB     | 16GB    | 32GB    | 64GB    | 128GB   | 256GB
 128MB/S | 117MB/S | 145MB/S | 153MB/S | 158MB/S | 160MB/S

This was measaured using Debian Wheezy with KDE.
First the time booting from hitting Enter in GRUB up to the point the Login appear.
Then the time hitting Enter for the password up to the last sound starting KDE.

 Boot      Start OS   Total       Condition
 26.2       30.2          56,4       Booting from harddisk
 26.7       33.3          60          Booting from harddisk with symbolic links for /home and /var
 15.1       16,9          32          Booting from SSD

Links

See also

Author of this page: Karsten