transfer ubuntu system from old harddrive to new harddrive

Asked by naufal

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:
Last reply:
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) said :
#1
Revision history for this message
Sergei Plaxienko (sergei-plaxienko) said :
#2

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.