Weird issues cloning a Linux system to new hard drive

Weird issues cloning a Linux system to new hard drive

Post by Lewin A.R.W. Edward » Fri, 07 Dec 2001 07:48:53



I'm copying a Linux system from one hard drive to another; this is a limited
demo run of mass-produced systems. (For real production we are using
hardware duplication and it's someone else's problem). I'd like some
comments on my procedure, because there are some real weird things
happening.

I start with a known-good bootable hard drive containing my Linux install
configured as I like it. I put it in a PC on the secondary controller, and
put in a different bootable Linux drive on the primary controller. I mount
the source drive with "mount /dev/hdc1 /mnt".
I tar the contents of the drive to be cloned with "cd /mnt ; tar cvf
/newdrive.tar *".
I take out the source drive, I move the "other" drive (that contains the
tarfile) to the secondary controller and I put in a blank drive on the
primary controller.
I then boot off a floppy with the commandline "linux single root=/dev/hdc1".
I use fdisk to create partitions and mke2fs to format them.
I mount the new drive's root partition and extract the tar archive ("mount
/dev/hda1 /mnt ; tar xvf /newdrive.tar").
I reboot from the floppy again, this time with "linux single
root=/dev/hda1".
I run lilo to put the bootloader in the MBR of the target drive.

First odd thing:
When I am untarring my file, as soon as tar reaches usr/bin/sendmail (or
something in usr anyway) the system goes weird; init restarts runlevel 3
(seems like it just runs rc3.d again). There is a message from pam_unix but
I can't see it; it's too quick. This same error sometimes appears when I'm
trying to create the tar file, too. Always somewhere in the /usr directory.
This one is really bizarre.

Second odd thing:
The commands "mount -n -o remount,rw /dev/hda1 /" and "mount -f /" in
rc.sysinit fail on the cloned drive ("mount: no such partition defined"). If
I add "/dev/hda1 " before the "/" then they work OK. It's like the label in
/etc/fstab is no longer recognized. Why is it so???

Third odd thing:
I have two identical drives - IBM DLGA-23080. Both of them are detected in
BIOS with their "real" geometry of 5968,16,63. But one of them is reported
by fdisk as having the translation 746,128,63 whereas the other comes up
with its "real" geometry.

--
=== Lewin A.R.W. Edwards
Responsibly disposing of dangerous liqueur chocolates
and surplus peppermints since 1974.
http://www.larwe.com/

 
 
 

Weird issues cloning a Linux system to new hard drive

Post by Lewin A.R.W. Edward » Fri, 07 Dec 2001 11:37:08


Followup to this:



Quote:> I'm copying a Linux system from one hard drive to another; this is a
limited
> demo run of mass-produced systems. (For real production we are using
> hardware duplication and it's someone else's problem). I'd like some
> comments on my procedure, because there are some real weird things
> happening.

Instead of tarring the entire root into one file, I made separate archives
for various directories. It seems that I get this BIZARRE problem of
switching to runlevel 3 spontaneously at random places while
untarring/tarring very large tar archives (100-250Mb).

Any idea as to why this is happening? Could it be because this system has no
virtual memory?

--
=== Lewin A.R.W. Edwards
Responsibly disposing of dangerous liqueur chocolates
and surplus peppermints since 1974.
http://www.larwe.com/

 
 
 

Weird issues cloning a Linux system to new hard drive

Post by Mike Knuds » Fri, 07 Dec 2001 16:20:18




>Any idea as to why this is happening? Could it be because this system has no
>virtual memory?

Sure could!  I've heard of processes that needed up to 512M total memory (real
and virtual).
  How much real RAM do you have?
Any reason you don't have a /swap partition?  Can you easily add one?
--Mike K.

Oscar loves trash, but hates Spam!  Delete him to reply to me.

 
 
 

Weird issues cloning a Linux system to new hard drive

Post by Lewin A.R.W. Edward » Fri, 07 Dec 2001 21:50:03



Edwards"

Quote:> >Any idea as to why this is happening? Could it be because this system has
no
> >virtual memory?

> Sure could!  I've heard of processes that needed up to 512M total memory
(real
> and virtual).

I wouldn't have thought tar would require this much RAM, though! And
remember I'm in single-user mode, so there isn't much in the background.

Quote:>   How much real RAM do you have?

The system I was doing the cloning on has 192Mb.

Quote:> Any reason you don't have a /swap partition?  Can you easily add one?

The target system runs without swap for performance reasons. So to add a
swap partition I need to put in a third hard drive, which is possible of
course but I didn't plan on doing it.

--
=== Lewin A.R.W. Edwards
Responsibly disposing of dangerous liqueur chocolates
and surplus peppermints since 1974.
http://www.larwe.com/

 
 
 

Weird issues cloning a Linux system to new hard drive

Post by Frank Mabre » Sat, 08 Dec 2001 17:39:58


Have you tried using cpio instead of tar?

Frank


>I'm copying a Linux system from one hard drive to another;

snip
 
 
 

Weird issues cloning a Linux system to new hard drive

Post by Peter T. Breue » Sat, 08 Dec 2001 21:32:13



Quote:> put in a different bootable Linux drive on the primary controller. I mount
> the source drive with "mount /dev/hdc1 /mnt".
> I tar the contents of the drive to be cloned with "cd /mnt ; tar cvf
> /newdrive.tar *".

Error. Try

   tar cvpzfC /newdrive.tgz /mnt .

Quote:> I take out the source drive, I move the "other" drive (that contains the

There was no need to do any hardware shuttling. You could have kept
the original in or else used the net.

Quote:> When I am untarring my file, as soon as tar reaches usr/bin/sendmail (or
> something in usr anyway) the system goes weird; init restarts runlevel 3

Uhhhhh!!!! You can't untar over a systenm in use! (screams).

Peter

 
 
 

Weird issues cloning a Linux system to new hard drive

Post by Lewin A.R.W. Edward » Sun, 09 Dec 2001 04:05:24




Quote:> > I take out the source drive, I move the "other" drive (that contains the

> There was no need to do any hardware shuttling. You could have kept

Yes there is. If I boot with the source drive as hda then I can't run LILO
to install LILO in the boot sector of the destination drive. If I boot with
the source drive as hdc, the startup scripts, fstab etc won't work properly
because they have absolute partition references in them.

Quote:> the original in or else used the net.

I've never ever got a network boot diskette working properly for Linux,
since I first tried Slackware many years ago.

Quote:> > When I am untarring my file, as soon as tar reaches usr/bin/sendmail (or
> > something in usr anyway) the system goes weird; init restarts runlevel 3

> Uhhhhh!!!! You can't untar over a systenm in use! (screams).

You didn't read my description clearly. I was untarring into /mnt, NOT over
an active installation!

--
=== Lewin A.R.W. Edwards
Responsibly disposing of dangerous liqueur chocolates
and surplus peppermints since 1974.
http://www.larwe.com/

 
 
 

Weird issues cloning a Linux system to new hard drive

Post by S. Par » Fri, 14 Dec 2001 12:53:04





>> > I take out the source drive, I move the "other" drive (that contains
>> > the

>> There was no need to do any hardware shuttling. You could have kept

> Yes there is. If I boot with the source drive as hda then I can't run
> LILO to install LILO in the boot sector of the destination drive. If I
> boot with the source drive as hdc, the startup scripts, fstab etc won't
> work properly because they have absolute partition references in them.

>> the original in or else used the net.

> I've never ever got a network boot diskette working properly for Linux,
> since I first tried Slackware many years ago.

>> > When I am untarring my file, as soon as tar reaches usr/bin/sendmail
>> > (or something in usr anyway) the system goes weird; init restarts
>> > runlevel 3

>> Uhhhhh!!!! You can't untar over a systenm in use! (screams).

> You didn't read my description clearly. I was untarring into /mnt, NOT
> over an active installation!

But where were you cd'd? In the first post, you "mount .." and "tar xvf",
and no mention about "cd".
So the question is what pwd will say. If it was /, then as Peter T.B.
said you're messing up the "source" system.

Quote:

> --
> === Lewin A.R.W. Edwards
> Responsibly disposing of dangerous liqueur chocolates and surplus
> peppermints since 1974.
> http://www.larwe.com/

I have copied systems many times, but never was happy w/ tar. What I did was
to boot w/ boot+root disks (Slackware ones are the easiest to make -- you can
even make a CD easily.), and "cp -axv /mnt/old/* /mnt/new".

Regards.

 
 
 

Weird issues cloning a Linux system to new hard drive

Post by Lewin A.R.W. Edward » Sat, 15 Dec 2001 04:20:45


Quote:> > You didn't read my description clearly. I was untarring into /mnt, NOT
> > over an active installation!

> But where were you cd'd? In the first post, you "mount .." and "tar xvf",
> and no mention about "cd".
> So the question is what pwd will say. If it was /, then as Peter T.B.
> said you're messing up the "source" system.

I was in /mnt. Trust me on this :) The issue I was experiencing is bizarre.
It only happens on that one machine, so I think it might be bad RAM, weird
hard disk controller, whatever...

--
=== Lewin A.R.W. Edwards
Responsibly disposing of dangerous liqueur chocolates
and surplus peppermints since 1974.
http://www.larwe.com/

 
 
 

Weird issues cloning a Linux system to new hard drive

Post by Lucius Chiaravigl » Tue, 25 Dec 2001 12:27:48


[Hmmm . . . 3 days after posting, this message doesn't even seem to have made
it to groups.google.com, so I am trying again.  Apologies in advance if this
appears twice.]





>> > I take out the source drive, I move the "other" drive (that contains the

>> There was no need to do any hardware shuttling. You could have kept

>Yes there is. If I boot with the source drive as hda then I can't run LILO
>to install LILO in the boot sector of the destination drive. [. . .]

        You can install Lilo in the boot sector of a drive other than
/dev/hda.  I don't remember the exact instructions, but you can find them
somewhere in http://www.linuxdoc.org/HOWTO/mini/Hard-Disk-Upgrade/index.html.
(Caution:  some of the instructions in there for some of the other parts of
copying a hard drive need a little modification before use.)  I have tried
this and even had it work.  (Note, however, that if the source and destination
machines have different BIOS ideas about cylinder-head-sector translation, you
will have to reinstall Lilo on the destination drive anyway.)
 
 
 

1. How to loading new file system on a new hard drive partition?

Hi:

I just bought a new hard drive for my linux.
But I had problem in loading file system on it.

This was how I did it. First, I partition this
hard drive, and then I added a line in /etc/fstab
to make it load a new file system(/usr2) on the
new partion(/hdb/hd#) on the new hard drive.
But when I re-booted it, I got error messages
saying that my superblock info was messed up,
and therefore it tried to use the old one...

Can anyone tell me what I did wrong? What's the
correct way to do this? Please email me your
advice. I'll very appreciate it!!

Yang-Cheng

2. PPPD and Win95

3. very weird: entire system "blocks" during hard-drive IO

4. sis 6326 video card

5. purchasing a new hard drive for linux system

6. txconn

7. Weird, weird, weird issue ....

8. ssl/*.so files missing in binary distribution httpd-2.0.35 for RH72

9. Replacing Hard Disk - Copying Linux system to new Hard Disk ????

10. Cloning a hard-drive with Linux and NT

11. Hard Drive cloning tool in linux

12. Cloning a Hard-Drive in Linux

13. how to clone a linux hard drive?