On Tue, Apr 24, 2012 at 08:14:19PM +0200, Alexander Hall wrote: > You do not flag which "to use". Multiple A6 entries brings problems > since you get multiple disklabels.
Perhaps it's worthwhile for fdisk to sanity check for errors like this before writing out an MBR? Index: cmd.c =================================================================== RCS file: /home/mdempsky/anoncvs/cvs/src/sbin/fdisk/cmd.c,v retrieving revision 1.46 diff -u -p -r1.46 cmd.c --- cmd.c 11 Nov 2011 18:21:06 -0000 1.46 +++ cmd.c 25 Apr 2012 03:00:16 -0000 @@ -328,7 +328,16 @@ int Xwrite(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { char mbr_buf[DEV_BSIZE]; - int fd; + int fd, i, n; + + for (i = 0, n = 0; i < NDOSPART; i++) + if (mbr->part[i].id == 0xA6) + n++; + if (n >= 2) { + warnx("MBR contains more than one OpenBSD partition!"); + if (!ask_yn("Write MBR anyway?")) + return (CMD_CONT); + } fd = DISK_open(disk->name, O_RDWR); MBR_make(mbr, mbr_buf);