diff options
-rw-r--r-- | sbin/fdisk/mbr.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c index b8f05bdded4..b02e53aae28 100644 --- a/sbin/fdisk/mbr.c +++ b/sbin/fdisk/mbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.c,v 1.27 2011/06/20 19:10:41 krw Exp $ */ +/* $OpenBSD: mbr.c,v 1.28 2012/04/04 13:14:44 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -59,10 +59,16 @@ MBR_init(disk_t *disk, mbr_t *mbr) mbr->part[3].flag = DOSACTIVE; mbr->signature = DOSMBR_SIGNATURE; - /* Use whole disk, save for first head, on first cyl. */ + /* Use whole disk. Reserve first track, or first cyl, if possible. */ mbr->part[3].id = DOSPTYP_OPENBSD; - mbr->part[3].scyl = 0; - mbr->part[3].shead = 1; + if (disk->real->heads > 1) + mbr->part[3].shead = 1; + else + mbr->part[3].shead = 0; + if (disk->real->heads < 2 && disk->real->cylinders > 1) + mbr->part[3].scyl = 1; + else + mbr->part[3].scyl = 0; mbr->part[3].ssect = 1; /* Go right to the end */ |