Subject: Re: Copy hard disk to hard disk
To: Rick Copeland <rickgc@calweb.com>
From: Simon Burge <simonb@telstra.com.au>
List: port-sun3
Date: 11/09/1997 23:52:06
On Fri, 7 Nov 1997 10:56:45 -0800 (PST)  Jeremy Cooper wrote:

> 
> 
> On Fri, 7 Nov 1997, Rick Copeland wrote:
> 
> > I have a Sun 3/80 that is running nicely and I would like to make an exact
> > copy of the hard disk drives for a second one that I have purchased.  So, is
> > it possible some how to copy an entire hard disk drive (I mean everything
> > including boot blocks, etc.) over to a new hard disk drive?
> 
> /bin/dd, buddy, /bin/dd.  But, beware the ESP fifo re-select bug.  Make
> sure that both the source and destination drive are at SCSI ID 3 or below.
> If either drive is at ID 4 or above, re-selection will be enabled for that
> drive and some 10 blocks into the transfer you will experience many 
> ``esp0: RESELECT, x bytes in FIFO!'' errors.  (This warning only applies
> if you will be copying the drives with your 3/80.)
> 
> Driver bugs aside, you can copy whole disks with /bin/dd.
> 
>         source       destination  (copy 128k at a time if possible)
>   dd if=/dev/sdXX of=/dev/sdXX    bs=128k
> 
> The block size parameter doesn't matter that much.  However, if you make
> it too small, your transfer may take longer.  You also should make sure
> that neither the source or destination drive is currently mounted on your
> filesystem before you begin.

Just as an extension to this - on DEC Ultrix boxes, an RZ58 (1.3GB)
takes about 3.5 hours to copy with the default block size of dd (512
bytes), and about 35 minutes with a block size of 32k.  Larger than that
doesn't make a difference here.

Also, in relation to copying the disks - if they're not exactly the same
size, dd is helpful, but not that helpful.  You can use the disklabel(8)
command to write bootblocks to the new disk.  If you newfs the new disk,
you can then use dump/restore to copy data.  Something like:

	# newfs /dev/sd<NEW>a
	# mount /dev/sd<NEW>a /mnt
	# cd /mnt
	# dump 0f - /dev/sd<OLD>a | restore xf -

should copy an old "a" partition to a new "a" partition.

Simon.