ast@cs.vu.nl (Andy Tanenbaum) (01/15/89)
The fdisk that Robert Regn posted a while back came in here truncated. Could you please post the cdif against 1.3 again. Has this been thoroughly tested? Fdisk is not the kind of program one would like to have bugs in. Andy Tanenbaum (ast@cs.vu.nl)
rtregn@immd3.informatik.uni-erlangen.de (Robert Regn) (01/21/89)
From article <1904@ast.cs.vu.nl>, by ast@cs.vu.nl (Andy Tanenbaum): > > The fdisk that Robert Regn posted a while back came in here truncated. Could > you please post the cdif against 1.3 again. Has this been thoroughly tested? > Fdisk is not the kind of program one would like to have bugs in. > For such disks I have a little improved fdisk.c. It's usage is: fdisk [-heads] [/dev/hdx] The default is -4 and /dev/hd0. It recognizes DOS4 (for 3.3) and Xenix partitions also. I have used it several times. The changes are not great so I think it has no bugs - and it prints the number of heads for your check. A good improvement would be to print the partitions in the same order as they are mapped by the disk driver into /dev/hd[1-4]. So the danger destroying another filesystem with mkfs is reduced. *** minix/1.3/a.fertig/commands/fdisk.c Tue Oct 4 12:43:10 1988 --- FDISK.C Tue Dec 6 16:53:34 1988 *************** *** 55,61 **** --- 55,64 ---- char secbuf[SECSIZE]; char *devname; char *dosstr = " DOS "; + char *dosstr4 = " DOS 4"; char *ndosstr = "Non-DOS"; + char *xenstr = " Xenix "; + int heads; #ifdef DOS union REGS regs; *************** *** 75,86 **** /* init */ ! if (argc != 2) { ! printf("Usage: fdisk /dev/hdx\n"); exit(1); } ! devname = argv[1]; getboot(secbuf); /* get boot sector */ do { --- 78,99 ---- /* init */ ! if ( argc > 1 && (*++argv)[0] == '-') /*flag*/ ! {heads = atoi( & (*argv)[1]); ! printf("heads: %d ", heads); ! argv++; ! argc--; ! } ! else heads = NHEAD; ! ! if (argc > 2) { ! printf("Usage: fdisk [-heads] [/dev/hdx]\n"); exit(1); } ! if ( argc == 1) ! devname = "/dev/hd0"; ! else devname = *argv; getboot(secbuf); /* get boot sector */ do { *************** *** 339,346 **** if (entry->sysind == 0x01) typestring = dosstr; ! else ! typestring = ndosstr; printf("%5d %s ",number,typestring); temp = entry->start_sec & 0xc0; low_cyl = (entry->start_cyl & 0xff) + (temp << 2); --- 352,363 ---- if (entry->sysind == 0x01) typestring = dosstr; ! else if (entry->sysind == 0x02) ! typestring = xenstr; ! else if (entry->sysind == 0x04) ! typestring = dosstr4; ! else ! typestring = ndosstr; printf("%5d %s ",number,typestring); temp = entry->start_sec & 0xc0; low_cyl = (entry->start_cyl & 0xff) + (temp << 2); *************** *** 423,432 **** { int bigcyl; ! bigcyl = logsec / (NHEAD * NSEC); *sec = (logsec % NSEC) + 1 + ((bigcyl >> 2) & 0xc0); *cyl = bigcyl & 0xff; ! *hd = (logsec % (NHEAD * NSEC)) / NSEC; } /* --- 440,449 ---- { int bigcyl; ! bigcyl = logsec / (heads * NSEC); *sec = (logsec % NSEC) + 1 + ((bigcyl >> 2) & 0xc0); *cyl = bigcyl & 0xff; ! *hd = (logsec % (heads * NSEC)) / NSEC; } /* *************** *** 487,497 **** return; } low = first & 0xffff; ! low = low * NSEC * NHEAD; if (low == 0) low = 1; /* sec0 is master boot record */ high = last & 0xffff; ! high = (high + 1)*NSEC*NHEAD - 1; entry->lowsec = low; entry->size = high - low + 1; sec_to_hst(low, --- 504,514 ---- return; } low = first & 0xffff; ! low = low * NSEC * heads; if (low == 0) low = 1; /* sec0 is master boot record */ high = last & 0xffff; ! high = (high + 1)*NSEC*heads - 1; entry->lowsec = low; entry->size = high - low + 1; sec_to_hst(low, ------------------------------------------------- Robert Regn rtregn@faui32.uucp rtregn@immd3.informatik.uni-erlangen.de West Germany
nall@loligo.cc.fsu.edu (John Nall) (10/06/89)
In an earlier message, I pointed out that fdisk has the number
of heads wired in (a variable called NHEAD), but that this can
be changed by using "fdisk -n" where "n" is the actual number
of heads. For example, to partition a disk with 9 heads, one
would say "fdisk -9 /dev/hd5" (if it were a second hard disk).
HOWEVER...it has been pointed out to me that this was a change
to fdisk which was inserted at the 1.4a level, and that people
running an earlier version of Minix do not have such an option.
So, for those with an earlier version of Minix (why in the world
don't you upgrade??!), just change the variable NHEAD and recompile
fdisk.
======================================================================
John Nall Internet: nall@nu.cs.fsu.edu
Computer Science Department Florida State University
"Today, a Moon Moth -- tomorrow, a Sea Dragon Conquerer!!"