How to move Ubuntu Linux to a new hard drive

October 29th, 2006, 12:53

As well as upgrading to Ubuntu Edgy, I also needed to move Ubuntu Linux from its temporary home on a fairly dodgy 60Gb Maxtor to its new 80Gb Western Digital home. The process was actually remarkably simple and also educated me a fair bit about performing a full system-wide backup.

There’s two methods to do this.
Option One: On Linux, unlike Windows, it’s perfectly reasonable to simply make a copy of all of your files, put them on another hard drive and, as long as you install a boot manager, it’ll boot without a problem. This assumes, however, that you have a similiar partition setup on your new disk, otherwise you have to change your /etc/fstab and re-install grub specifically stating which partition you wish to boot from, etc. I didn’t want the hassle and the potential of other things going wrong. This first method (of copying the files), is obviously a good backup method. If you have your files backed up, then you can recreate the partitions, or re-install linux and then copy your files back. To do any copying back, you’d have to boot from another version of Linux, like a Knoppix CD, or the Ubuntu Live CD.

Option Two: This method copies the partitions from hard drive to hard drive. For this, you can use gparted, which lets you create, move, copy and resize partiions very easily. It took about an hour for it to copy the partitions onto the larger hard disk, and expand my root partition to fill the remaining space and I used a Gparted Live CD to work on the disks without having them mounted. The only thing you have to watch out for is the order in which you copy the partitions. No doubt the partitions will be named, so copy them in the order they’re named. If your swap space is in an extended partition, then you’ll have to create that extended partition manually.

All I had to do then was remove the old disk and ensure the new disk occupies the same channel that the old disk used and voila..! Because you’ve copied the partitions, you also copied Grub and so there’s nothing else to install. The new hard drive is a complete copy of the old one, but expanded to fill the space.

Leave a response

Your response:

Categories