transfer ubuntu system from old harddrive to new harddrive

Asked by naufal on 2007-10-15

I've installed Ubuntu Feisty in my 40GB hard drive.I've purchased 80GB hard drive.
How to transfer Ubuntu system from old hard drive to new one?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
2007-10-15
Last reply:
2007-10-20

Mentioned guide is ok, however I personally used different technic.

I boot in single user mode (press ESC on GRUB very first message and select ant kernel with 'Recovery' on it), then figure out where new drive is:
$ sudo fdisk -l
Disk /dev/sda: 160.0 GB, 160041885696 bytes
[...]

so, target is /dev/sda and after that I make partion on new drive:
$ sudo cfdisk /dev/sda
interface is very simple, so, you won't get lost, just two things to remember: Linux id partition is 83 and Linux swap id partition is 82.

When I got new drive partitioned, then is time to make filesystem on it:
$ sudo mke2fs -j /dev/sda1
-j is for ext3 fs, useful to not omit.

Do not forget about swap!
$ sudo mkswap /dev/sda2

So, now is time to mount new drive and copy old drive to new one:
$ cd /
$ sudo mount /dev/sda1 /mnt
$ sudo find . -xdev | cpio -padm /mnt
$ sudo cp -a /dev/* /mnt/dev/

Then we need to create /proc on new drive:
$ cd /
$ sudo chroot /mnt
$ sudo mount -t proc none /proc

And now it is ready, but not yet -- we have no boot on new drive :-)
$ sudo grub
in menu type
> root (hd1,0)
> setup (hd0)
...
> quit
Now new drive is ready.

Be aware that GRUB in Ubuntu (Feisty/Gutsy) uses UUID instead LABEL, so, for new harddrive it is necessary to update UUIDs in:
/etc/fstab
/boot/grub/menu.lst

UUID can be obtained by:
$ sudo tune2fs -l /dev/sda1 | grep UUID

Can you help with this problem?

Provide an answer of your own, or ask naufal for more information if necessary.

To post a message you must log in.