Moving Ubuntu to a new hard drive
Mike Bird
mgb-ubuntu at yosemite.net
Fri Dec 23 06:21:23 UTC 2005
On Thu, 2005-12-22 at 21:55, Russell Cook wrote:
> What I want to know is if there's a simple technique to move the root
> and boot partitions to the new drive? I'm, happy enough to edit the
> grub installation, but I'm not sure what's involved in maintaining
> permissions when copying etc, dev, proc, sbin and other important and
> special folders. Is there a tool or technique for this?
With the new root mounted at /newroot,you can use
"cp -vax / /newroot". Mount the new boot at /newroot/boot
and "cp -vax /boot /newroot/". You may wonder why there's
no boot on the end of that last command. You can experiment
on some small folders in /tmp if you want to figure it out.
The "-x" (or the "x" in "-vax") ensures that it only copies one
filesystem at a time.
Or a cpio pipeline is kind of traditional.
However, I personally prefer using rsync. I can use "-n" to
see what it's going to do before I let it loose:
"rsync -n -vax -H --delete / /newroot/". When it looks
like its going to do the right thing just run it again without
the "-n". Then "rsync -n -vaz -H --delete /boot/ /newroot/boot/".
You also need to get Grub or LILO working on the new drives.
There's lots of different techniques. If the system is not
three thousand miles away just boot the CD in recovery mode,
let it find your new root, chroot into it, mount your /boot
in the jail if it's not already there, then run Grub or LILO.
--Mike Bird
More information about the ubuntu-users
mailing list