Loans | Auto Insurance | Web Coupons | News | Mortgage Loans
Copying hard drives in Linux [Archive] - PCMech Forums

PDA

View Full Version : Copying hard drives in Linux


Statica
06-27-2000, 07:06 PM
As alternatives you can also use 3rd party software .. like GNUpart http://www.gnu.org/software/parted/

slickwilly25
06-28-2000, 04:50 AM
I have a Linux box set up, and I want to put in another hard drive and copy the first one to it. What is the easiest and fastest way to do this?

I already have the second drive hooked up, so how do I get to it from Linux? Do I use the mount command?

Thanks

Statica
06-28-2000, 06:56 AM
Hi Slickwilly25:

Ok now, Linux will let u mirror out your hard drive just fine, but if the sizes are different you will need to partition your new drive in preparation. These are some of the steps you would need to do [err these are explained in terms of the allmighty console to make my solution generic]
Legend: hdb is your new drive and hda the original

1) Your new drive is inside [am assuming its IDE .. change signs if its SCSI]
2) run: fdisk /hdb
create identical partition schema
3) for each new partition you will need to:
mke2fs -c /dev/hdb[b]X
4) edit /etc/fstab with your favourite editor
it should be something along the lines of
/dev/hdb1 /d1 ext2 defaults 1 0
/dev/hdb2 /d2 ext2 defaults 2 0
.
.
.
u can add or the mount points you want as represented by /d1 and /d2 in my example

If you dont know what the fstab is about, I'd recommend
using Linuxconf thru your GUI or simply 'man fstab'
you can then mount these partitions [no reboot necessary] with
mount /d1; mount /dev/hdb2 etc..

5) now to copy contents:
- if the drives are identical you can simply do a:
cat /dev/hda >/dev/hdb
- for nonidentical drive sizes of course as mentioned make identical partitions then do a
cat /dev/hda1 >/dev/hdb1
cat /dev/hda2 >/dev/hda3
.
.
.

<FONT COLOR="red">Be aware that you cant simply mirror the MBR / Lilo if you are using it .. you will need to boot from floppy after you are done, then run Lilo</font>

Cheers


PS: long yes .. but hopefully its comprehensive enuff

slickwilly25
06-28-2000, 08:19 AM
Thanks for the quick reply. Let me give you a little more information about the setup. The first drive is a 3.2 GB Fujitsu, and the second drive is a 13 GB Western Digital. Both are IDE devices.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Ex-Static-Cling:
Hi Slickwilly25:

Ok now, Linux will let u mirror out your hard drive just fine, but if the sizes are different you will need to partition your new drive in preparation. These are some of the steps you would need to do [err these are explained in terms of the allmighty console to make my solution generic]
Legend: hdb is your new drive and hda the original

1) Your new drive is inside [am assuming its IDE .. change signs if its SCSI]
2) run: fdisk /hdb
create identical partition schema
3) for each new partition you will need to:
mke2fs -c /dev/hdb[b]X
4) edit /etc/fstab with your favourite editor
it should be something along the lines of
/dev/hdb1 /d1 ext2 defaults 1 0
/dev/hdb2 /d2 ext2 defaults 2 0
.
.
.
u can add or the mount points you want as represented by /d1 and /d2 in my example

If you dont know what the fstab is about, I'd recommend
using Linuxconf thru your GUI or simply 'man fstab'
you can then mount these partitions [no reboot necessary] with
mount /d1; mount /dev/hdb2 etc..

5) now to copy contents:
- if the drives are identical you can simply do a:
cat /dev/hda >/dev/hdb
- for nonidentical drive sizes of course as mentioned make identical partitions then do a
cat /dev/hda1 >/dev/hdb1
cat /dev/hda2 >/dev/hda3
.
.
.

<FONT COLOR="red">Be aware that you cant simply mirror the MBR / Lilo if you are using it .. you will need to boot from floppy after you are done, then run Lilo</font>

Cheers


PS: long yes .. but hopefully its comprehensive enuff

<HR></BLOCKQUOTE>