Subject: Re: Cloning /dev/wd0
To: David Laight <david@l8s.co.uk>
From: Frederick Bruckman <fredb@immanent.net>
List: netbsd-help
Date: 12/10/2002 08:33:21
On Tue, 10 Dec 2002, David Laight wrote:

> On Tue, Dec 10, 2002 at 08:05:17AM -0600, Frederick Bruckman wrote:
> > On Tue, 10 Dec 2002, Nicolas Saurbier wrote:
> >
> > > I have a Harddisk /dev/wd0 and I want to mirrow it on /dev/wd2. wd0 h=
as several partitions.
> > >
> > > On Linux I would do a "dd if=3D/dev/hda of=3D/dev/hdc" and mirrow eve=
rything on hda on hdc.
> > > Now I=B4m looking for a possibility to do a "dd" on NetBSD that copys=
 all partitions on wd0 to wd2.
> > >
> > > How shall I do this? Is there something like "hda" (the whole HD), ma=
y be just wd0???? (I know,
> > > there is no wd0)
> >
> > On NetBSD, the whole (first) disk is "/dev/wd0d", the third is
> > "/dev/wd2d".

Correction: Better to use "/dev/rwd0d" and "/dev/rwd2d".

> > One warning: sometimes when you try to write past the end, the kernel
> > spews messages, then downgrades the DMA mode, which is inconvenient.
> > The work-around is to calculate and supply the exact "count" to "dd"
> > for a given "bs".
>
> You will also, probably, find that netbsd will refuse to write
> to the sector that is believes contains the netbsd disklabel.
> This might be sector 0 if the disk doesn't have a netbsd partition.
> The DIOCWLABEL ioctl will let you do the write...

I zero'd out a labeled disk before removing it just the other day,
using the raw device. The in-core label is protected, but "dd" did
actually write zeros to the disk, as evidenced by the label being
absent after a reboot. It might not work with the block device.

Frederick