euglug.org

[Eug-lug] Gentoo system – moving drives

작성자

카테고리:



Bob MillerSat Jul 10 08:15:54 PDT 2004

Cory Petkovsek wrote:

> On Fri, Jul 09, 2004 at 06:52:34PM -0700, Rob Hudson wrote:
> > I've got a Gentoo system set up and want to move it to another drive.
> > Can I do an install -- up to stage 2, say, -- then tar the contents of
> > the old drive to the new drive?

*IF* the binaries are compatible with the target CPU, then it should
work.  (E.g., you didn't build everything with -march=athlon-xp and
try to move to a Pentium III).

Mount the partitions in the relative partitions you want them in.  For
example, let's assume (unrealistically) that you want the target
system to have /boot and /var on separate fses and everything else on
/.  The original system has /home and /usr separate and everything
else on /.  Let's also assume you're using devfs.

	# mkdir /new
	# mkfs -j /dev/hdc{1,5,6}
	# mount /dev/hdc5 /new
	# cd /new
	# mkdir -m 755 boot var proc dev sys # others?
	# mount /dev/hdc1 boot
	# mount /dev/hdc6 var
	# (cd /; tar cfl - .) | tar xfp -    # Note the "l" flag!
	# (cd /home; tar cfl - .) | tar xfp -
	# (cd /usr; tar cfl - .) | tar xfp -
	# cd /
	# umount /new/boot /new/var /new
	# rmdir /new

Edit /new/etc/fstab, /new/etc/modules.d/*, /new/etc/hostname, and
probably a few others.

Recable the drives so the new disk is primary master.  Boot from a
Linux CD (any Linux CD - KNOPPIX, Gentoo or RedHat rescue) and repeat
the grub commands in the Gentoo installation manual.

That should get you 90% of the way there.

-- 
Bob Miller                              K<bob>
kbobsoft software consulting
http://kbobsoft.com                     kbob at jogger-egg.com