[SUMMARY] using dd to copy disks

From: Jay Sekora <jay_at_ccs.neu.edu>
Date: Tue, 15 Oct 1996 11:50:33 -0400

Hi. My original question was how to use dd to copy the boot disk on an
DEC 3000/300 to a second disk mounted internally. (I hadn't been
successful in just booting single-user and dd'ing partitions.)

First off, I wasn't able to do it the way I'd been trying to because
the system doesn't let you overwrite the disklabel blocks by default.
(Somebody told me that "disklabel -W /dev/rrzXa" should work, and it
looked like it ought to from the man page, but it didn't seem to.
"disklabel -z /dev/rrzXc" did the trick though. It may be that the
problem was that I was using partition a rather than c.)

Secondly, I'd been partitioning the new disk and trying to copy each
partition individually. That works, but all I really had to do was
copy partition c (the entire disk). The thing I was confused about
is that the partition information is actually stored _within_ a partition
near the beginning of the disk. So by default, partitions a and c
actually _contain_ the partition table. (That's the part you can't
overwrite without special effort, and that's why I wasn't able to
just dd partition a without using the disklabel command.) So copying
partition c makes an exact copy of the disk, including partition
information.

So, assuming the old disk that I want to copy is SCSI ID 3, and the
new one is SCSI ID 2, the full procedure would be:

* boot single-user (e.g. with
>>> BOOT -FL S

* use disklabel to zero-out the old partition table:
  # disklabel -z /dev/rrz2c

* copy the partition
  # dd if=/dev/rz3c of=/dev/rz2c bs=512
  (Somebody suggested using the raw device instead, with a block size
  of 8K or a multiple of it, for a speed improvement. I haven't tried
  that yet.)

* check/clean the new partitions with fsck. This is most important
  for the boot partition; the others will probably already be clean:
  # fsck -y /dev/rz2a
  (and repeat as needed/desired for other partitions)

Then you can swap the disk into another machine, make sure the PROM
settings are correct, and boot from it. (Of course, at that point the
two machines think they have the same hostname and IP address.)

Several people pointed me at using "vdump/vrestore" instead of "dd" to
save time since dd copies all blocks, whether allocated or not. I
didn't have "vdump" and "vrestore" on the disk (are they only installed
if you're using AdvFS?), but I tried using "dump" and "restore"
unsuccessfully before finding the right "disklabel" command; my guess
is that it would have worked, but then it would have required me to do
each partition individually.

A couple of people also suggested booting from the installation CD ROM
and mounting the two disks; that would have been fine, but would have
been more time consuming and would have only allowed me to do one
machine at a time.

Many thanks to:

  alan_at_nabeth.cxo.dec.com
  John Kohl <jtk_at_atria.com>
  Gyula Szokoly <szgyula_at_skysrv.Pha.Jhu.EDU>
  Larry Church <lchurch_at_Adobe.COM>
  Tim Llewellyn <tjl_at_siva.bris.ac.uk>
  Richard Tame <Richard.Tame_at_asx.com.au>

And especially the nice folks who wrote the OSF/1 (old manual :-) Systems
Administration manual, which is where I found the "disklabel -z" command.

Sincerely,

Jay Sekora
<jay_at_ccs.neu.edu>
Received on Tue Oct 15 1996 - 19:49:10 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:47 NZDT