(linux_command_line)-> cloneing a computer
submited by Russell Sat 29 Jan 05|
Edited Wed 02 Feb 05
OK in frustration for the above events, I tried a new tactic. I would
use the old software on the new hardware:
I considered just moving the hard drive from the old system to the new
system but I didn't want to damage the "working computer" so I copied
the hard drive that contained a modified Redhat 7.3 install with the
2.4.19 kernel and the bttv patch
installed. I moved the old capture
card from the old computer to the new one.
Copying the hard drive was MUCH easier
said than done.
The drive size's differ, so I could not use rawwrite. I installed the
new drive in the old computer ( /dev/hdc ) and did quick erases of the
two partitions the Redhat 9.0 install created.
(drive not mounted)
A bug in mount or something causes the wrong dive to be identified
when you are mounting/unmounting etc. I found that I avoid this
bug by editing /etc/fstab to change the "Label=/" and "label=/boot" to
be explicit device references (/dev/hda2 for me ) This problem
occurs when you have multiple drives with the same partition labels (
common if both were formatted by the redhat install program )
so I copied the contents of /boot to the boot partition and I copied
the contents of most of the root partition to the new root partition.
mount /dev/hdc1 /mnt/temp
cp -arvp /boot .
mount /dev/hdc2 /mnt/temp
cp -arvp /bin /sbin /var /etc /lib /misc
/root /usr .
I didn't include /home /mnt and /tmp , I just made new ones.
I didn't include lost+found ( mkfs made one already)
I just created a /boot so that I could mount the boot partition.
I didn't copy /proc and /dev case those aren't real dirs....
but wait ... /dev is a real dir. ... ( more on this in a minute)
so I put this all together and vola , it won't boot.. cause I didn't
copy the boot sector , and the existing boot sector is not configured
for this boot image...
hrm .. well long story short the trick is to run lilo with the correct
I was able to do this with the redhat 9.0 disk in "linux rescue" mode
lilo -b /dev/hda -r /mnt/system_drives
("system_drives" isn't right, the CD mounts them in /mnt with a name
be sure to use "/dev/hda" and not "/dev/hda1" because you want to
modify the boot sector of the whole drive not just the partition.
so it boots. but then is goes batty because there aren't any devices in
what to do?
well I booted again in rescue mode and did a
cp -arvp /dev /mnt/system_drives/dev
and shockingly this kinda worked.. .but not really because the device
list on the boot CD is incomplete.
at first I played with mknod which is supposed to create devices but I
couldn't get that to work, so I moved the new drive back to the old
computer and booted that with the new drive installed as /dev/hdc
the cp command in rhat 7.3 (fileutils 4.1) could not copy the devices.
but the one on the 9.0 (rescue boot) CD could. (coreutils) 4.5.3
so finally, with a full /dev directory, I was able to boot the cloned
I changed the name it the network setup and I was ready to test the
Add comment or question...: