summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2004-09-09 07:46:53 +0000
committerbrooks <brooks@FreeBSD.org>2004-09-09 07:46:53 +0000
commit0073b704f8c46292e24e9b722a439777146f8915 (patch)
tree55a26b557d8150629d66818990d4e3cb31253ad4
parentd4e6ebd0c9b531af4b69bb69db16d4d14936e0e2 (diff)
downloadFreeBSD-src-0073b704f8c46292e24e9b722a439777146f8915.zip
FreeBSD-src-0073b704f8c46292e24e9b722a439777146f8915.tar.gz
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
-rw-r--r--sbin/bsdlabel/bsdlabel.826
-rw-r--r--sbin/bsdlabel/bsdlabel.c3
2 files changed, 22 insertions, 7 deletions
diff --git a/sbin/bsdlabel/bsdlabel.8 b/sbin/bsdlabel/bsdlabel.8
index f2d55eb..cbb4e34 100644
--- a/sbin/bsdlabel/bsdlabel.8
+++ b/sbin/bsdlabel/bsdlabel.8
@@ -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
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index cef2050..8d44e68 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -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);
OpenPOWER on IntegriCloud