Ok, Yes it's been answered before and I have tried to archive some of this stuff to 
make my own faq of sorts so here's what I've got;


  Copy a Linux drive. 

# fdisk /dev/hdb # new drive 

# mke2fs /dev/hdb1 

# mount /dev/hdb1 /mnt 

# tar clpf - / | ( cd /mnt; tar xfvp - ) 

( put a floppy disk in your drive) 

# dd if=/zImage of=/dev/fd0 

# rdev /dev/fd0 /dev/hdb1 

# vi /mnt/etc/lilo.conf 

( change to reflect new root fs) 

( reboot - boot from floppy ) 

# lilo 

( reboot - boot from HD ) 

Or; 

I have found the following does the job just fine: 

find / -depth -mount | cpio -pdumv /mnt 

Where /mnt was the mountpoint for the new drive. 

Remember to fix up things like /etc/fstab and anything else that might 

be dependent on drive devices being specified correctly. And have a 

bootdisk handy so you can get in and rerun lilo (after properly 

reconfiguring it). 

And here's another way; 

1) partition the new drive how you want it. 

2) mount the new partitions under /mnt as they will look in your new 

file system. 

3) cd / 

4) tar -cfl - / /usr /usr/local ... | (cd /mnt ; tar xf -) 

where "/ /usr /usr/local ..." are all the partition 

names on your current 340 MB Linux filesystem (if you 

only have / then that's the only argument you need. 

Look in your /etc/fstab for a list. Only use the 

partitions on your 340MB hard drive. 

This pipeline will write a "tar" file (on stdout) of 

your old hard drive's file systems (it won't follow 

links, but it will copy them into the "tar" file. If 

you use a GNU tar program, which is standard 

with most 

Linux distributions, it'll copy your devices and special 

files as well). The second part of the pipeline will 

attach to your new file system and untar the file on 

stdin (what the first program is writing on its stdout) 

into the new file system mounted under /mnt. Just don't 

put /mnt in the first tar command, and you should be all 

set. 

The "l" option to tar will keep it from adding anything 

to the archive that doesn't exist in one of the file 

systems you specified to tar (so if / and /usr are 

separate partitions, "l" will add /usr to the archive 

when it is found in /, but it won't add the contents of 

/usr until it processes the /usr argument to tar. 

Likewise, it will create /proc, but it will never copy 

the contents of /proc because /proc was not one of the 

fileystems mentioned on the command line to tar to be 

copied.) 

-----Original Message-----
From:   Barton Hodges [SMTP:[EMAIL PROTECTED]]
Sent:   April 26, 1999 12:10 PM
To:     [EMAIL PROTECTED]
Subject:        Duplicate a harddrive?

Hi everyone,
        I know this is not about diald, but everyone
who posts to this seems to know quite a bit.
I want to duplicate a harddrive.  Say I'm booted to
1 drive, and I have 2 other drives connected.  How
can I duplicate 1 of the drives onto the other, 
partitions and all?  Is this possible with a "dd" command?
Is it possible to duplicate the drive I am booted on, 
to another drive even though some files may be open?

thanks a bunch.

barton

-
To unsubscribe from this list: send the line "unsubscribe linux-diald" in
the body of a message to [EMAIL PROTECTED]


-
To unsubscribe from this list: send the line "unsubscribe linux-diald" in
the body of a message to [EMAIL PROTECTED]

Reply via email to