I had some hard-drive free space constraints and bought a new 500GB one. Now I wanted to transfer/migrate my current installation to the new hard-drive. Here’s how to do it.
First we need to copy the complete filesystem to the new drive. Connect both the drives to your computer and boot using ubuntu live cd. We need to boot using live cd because we can’t copy the filesystem while booted into it.
Mount both the partitions, that is – your older root partition and the newer root partition (I assume you have already partitioned your drive).
sudo mkdir /media/old
sudo mkdir /media/new
sudo mount /dev/sda7 /media/old
sudo mount /dev/sdb7 /media/new
Now copy using rsync.
rsync -ax /media/old /media/new
This will take much time as it will copy all the data to your new drive/partition.
After this, you’ll still have to setup your MBR (master boot record). For that you’ll need to install Grub on your new drive. Click here to find about how to setup grub.