Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Dec 1995 08:52:21 +0100 (MET)
From:      grog@lemis.de (Greg Lehey)
To:        bde@zeta.org.au (Bruce Evans)
Cc:        hackers@freebsd.org (FreeBSD Hackers)
Subject:   Re: disk to disk copy
Message-ID:  <199512240752.IAA13974@allegro.lemis.de>
In-Reply-To: <199512231309.AAA23907@godzilla.zeta.org.au> from "Bruce Evans" at Dec 24, 95 00:09:49 am

next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans writes:
>
>>> is it to do a disk to disk copy including the partition table and label
>
>> It depends on the device node you're using.  You can copy all, includ-
>> ing even the master boot record (which _can_ be the start of the BSD
>> disklabel as well, but isn't for most disks).
>
> Actually, overwriting valid MBR's, SecondaryBR's (inside extended
> partitions and disk labels should fail.  It succeeds in some cases
> because of bugs:
> - write protection isn't implemented for MBR's and SBR's
> - write protection of labels is implemented but can be defeated by
>   copying to the whole disk device (e.g. /dev/rsd0 instead of
>   /dev/rsd0c, even when these devices contain the same sectors).
>
> The MBR can never be the start of a FreeBSD disk label, since FreeBSD
> labels are always in sector LABELSECTOR = 1.  BSD labels for other
> BSD's may start be in sector 0.  FreeBSD would not be able to find
> these.

That's a matter of definition.  If you're talking to a character
device, anything should be allowed.  I have a number of disk drives
which I use for various systems at various times.  To change systems,
I copy the whole disk to tape and then a tape copy to disk.  Under
FreeBSD, this always fails if there is no valid BSD label on the
disk.  BSD/OS doesn't have this problem, so I do it with BSD/OS.

Presumably the problem is that the disk driver relies on the disk
label to know the size of the disk, although it could get the geometry
from the BIOS, or, better, the disk itself.  I think there's a basic
philosophical flaw in trying to interpret the contents of a character
device.

Greg




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512240752.IAA13974>