Commit 7a820773 authored by Mike Hibler's avatar Mike Hibler
Browse files

Limit setting of MBR partition sizes to 2TB.

In the 64-bit MFS, the disk size would be returned as a 64-bit value
which we would try to shoehorn into a 32-bit MBR field. The resulting
setup of partition 4 on a > 2TB disk would not be pretty.

NOTE: this limits us to using only a little over 2TB (~18GB in partitions
1-3 and 2TB in partition 4) of large disks right now.
parent b7351fe4
......@@ -76,6 +76,8 @@ struct diskinfo {
struct dospart *parts;
} diskinfo;
#define MAXSECT ((unsigned long)0xFFFFFFFF)
char optionstr[] =
"[-fhvW] [disk]\n"
"Create or extend a DOS partition to contain all trailing unallocated space\n"
......@@ -345,6 +347,16 @@ tweakdiskinfo(char *disk)
dp = &[lastunused];
* XXX since we are still in MBR-land, we cannot have a partition
* larger than 4G - 1 sectors.
if ((unsigned long)(diskinfo.disksize-firstfree) > MAXSECT) {
warnx("WARNING! Disk has %lu sectors, "
"will only use %lu", diskinfo.disksize, MAXSECT);
diskinfo.disksize = MAXSECT + firstfree;
if (fdisk) {
printf("p %d %d %ld %ld\n",
lastunused+1, dp->dp_typ ? dp->dp_typ : DOSPTYP_386BSD,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment