The disk labels generated by bsdlabel can no address more than

0xffffffff sectors.  Document this limit and avoid installing bogus
labels on disks with more sectors.

Allowing the installation of labels addressing as much of the disk as
possiable may be a useful addition in some situations, but this was easy
to implement and should reduce confusion.

PR:		bin/71408
This commit is contained in:
Brooks Davis 2004-09-09 07:46:53 +00:00
parent 030c6fb156
commit 86e0bd0dc0
2 changed files with 22 additions and 7 deletions

View File

@ -273,7 +273,7 @@ Lowercase versions of
and
.Cm G
are allowed.
Size and type should be specifed without any spaces between them.
Size and type should be specified without any spaces between them.
.Pp
Example: 2097152, 1G, 1024M and 1048576K are all the same size
(assuming 512-byte sectors).
@ -408,8 +408,8 @@ Display what the label would be for
.Pa da0s1
using the partition layout in
.Pa label_layout .
This is useful for determining how much space would be alloted for various
partitions with a labelling scheme using
This is useful for determining how much space would be allotted for various
partitions with a labeling scheme using
.Cm % Ns -based
or
.Cm *
@ -468,6 +468,20 @@ which could be used as a source file for
f: 5g * 4.2BSD
g: * * 4.2BSD
.Ed
.Sh DIAGNOSTICS
The kernel device drivers will not allow the size of a disk partition
to be decreased or the offset of a partition to be changed while it is open.
.Sh COMPATIBILITY
Due to the use of an
.Vt u_int32_t
to store the number of sectors,
bsdlabels are restricted to a maximum of 2^32-1 sectors.
This usually means 2TB of disk space.
Larger disks should be partitioned using another method such as
.Xr gpt 8 .
.Pp
The various BSDs all use slightly different versions of BSD labels and
are not generally compatible.
.Sh SEE ALSO
.Xr ccd 4 ,
.Xr geom 4 ,
@ -475,7 +489,5 @@ which could be used as a source file for
.\" Xr bsdlabel 5 ,
.Xr disktab 5 ,
.Xr boot0cfg 8 ,
.Xr fdisk 8
.Sh DIAGNOSTICS
The kernel device drivers will not allow the size of a disk partition
to be decreased or the offset of a partition to be changed while it is open.
.Xr fdisk 8 ,
.Xr gpt 8

View File

@ -477,6 +477,9 @@ readlabel(int flag)
(ioctl(f, DIOCGSECTORSIZE, &secsize) != 0)) {
err(4, "cannot get disk geometry");
}
if (mediasize > (off_t)0xffffffff * secsize)
errx(1,
"disks with more than 2^32-1 sectors are not supported");
(void)lseek(f, (off_t)0, SEEK_SET);
if (read(f, bootarea, BBSIZE) != BBSIZE)
err(4, "%s read", specname);