[Prev][Next][Index]

Re: [?] Copying linux OS from one HD to another



On Tue, 19 Dec 1995, Bekman Stas wrote:

> Hi,
> I was asked to copy my linux system to other PC by copying HD->HD
> Is it possible? I think it is, but I'm not sure about /dev/hd?
> If I plug second HD to my PC and format it with fdisk what is the name
> /dev/hd? I should give ? And after I return the HD to it's host it comes back
> to be the first HD... I want to say that there might be a problem with
> names of partition devices.

I would attempt it.

First configure your drive as IDE Master
Then the other drive as IDE slave.

Now boot linux and use fdisk to partition the second disk (I assume it is 
pre-low level formatted, as they usualy come today). The command line is 
fdisk /dev/hdb

After the swap partition and linux partition has been set up format the 
partitions:

mkswap /dev/hdbN (N=partition number of swap partition)
mk2efs /dev/hdbM (M=partition number of linux native partition)

Now mount it, say:

mount -t ext2 /dev/hdb /mnt

For the copy I would use this:

tar -cf - /* | tar -xf - /mnt..... BUT it will not work... because it 
will recoursively try to copy the mnt directory... So maybe a more 
sophisticated expression:

tar -cf - /[a-l,n-z,A-Z]* | tar -xf - /mnt

I think this should work.

--------------------------------------------- ....- --.. ----. -.. --. .
            Arik Baratz, Regularus Studentus, iNTP, 4Z9DGE
---------------------------------------------------------------------------

  "Your conscious mind is very intelligent, and your unconscious mind
     is a hell of a lot smarter than you are."
                                                 - Erickson H. Milton
http://ccarik.technion.ac.il/~arikb