Command: fdisk
FDISK creates one or several partitions on a hard disk. After this,
the partitions can be formatted and are ready to work with FreeDOS.
To make them bootable you may have to set an 'active partition' and
to run 'fdisk /ipl' (or: 'fdisk /mbr') and 'sys c:'.
FDISK is not needed for floppy disks!
Syntax:
FDISK [drive#][argument]...
no argument Runs in interactive mode.
/INFO Displays partition information of <drive#.
/REBOOT Reboots the Computer.
Options:
Commands to create and delete partitions:
<size> is a number for megabytes or MAX for maximum size
or <number>,100 for <number> to be in percent.
<type#> is a numeric partition type or FAT-12/16/32 if /SPEC not given.
/PRI:<size> [/SPEC:<type#>] Creates a primary partition.
/EXT:<size> Creates an Extended DOS
Partition.
/LOG:<size> [/SPEC:<type#>] Creates a logical drive.
/PRIO,/EXTO,/LOGO Same as above, but avoids
FAT32.
/AUTO Automatically partitions the
disk.
/DELETE {/PRI[:#] | /EXT | /LOG:<part#> Deletes a partition.
| /NUM:<part#>} ...logical drives start at
/NUM=5.
/DELETEALL Deletes all Partitions from
<drive#>.
Setting active partitions:
/ACTIVATE:<partition#> Sets <partition#> active.
/DEACTIVATE Deactivates all partitions.
MBR (Master Boot Record) management:
/CLEARMBR Deletes all partitions and boot code.
/LOADMBR Loads part. table and code from "boot.mbr"
into MBR.
/SAVEMBR Saves partition table and code into file
"boot.mbr".
MBR code modifications leaving partitions intact:
/IPL Installs the standard boot code into MBR
<drive#>.
...Same as /MBR and /CMBR for compatibility.
/SMARTIPL Installs DriveSmart IPL into MBR <drive#>.
/LOADIPL Writes 440 code bytes from "boot.mbr" into MBR.
Advanced partition table modification:
/MODIFY:<part#>,<type#> Changes partition type to
<type#>. ...Logical drives
start at "5".
/MOVE:<srcpart#>,<destpart#> Moves primary partitions.
/SWAP:<1stpart#>,<2ndpart#> Swaps primary partitions.
For handling flags on a hard disk:
/CLEARFLAG[{:<flag#>} | /ALL}] Resets <flag#> or all on
<drive#>.
/SETFLAG:<flag#>[,<value>] Sets <flag#> to 1 or
<value>.
/TESTFLAG:<flag#>[,<value>] Tests <flag#> for 1 or
<value>.
For obtaining information about the hard disk(s):
/STATUS Displays the current partition layout.
/DUMP Dumps partition information from all hard disks
(for debugging).
Interactive user interface switches:
/UI Always starts UI if given as last argument.
/MONO Forces the user interface to run in monochrome mode.
/FPRMT Prompts for FAT32/FAT16 in interactive mode.
/XO Enables extended options.
Compatibility options:
/X Disables ext. INT 13 and LBA for the following commands.
Comments:
As FDISK creates / deletes partitions, you should handle it carefully.
If you want to make a HD bootable, don't forget to set the 'Active'
flag and to run 'fdisk /mbr' to write the Master boot record on the HD.
FreeDOS supports up to FOUR primary partitions. If you want to
create more than FOUR partitions on a HD you should first create a
maximum of THREE primary partitions, then add ONE (=maximum!) extended
partition and inside of this partition ONE or MORE logical partitions.
To be able to boot from up to four different partitions, you have to
install a system on these partitions (minimum = "sys c: / d: /e: / f:")
and then run fdisk and change the 'Active' flag to another primary
partition. You can NOT boot from logical drives!
FDISK has the following ERRORLEVEL / EXITCODES:
0 Normal program completion, no errors
1 Syntax error
3 Error in the fdisk.ini file
4 Error in the part.dat file
5 Non-existant hard disk
6 Buffer allocation failure
7 Hard disk is already partitioned. (This is only
returned if the "/AUTO" function is used and there are
already partitions other than a Compaq Diagnostic
Partition on the hard disk.)
8 Error reading from or writing to the boot.mbr file.
9 Miscellaneous error. It is best to examine
the output printed to the screen from Free FDISK to
determine the exact cause of the problem.
20 Flag has been set (see /SETFLAG, /TESTFLAG, and
/CLEARFLAG for details)
21 Flag has not been set (see errorlevel 20, above)
The latest version of FDISK (ver 1.3.8) supports NLS.
THE FDISK NLS files can be written in UTF-8!
To compile them you need "regen.bat" that has to be modified
(your language and maybe others have to be added).
Examples:
Example 1:
Making a diskette bootable, version 1:
From an existing bootable HD or CD:
fdisk (is not needed!)
format a: (Formats the diskette so that files can be written).
sys a: The KERNEL (KERNEL.SYS) and COMMAND.COM
will be copied from your bootable HD or CD to A:; after
the execution the diskette will be bootable.
Example 2:
Making a diskette bootable version 2:
From a booted diskette (in drive A:):
fdisk (is not needed!)
format b: (Formats the diskette so that files can be written).
Depending on if you have two floppy drives or not the
format command formats at drive B: or asks you to enter
a new floppy into drive A: and formats from there.
When this is done, insert the original diskette again,
then enter:
sys b: The KERNEL (KERNEL.SYS) and COMMAND.COM
will be copied from your bootable diskette A: to B:,
(same procedure as format b:) after the execution
the diskette will be bootable.
Example 3:
Making a HD bootable:
From an existing bootable diskette or CD:
fdisk (This allows you to create ONE or MORE partitions, see
above; up to FOUR primary partitions can be created.
(If you create four primary partitions the remaining space
of your HD can not be used!) Do not forget to reboot!
Fdisk without options shows a user interface.
fdisk Set ACTIVE PARTITION (only THIS ONE partition can boot,
but you can change this by making one of the three other
primary partitons ACTIVE (there is NO boot manager) with
fdisk. Do not forget to reboot!
fdisk Type FDISK /IPL (or: FDISK /mbr) to update the boot
code, then do not forget to reboot!
format c: Prepares the HD to so that files can be written on
partition C:. You have to do this for all partitions that
you want to use and have prepared with fdisk.
sys c: The KERNEL (KERNEL.SYS) and COMMAND.COM
will be copied from your bootable diskette or CD to C:
Example 4:
fdisk /info
See also:
aefdisk
command.com
errorlevel/exitcode
format
kernel
label
mirror
ranishpm
sys
undelete
unformat
vol
xfdisk
Copyright © 1998-2023 Brian E. Reifsnyder and the FreeDOS
Community, help updated 2023 by W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.