How to install a new SSD in your laptop | Performance Magic

Ramblings from a Sysadmin

November 22, 2012

How to install a new SSD in your laptop

So, I have previously had a SSD in another Laptop, but I had to go back to my Dell Latitude D630, and it still had spinning rust. I decided that a good speed boost and improve battery time a good investment would be a SSD.

I managed to get an OZC Agility 4 256GB SSD for ~AU$170.

This is a little how-to replace your hard drive in your laptop.  Grab your new SSD and install it into a USB housing, and plug it in.

dmesg | tail | grep sd

Hopefully you see something like sdb. Once you have worked out which disk is the one that has just been inserted you are ready to partition it.  I use LVM for my root, home and swap, and I am a bit legacy and still have partition 1 available for grub.

fdisk /dev/sdb

Create 1 partition, type Linux, a size of 2GB and mark it as bootable.  Now create partition 2 type Linux LVM (8e), and write the changes to the disk. Create the filesystem on first partition:

mkfs -t ext4 /dev/sdb1

Now setup LVM, create the volumes, and make the filesystems.

pvcreate /dev/sdb2
vgcreate rootvg /dev/sdb2
lvcreate -n swap -L 2G rootvg; mkswap /dev/rootvg/swap
lvcreate -n root -L 10G rootvg; mkfs -t ext4 /dev/rootvg/root
lvcreate -n home -L 200G rootvg; mkfs -t ext4 /dev/rootvg/home

Now mount these new partitions and sync your data across:

mkdir /newdisk
mount /dev/rootvg/root /newdisk
mkdir /newdisk/home /newdisk/boot /newdisk/dev /newdisk/proc /newdisk/sys
mount /dev/rootvg/home; mount /dev/sdb1 /newdisk/boot
rsync -av --exclude proc --exclude dev --exclude sys --exclude newdisk / /newdisk/

Now wait until this is complete.  Once it is complete, you can go ahead and setup grub2:

mount -o bind /proc /newdisk/proc; mount -o bind /sys /newdisk/sys; mount -o bind /dev /newdisk/dev
chroot newdisk
grub-install /dev/sdb
Now edit and make any changes you need in /newdisk/etc/fdisk

Now you can shutdown your machine and install your new SSD.

© Greg Cockburn