Browse Definitions :


What is FDISK?

FDISK is a disk utility included in all versions of MS-DOS, Windows and Linux for formatting or partitioning a hard disk drive, or to delete different portions of it. FDISK is an external utility. It is most commonly used to prepare and partition a hard drive.

Disk partitioning illustration.
What disk partitioning looks like.

Most modern personal computers include drives that are already partitioned and loaded with the operating system (OS) and other software. However, FDISK can be used to create more partitions when you want to change something. It is also used to set up a computer as a dual boot system, with one OS (Windows for example) in one partition and different OS (Linux for example ) in another.

Disk partitioning is also commonly used on local area network (LAN) servers, where different sets of users share different files and applications. The maximum partition size in the first version of DOS to use FDISK was a miniscule 16 MB.

FDISK command in DOS and Linux

Various FDISK commands are used in MS-DOS and Windows computers to create, delete, resize, change and move partitions on the hard drive. For example, FDISK [/STATUS] /X configures a hard disk for use with MS-DOS. Other MS-DOS FDISK commands include the following:

  • fdisk /mbr rewrites the master boot record.
  • fdisk 1/pri:100 creates a 100 MB partition on the hard drive.
  • fdisk 1/log:250 creates a logical drive of size 250 MB.
  • fdisk /status shows the current status of the hard drive (or drives).
  • fdisk /q prevents the FDISK utility from automatically booting the system after exiting.
  • fdisk < fdisk.scr executes an external script file (which is created using the DOS edit command) to quickly create (or delete) hard disk partitions.

In Linux, the FDISK utility facilitates the creation of up to four primary partitions. The partition naming scheme follows the /dev/xxyN form:

  • /dev is the directory where all files live.
  • xx indicates the device type (which contains the partition).
  • y indicates which device the partition is on.
  • N is the partition number.

Some of its common commands include the following:

  • $ sudo fdisk -l to view details of available disk partitions.
  • $ sudo fdisk -l /dev/sda to view the partitions on a specific disk.
  • $ sudo fdisk /dev/sda to create a hard disk partition.
  • $ sudo fdisk -s /dev/sda to view the partition size.

FDISK to manipulate partition tables in Linux

On Linux computers, FDISK provides an interactive interface to manipulate partition tables on a hard disk. The syntax is as follows:

# fdisk [device_name] 
Command (m for help):

The following chart lists the most common FDISK commands to manipulate partition tables:

Command Purpose
fdisk -d Delete a partition
fdisk -m Print the available (FDISK) commands
fdisk -n Add a new partition
fdisk -p Print the partition table
fdisk -w Write the table to the hard drive

Partition tables and script files

The FDISK script file is an external file to quickly create (or delete) partitions on a hard disk. The file is generated using the Edit fdisk.scr command. It is then executed using the fdisk < fdisk.scr command. The script is applied to in-memory partition tables and is compatible with numerous libfdisk applications, including cfdisk(8) and sfdisk(8). It is possible to write the current in-memory disk layout to the script file.

Information about the division of a hard disk into logical partitions is recorded in a partition table. This table usually resides in sector 0 of the disk. After the DISK script is applied to the partition table, the table can be modified before it is written to the device. FDISK understands many types of partition tables, including the following:

  • GPT. It uses 64-bit logical block addresses and checksums for partitions and allows an unlimited number of partitions.
  • MBR (DOS-type). It can describe an unlimited number of partitions, with primary partitions numbered from 1 to 4 and logical partitions numbered from 5.
  • IRIX (SGI-type). It can describe 16 partitions, where the ninth is labeled "volume header" and the 11th is an entire volume partition.
  • BSD (Sun-type). It can describe eight partitions, the third of which is a whole disk partition.

Advantages and limitations of FDISK

FDISK is a powerful utility when there is a need to divide hard drive space into multiple logical drives (partitions). The utility helps to protect data by hiding partitions from other users. It can be used as a boot manager to use more than one OS in the computer.

Repartitioning a hard disk drive using FDISK requires a cautionary approach, especially if the drive contains important data. This is because repartitioning wipes out all data. That's why it's crucial to first back up everything to another storage medium before running FDISK.

Another limitation of FDISK is that you can't move applications from one partition to another without uninstalling and reinstalling the software. It's also not possible to delete or create new partitions without going through the entire FDISK and formatting process again. One way to get around this limitation is to use special partitioning software instead of FDISK. These applications allow you to do the following:

  • Create, delete and resize partitions without losing your data.
  • Move applications from one partition to another without uninstalling and reinstalling the application.
  • Hide partitions to protect data from other users.

Partitioning software can also be used as a boot manager to install and use more than one OS easily. The software also eliminates the need for a BIOS upgrade in older computers.

See how to use Diskpart to create, delete, clean or extend disk partitions.

This was last updated in May 2023

Continue Reading About FDISK

  • Mitre ATT&CK framework

    The Mitre ATT&CK (pronounced miter attack) framework is a free, globally accessible knowledge base that describes the latest ...

  • timing attack

    A timing attack is a type of side-channel attack that exploits the amount of time a computer process runs to gain knowledge about...

  • privileged identity management (PIM)

    Privileged identity management (PIM) is the monitoring and protection of superuser accounts that hold expanded access to an ...

  • employee resource group (ERG)

    An employee resource group is a workplace club or more formally realized affinity group organized around a shared interest or ...

  • employee training and development

    Employee training and development is a set of activities and programs designed to enhance the knowledge, skills and abilities of ...

  • employee sentiment analysis

    Employee sentiment analysis is the use of natural language processing and other AI techniques to automatically analyze employee ...

Customer Experience
  • customer profiling

    Customer profiling is the detailed and systematic process of constructing a clear portrait of a company's ideal customer by ...

  • customer insight (consumer insight)

    Customer insight, also known as consumer insight, is the understanding and interpretation of customer data, behaviors and ...

  • buyer persona

    A buyer persona is a composite representation of a specific type of customer in a market segment.