How to copy a Fedora-4 system? Again!

Mogens Kjaer mk at crc.dk
Sun Apr 9 14:52:26 UTC 2006


Timothy Murphy wrote:
>>So my query is: how exactly should one copy a Fedora-4 system
>>to another partition?
> 
> 
> I asked this question a couple of days ago,
> and received quite a lot of responses.
> 
> However, I tried out all the suggestions,
> and none of them worked,
> which leads me to think that none of the "advisors"
> had actually tested their advice.
> 
> I should say that dd is not appropriate
> since the source is not all in one partition,
> as perhaps I should have made clear;
> /usr , /usr/share and /usr/local are all in separate partitions,
> although I planned to have one large / partition for the new system
> (using an old Windows partition for this purpose).
> 
> The problem, as I see it, is: which directories should one exclude?
> In particular, if I copied /dev then the system booted,
> but there were a number of errors reported during the boot,
> and a number of services did not start.
> If I didn't copy /dev the re-boot seemed to hang when init starts.

If you boot your system in rescue mode, there's no need
to exclude neither /dev nor /proc

I would do like this:

Boot in rescue mode, don't mount the partitions automatically.

When you get a command prompt, do like this:

cd /mnt
mkdir old new

Mount your old partitions under old:

mount /dev/hda1 old
mount /dev/hda2 old/usr
mount /dev/hda3 old/usr/share
mount /dev/hda4 old/usr/local
mount /dev/hda5 old/boot
etc.

Of course you'll have to replace hda[1-5] with the right
names.

Create the new file system on the empty partition:

mke2fs -j -L/ -O dir_index,sparse_super /dev/yournewpartition

mount it:

dev /dev/yournewpartition /mnt/new

cd /mnt/old
tar cf - .|(cd /mnt/new; tar xpf -)

Wait...

cd /mnt/new/etc

edit fstab so that the right partitions are mounted.
Note, sometimes partitions are referenced using the
label (the -L/ i mke2fs gives the label "/" to the
new partition).

Do you have a separate boot partition?
What about swap?

Are you planning to remove the disk with the old partitions
and just boot with the new?

Then you'll have to shutdown, remove the old disk,
boot in rescue mode again, mount the new partition

mkdir /mnt/new
mount /dev/yournewpartion /mnt/new
chroot /mnt/new

Doublecheck /etc/fstab
cd /boot/grub
Check grub.conf

Make sure that "root=" matches your new root partition,
either by name or by label.

Install the boot loader on the new disk:

grub-install /dev/hda

(or whatever name your disk has).

This step might fail if /proc is not mounted,
and /dev/hda does not exist.

The command ps -ef will tell you how to mount /proc

The hda* files does not exist in the /dev folder,
and you'll need to create them:

cd /dev
mknod hda b 3 0
mknod hda1 b 3 1
mknod hda2 b 3 2
etc. as needed

When grub-install has succeded, umount /proc and
remove the hda files in /dev

ctrl-D twice to make the system reboot.

This has worked for me many times. However,
it is not quite clear for me how your partitions
are now, and how it will look like in your final
system.

Mogens

-- 
Mogens Kjaer, Carlsberg A/S, Computer Department
Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark
Phone: +45 33 27 53 25, Fax: +45 33 27 47 08
Email: mk at crc.dk Homepage: http://www.crc.dk




More information about the fedora-list mailing list