Rob van der Woude's Scripting Pages
BE CAREFUL: This machine has no brain, use your own

FDISK

With FDISK you can create or delete harddisk partions or logical drives.

First of all, let me explain what I mean by partitions or logical drives.
The term partition is often used when logical drive is meant, just as the term disk is often used when partition or logical drive is meant.

When I use the word disk, I mean the physical harddisk: a piece of hardware installed (I hope) in your computer. A harddisk needs to be partitioned - divided into partitions - to be of any use.

A partition is no more than an entry in the partition table, which is located at the very "beginning" of the hard disk's storage space.
Each entry in the partition table specifies the starting and end positions of the partition, the type, size and file system of the partition.
Each disk can only contain 4 partitions!

To overcome this limitation, the extended partition was introduced.
An extended partition can be subdivided into many logical drives, whereas the original primary partition can only contain 1 single logical drive.
The logical drive is what is usually referred to as drive or partition, and will usually be assigned a drive letter C: through Z:

This brings us to the next limitation in disk partitioning:
Each extended partition can only contain 24 logical drives.
Why 24?
Because logical drives can only be assigned a drive letter C: through Z:. C: is always reserved for the active primary partition, so if you have one or more primary partitions on the same disk, the number of logical drives in the extended partition is even limited to 23.

Note that this limitation no longer applies for Windows 2000 and XP, these Windows versions do not need drive letters for each partition.
Neither did this limitation ever apply to Unix/Linux, since they do not, nor ever did, use drive letters at all.

Say your disk has 3 primary partitions and 1 extended partition. Only 1 primary partition can be active and will be assigned drive letter C:. The other 2 primary partitions will not be assigned a drive letter and are "invisible" to the running operating system.
Logical drives in the extended partition will be assigned drive letters D: through Z:, 23 at maximum.
If a second harddisk is used, an active primary partition on that disk will be assigned drive letter D:, which leaves only 22 drive letters for the extended partitions on both disks.

I know it sounds pretty outdated and obscure, but if you can get a copy of OS/2 2.0 or 2.1's installation guide, it contains a detailed description of harddisk partitioning, that is valid for all Intel based computers and operating systems.

I found most of the undocumented options for MS-DOS' FDISK on Michael Jacobsen's Undocumented FDISK page, which — unfortunately — seems to be discontinued.
However, a copy is still available here.
For obvious (I hope) reasons I did not test all options, yet.
Be carefull, only experiment on systems that need to be reinstalled anyway.

More information on FDISK can be found at FDISK.com's FDISK page

 

MS-DOS' FDISK Options
Option Function Remarks
/ACTOK Allow a partition on second or third drive to be set active Info provided by J.W. Rebel, SysAdmin Godgeleerdheid, Vrije Universiteit Amsterdam
/EXT:size disk Create extended partition  
/FPRMT Prompt for FAT32/FAT16 for each new partition in interactive mode.
Skip FDISK startscreen about support for large disks.
The prompt for FAT16/FAT32 will be available for ALL partitions, so this option can be used to force FDISK to create FAT 32 partitions smaller than 540Mb
/LOG:size Create logical drive [1] Can only be used with /EXT
[2] Default FAT16 for partitions up to 512MB, FAT32 for larger partitions
/LOGO:size Create logical drive with FAT16/FAT32 override [1] Can only be used with /EXT
[2] Default FAT16
/MBR Write new Master Boot Record Functionally equivalent to /NEWMBR in OS/2
 /PARTN    This switch was never available for FDISK, but made it to several sites, including this one.
Thanks for Daniel B. Sedory (a.k.a. The Starman) for the correction.
/PRI:size disk Create primary partition Default FAT16 for partitions up to 512MB, FAT32 for larger partitions
/PRIO:size disk Create primary partition with FAT16/FAT32 override Default FAT16
/PRMT Prompt for action  
/Q Skip forced reboot on exit  
/STATUS Display partition information Functionally equivalent to /QUERY in OS/2
/X Do not use LBA partitions  

 

Unfortunately, there seems to be no way to delete existing partitions with MS-DOS' FDISK.
Older versions of Symantec Ghost came with a utility called GDISK, a completely "scriptable" FDISK replacement. GDISK can wipe partitions. However, as far as I know, GDISK is no longer being sold.

You could, of course, use OS/2's FDISK. No need to install the entire OS, the boot diskettes that came with OS/2 are sufficient:

 

OS/2's FDISK Options
Option Function Remarks
/CREATE Create a new partition Always specify /VTYPE
/DELETE Delete a partition  
/DELETE:ALL Delete all partitions  
/DISK:disk Specify the fysical disk (starting at 1)  
/FSTYPE:fstype Specify the file system (FAT or HPFS)  
/NEWMBR Write new Master Boot Record Functionally equivalent to /MBR in DOS
/QUERY Display partition information Functionally equivalent to /STATUS in DOS
/SETACCESS Make primary partition the active one  
/SIZE:size Specify size of partition in MB  
/START:start Specify starting position of partition in MB Starting position in MB from beginning of disk, unless combined with /CREATE, then specified in MB from beginning of free space
/STARTABLE Make primary partition startable  
/SYSTEM Create a system partition, containing the OS loader files (like Boot Manager)  
/VOLID:volid Specify the volume ID (10 digit number) of a partition  
/VTYPE:type Specify partition type:
1 for a primary partition
2 for a logical drive on an extended partition
3 for free space, available to new partitions
4 for unused space
 

 

ChkFdisk is an example using OS/2's FDISK options to check and change the active partition at bootup.


page last modified: 2011-03-04; loaded in 0.0058 seconds