Gentoo Archives: gentoo-user

From: Nikos Chantziaras <realnc@×××××.de>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: How can I move system to new disk?
Date: Sat, 16 Jan 2010 13:22:52
Message-Id: hisego$1ju$1@ger.gmane.org
In Reply to: [gentoo-user] How can I move system to new disk? by Jarry
1 On 01/15/2010 07:33 PM, Jarry wrote:
2 > Hi, I'm facing this problem:
3 >
4 > I want to exchange hard-drive in my computer for other, bigger
5 > one. I do not want to add new hard-drive somewhere on mount-point
6 > permanently, I just want to copy everything from the old drive
7 > to the new one and then get rid of the old one. And of course,
8 > I'd like to use my computer as before. What is the best (maybe
9 > I should ask for safest) way to acomplish this?
10 >
11 > First I thought about "cp -a". But I'm not sure which directories
12 > I should skip (/proc, maybe some other like /dev?). And I do not
13 > know how cp handles links (if I first copy link and later target,
14 > where is the link pointing? to the original file or its copy?).
15 >
16 > Maybe dump/restore is better solution? Or something else?
17
18 I'll just copy the instructions I have someone else here:
19
20 You can clone the existing Gentoo installation into the new partition
21 and boot from it. You can do this while the system is actually running.
22 The new partition can be anything you want (different size, different
23 file system). This usually means:
24
25
26 rsync your existing / to your target / (except /dev, /sys and /proc and
27 of course mount points that belong to a different filesystem, /boot or
28 /home for example if you're using dedicated partitions for those). If
29 you mounted your target / as /root/newpart, this is done with:
30
31 rsync -ax / /root/newpart
32
33 If this copied directories it shouldn't have (like /sys or /proc),
34 simply delete them again.
35
36 Then:
37
38 mkdir /root/newpart/dev
39 mkdir /root/newpart/proc
40 mkdir /root/newpart/sys
41 mknod /root/newpart/dev/console c 5 1
42 mknod /root/newpart/null c 1 3
43 touch /root/newpart/dev/.keep
44 touch /root/newpart/proc/.keep
45 touch /root/newpart/sys/.keep
46
47 Now chroot into it to set up the boot loader (I assume you use Grub):
48
49 mount -t proc none /root/newpart/proc
50 mount -o bind /dev /root/newpart/dev
51 chroot /root/newpart /bin/bash
52
53 Now edit /etc/fstab to use the new partition and edit
54 /boot/grub/grub.conf and reinstall grub:
55
56
57 grub
58 root (hd0,0) <-- sustitute with what you really have/want
59 setup
60 quit
61
62 You're ready. Leave the chroot and unmount:
63
64 exit
65 umount /root/newpart/dev
66 umount /root/newpart/proc
67
68 If you've set up grub correctly while in the chroot, you can now reboot
69 and the system should come up using the new partition. If you used a
70 different filesystem for the new partition (for example going from ext3
71 to ext4), make sure your kernel supports the new filesystem.

Replies

Subject Author
Re: [gentoo-user] Re: How can I move system to new disk? YoYo siska <yoyo@××××××.sk>