- With the machine off plug your target hard drive into a second channel on your computer.
- Boot the machine, when you see the grub start menu hit ESC
- Choose "Recovery Mode"
- When it prompts, enter your root password
- If you have IDE hard drives your drives will be /dev/hda for the source drive and /dev/hdb for the target. If they are SATA then they will be /dev/sda and /dev/sdb
- Type fdisk /dev/sda
- Type "p" to print a list of the partitions. Write these down, trust me it will make things easier in the future.
- quit out of fdisk with a CTRL+C
- Start FDISK again with /dev/sdb
- Press "n" to start a new patition segment
- Fill in the parameters you wrote down
- Try to duplicate the partition tables the best you can, here's the time to make the partition layout larger if you wish.
- Once you are done, type "w" to write the partition info to the disk
- Now you can copy the data over to the target disk
- mkdir /new in the root of the source disk
- mount /dev/sdb1 /new
- I have var on a separate partition on my system so I'm going to exclude it for this step and handle it later. However we still need to create a var mount point in what will be /
- mkdir /new/var
- mkdir /new/var/run
- mkdir /new/var/lock
- Now we do the copy:
- cd into /
tar --exclude var --exclude new -cvf - . | (cd /new; tar xf -)
- You will get error messages saying that the size has changed during copying, this is normal.
- Once it's done copying, we will do the same for the var partition.
- umount /new
- mount /dev/sdb3 /new
- cd into /var
tar -cvf - . | (cd /new; tar xf -)
- That copy should be pretty quick, we are done with the copy process.
- umount /new
- poweroff the system
- Next we need to reinstall grub on the new hard drive
- Remove the source disk from the system
- Power on the system, insert the ubuntu 6.06 installation CD and boot from it
- Select the "Rescue a broken system" option.
- This will look like it's installing the system again, just select all the appropriate options, enough to get you to the recovery screen.
- At one point it will ask which partition you want to be your root file system, 99% of the time this is part1, select it.
- It will then ask you what you want to do, select "re-install grub boot loader"
- It will give big long thing to read asking you where do you want to install the boot loader; we want it on /dev/sda, so we type that in and hit enter.
- It should install the boot loader, reboot the system and take the installer disc out of the drive.
- Done, you should have a fully working system on a new drive.