Program: FDISK.COM Author: John Wilson , D Bit, Troy, NY, USA Version: 1.13 Date: 26-Oct-1999 Description: Program to provide basically the same functionality as the FDISK program supplied with DOS, but using a command line interface rather than menus. This program expects the user to have a least some clue, if you're not familiar with how partitions work in DOS then DON'T USE IT. This program has several benefits over the version supplied with DOS: first is the ability to BACKUP and RESTORE the master boot record to/from a file, so you can keep a backup on a floppy disk in case of damage. Secondly, if the partition table on disk is not stored in order of increasing cylinder numbers (FDISKs supplied with recent versions of DOS store it out of order for some reason), the user is asked if it should be sorted. This can be handy for Linux users, at least older versions of Linux assume the table is sorted which can lead to confusion if /dev/hda4 doesn't really mean the fourth partition (it will after sorting). Conversely, if you you've configured your software so that it's dependent on the partition table *not* being in order, the ORDER command can put the table entries in any order. Third, this FDISK will write any user-specified "type" code in the partition table, not just the handful used by DOS, so it can be used to create all kinds of foreign partition types (but it doesn't know how to create a file system in the partition so you still need FORMAT.COM or mke2fs or whatever!). Using the program is straightforward, use its HELP command to find out the command names and syntax. Only one partition table (from the master boot record, or a DOS extended partition) may be loaded in memory at a given time, and all changes are performed on the copy in memory. It is not written to disk unless a WRITE command is issued, or the user answers YES to the prompt asking whether to write it if it has been modified and a command that would destroy the buffer contents (QUIT, READ, RESTORE) is issued. Since only one table is manipulated at a time, the ugliness of the DOS extended partition's inner workings are not hidden from the user, so I'll explain how that works (at least, in PC-DOS 6.1): the "extended partition" in fact works as a linked list. The master boot record shows the entire extended partition in one entry. The beginning of that partition starts out kind of like an entire disk drive -- there's a partition table (no boot code though) at head 0 sector 1 of the first cylinder of the extended partition, and the first logical drive starts at head 1 sector 1 of that cylinder (so sectors 2 and up of head 0 are wasted, or used for viruses etc.!). However in this case the partition table doesn't describe the whole drive or even the whole extended partition, it has an entry describing a logical drive (the one starting at head 1), and optionally *another* "DOS extended partition" entry which describes the next logical drive in the chain (including *its* partition table at head 0 sec 1 of the first cylinder). Since this FDISK only looks at one partition table at a time, it won't catch you if you try to create overlapping drives in separate entries in the extended partition chain. So don't! If you aren't messing with DOS extended partitions then don't worry about any of this. Note that although this FDISK can create DOS partitions, it doesn't know how to write an empty file system on them so you'll need to reboot the machine (so DOS recognizes the new partition and creates a drive letter for it), and then use FORMAT to initialize it. Newer DOS-supplied FDISKs have this part of the FORMAT function rolled into them but this FDISK is aimed more at non-DOS users anyway, if you're doing an all-DOS disk you might as well just use the FDISK that came with DOS. FDISK can either be run interactively, or you can specify a single command to be executed on the DOS command line. E.g. if you type "FDISK CREATE LINUX 100%" it will create a Linux partition using 100% of the first free area, and then quit (prompting you before writing the partition table back to disk as part of quitting). Disclaimer: This program is supplied without warranty of any kind, the author shall not be held responsible for damage or loss caused by its use. Be sure to backup your entire disk before messing with partitions, regardless of whose FDISK you use.