Fdisk

Last updated
fdisk
Developer(s) Robert Baron, IBM, Microsoft, Digital Research, Datalight, Novell, Brian E. Reifsnyder
Initial release1983, 4041 years ago
Operating system MS-DOS, PC DOS, FlexOS, SISNE plus, OS/2, eComStation, ArcaOS, Windows, DR DOS, ROM-DOS, FreeDOS, PTS-DOS, *BSD, [1] SysV
Type Command
License MS-DOS, PC DOS, FlexOS, OS/2, Windows, DR DOS, ROM-DOS, PTS-DOS: Proprietary commercial software
FreeDOS: GNU GPLv2

fdisk is a command-line utility for disk partitioning. It has been part of DOS, DR FlexOS, IBM OS/2, and early versions of Microsoft Windows, as well as certain ports of FreeBSD, [2] NetBSD, [3] OpenBSD, [4] DragonFly BSD [5] and macOS [6] for compatibility reasons. Windows 2000 and its successors have replaced fdisk with a more advanced tool called diskpart .

Contents

Implementations

DOS

IBM introduced the first version of fdisk (officially dubbed "Fixed Disk Setup Program") in March 1983, with the release of the IBM PC/XT computer (the first PC to store data on a hard disk) and the IBM PC DOS 2.0 operating system. fdisk version 1.0 can create one FAT12 partition, delete it, change the active partition, or display partition data. fdisk writes the master boot record, which supports up to four partitions. The other three were intended for other operating systems such as CP/M-86 and Xenix, which were expected to have their own partitioning utilities.

Microsoft first added fdisk to MS-DOS in version 3.2. [7] MS-DOS versions 2.0 through 3.10 included OEM-specific partitioning tools, which may have been named fdisk.

PC DOS 3.0, released in August 1984, added support for FAT16 partitions to handle larger hard disks more efficiently. PC DOS 3.30, released in April 1987, added support for extended partitions. (These partitions do not store data directly but can contain up to 23 logical drives.) In both cases, fdisk was modified to work with FAT16 and extended partitions. Support for FAT16B was first added to Compaq's fdisk in MS-DOS 3.31. FAT16B later became available with MS-DOS and PC DOS 4.0.

The undocumented /mbr switch in fdisk, which could repair the master boot record, soon became popular.

IBM PC DOS 7.10 shipped with the new fdisk32 utility.

ROM-DOS, [8] DR DOS 6.0 [9] FlexOS, [10] PTS-DOS 2000 Pro, [11] and FreeDOS, [12] include an implementation of the fdisk command.

Windows

The fdisk command on Microsoft Windows 95 Microsoft Windows 95 Version 4.00.1111 fdisk command 492x259.png
The fdisk command on Microsoft Windows 95

Windows 95, Windows 98, and Windows ME shipped with a derivative of the MS-DOS fdisk. Windows 2000 and its successors, however, came with the more advanced diskpart and the graphical Disk Management utilities.

Starting with Windows 95 OSR2, fdisk supports the FAT32 file system. [13]

The version of fdisk that ships with Windows 95 does not report the correct size of a hard disk that is larger than 64 GB. An updated fdisk is available from Microsoft to correct this issue. [14] In addition, fdisk cannot create partitions larger than 512 GB, even though FAT32 supports partitions as big as 2 TB. This limitation applies to all versions of fdisk supplied with Windows 95 OSR 2.1, Windows 98 and Windows ME.

IBM OS/2

Before version 4.0, OS/2 shipped with two partition table managers. These were the text mode fdisk [15] and the graphical fdiskpm. [16] The two have identical functionality, and can manipulate both FAT partitions and the more advanced HPFS partitions.

OS/2 4.5 and higher (including eComStation and ArcaOS) can use the JFS file system, as well as FAT and HPFS. They replaced fdisk with the Logical Volume Manager (LVM).

Mach and 386BSD

fdisk for Mach Operating System was written by Robert Baron. It was ported to 386BSD by Julian Elischer, [17] and the implementation is being used by FreeBSD, [2] NetBSD [3] and DragonFly BSD, [5] all as of 2019, as well as the early versions of OpenBSD between 1995 and 1997 before OpenBSD 2.2. [1]

Tobias Weingartner re-wrote fdisk in 1997 before OpenBSD 2.2, [4] which has subsequently been forked by Apple Computer, Inc in 2002, and is still used as the basis for fdisk on macOS as of 2019. [6]

For native partitions, BSD systems traditionally use BSD disklabel, and fdisk partitioning is supported only on certain architectures (for compatibility reasons) and only in addition to the BSD disklabel (which is mandatory).

Linux

In Linux, fdisk is a part of a standard package distributed by the Linux Kernel organization, util-linux . The original program was written by Andries E. Brouwer and A. V. Le Blanc and was later rewritten by Karel Zak and Davidlohr Bueso when they forked the util-linux package in 2006. An alternative, ncurses-based program, cfdisk, allows users to create partition layouts via a text-based user interface (TUI). [18]

See also

Related Research Articles

File Allocation Table (FAT) is a file system developed for personal computers and was the default filesystem for MS-DOS and Windows 9x operating systems. Originally developed in 1977 for use on floppy disks, it was adapted for use on hard disks and other devices. The increase in disk drives capacity required three major variants: FAT12, FAT16 and FAT32. FAT was replaced with NTFS as the default file system on Microsoft operating systems starting with Windows XP. Nevertheless, FAT continues to be used on flash and other solid-state memory cards and modules, many portable and embedded devices because of its compatibility and ease of implementation.

<span class="mw-page-title-main">Disk partitioning</span> Creation of separate accessible storage areas on a secondary computer storage device

Disk partitioning or disk slicing is the creation of one or more regions on secondary storage, so that each region can be managed separately. These regions are called partitions. It is typically the first step of preparing a newly installed disk, before any file system is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk. System administrators use a program called a partition editor to create, resize, delete, and manipulate the partitions. Partitioning allows the use of different filesystems to be installed for different kinds of files. Separating user data from system data can prevent the system partition from becoming full and rendering the system unusable. Partitioning can also make backing up easier. A disadvantage is that it can be difficult to properly size partitions, resulting in having one partition with too much free space and another nearly totally allocated.

<span class="mw-page-title-main">Boot sector</span> Sector of a persistent data storage device

A boot sector is the sector of a persistent data storage device which contains machine code to be loaded into random-access memory (RAM) and then executed by a computer system's built-in firmware.

Disk formatting is the process of preparing a data storage device such as a hard disk drive, solid-state drive, floppy disk, memory card or USB flash drive for initial use. In some cases, the formatting operation may also create one or more new file systems. The first part of the formatting process that performs basic medium preparation is often referred to as "low-level formatting". Partitioning is the common term for the second part of the process, dividing the device into several sub-devices and, in some cases, writing information to the device allowing an operating system to be booted from it. The third part of the process, usually termed "high-level formatting" most often refers to the process of generating a new file system. In some operating systems all or parts of these three processes can be combined or repeated at different levels and the term "format" is understood to mean an operation in which a new disk medium is fully prepared to store files. Some formatting utilities allow distinguishing between a quick format, which does not erase all existing data and a long option that does erase all existing data.

<span class="mw-page-title-main">Multi-booting</span> Act of installing multiple operating systems on a single computer

Multi-booting is the act of installing multiple operating systems on a single computer, and being able to choose which one to boot. The term dual-booting refers to the common configuration of specifically two operating systems. Multi-booting may require a custom boot loader.

<span class="mw-page-title-main">UEFI</span> Operating system and firmware specification

Unified Extensible Firmware Interface is a specification that defines the architecture of the platform firmware used for booting the computer hardware and its interface for interaction with the operating system. Examples of firmware that implement the specification are AMI Aptio, Phoenix SecureCore, TianoCore EDK II, InsydeH2O. UEFI replaces the BIOS which was present in the boot ROM of all personal computers that are IBM PC compatible, although it can provide backwards compatibility with the BIOS using CSM booting. Intel developed the original Extensible Firmware Interface (EFI) specification. Some of the EFI's practices and data formats mirror those of Microsoft Windows. In 2005, UEFI deprecated EFI 1.10.

<span class="mw-page-title-main">GUID Partition Table</span> Computer disk partitioning standard

The GUID Partition Table (GPT) is a standard for the layout of partition tables of a physical computer storage device, such as a hard disk drive or solid-state drive, using universally unique identifiers, which are also known as globally unique identifiers (GUIDs). Forming a part of the Unified Extensible Firmware Interface (UEFI) standard, it is nevertheless also used for some BIOSs, because of the limitations of master boot record (MBR) partition tables, which use 32 bits for logical block addressing (LBA) of traditional 512-byte disk sectors.

In computing, sleep is a command in Unix, Unix-like and other operating systems that suspends program execution for a specified time.

An extended boot record (EBR), or extended partition boot record (EPBR), is a descriptor for a logical partition under the common DOS disk drive partitioning system. In that system, when one partition record entry in the master boot record (MBR) is designated an extended partition, then that partition can be subdivided into a number of logical partitions. The actual structure of that extended partition is described by one or more EBRs, which are located inside the extended partition. The first EBR will always be located on the very first sector of the extended partition.

<span class="mw-page-title-main">TestDisk</span>

TestDisk is a free and open-source data recovery utility that helps users recover lost partitions or repair corrupted filesystems. TestDisk can collect detailed information about a corrupted drive, which can then be sent to a technician for further analysis. TestDisk supports DOS, Microsoft Windows, Linux, FreeBSD, NetBSD, OpenBSD, SunOS, and MacOS. TestDisk handles non-partitioned and partitioned media. In particular, it recognizes the GUID Partition Table (GPT), Apple partition map, PC/Intel BIOS partition tables, Sun Solaris slice and Xbox fixed partitioning scheme. TestDisk uses a command line user interface. TestDisk can recover deleted files with 97% accuracy.

In BSD-derived computer operating systems and in related operating systems such as SunOS, a disklabel is a record stored on a data storage device such as a hard disk that contains information about the location of the partitions on the disk. Disklabels were introduced in the 4.3BSD-Tahoe release. Disklabels are usually edited using the disklabel utility. In later versions of FreeBSD, this was renamed as bsdlabel.

The partition type in a partition's entry in the partition table inside a master boot record (MBR) is a byte value intended to specify the file system the partition contains or to flag special access methods used to access these partitions.

gpart is a software utility which scans a storage device, examining the data in order to detect partitions which may exist but are absent from the disk's partition tables. Gpart was written by Michail Brzitwa of Germany. The release on the author's website is now older than the releases some distributions are using. It appears that Michail Brzitwa does not actively maintain the code, instead the various distributions appear to maintain their own versions.

In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an application program to interact with a device by using its device driver via standard input/output system calls. Using standard system calls simplifies many programming tasks, and leads to consistent user-space I/O mechanisms regardless of device features and functions.

format (command)

In computing, format, a command-line utility that carries out disk formatting. It is a component of various operating systems, including 86-DOS, MS-DOS, IBM PC DOS and OS/2, Microsoft Windows and ReactOS.

<span class="mw-page-title-main">DOS</span> Group of closely related IBM PC-compatible operating systems

DOS is a family of disk-based operating systems for IBM PC compatible computers. The DOS family primarily consists of IBM PC DOS and a rebranded version, Microsoft's MS-DOS, both of which were introduced in 1981. Later compatible systems from other manufacturers include DR-DOS (1988), ROM-DOS (1989), PTS-DOS (1993), and FreeDOS (1998). MS-DOS dominated the IBM PC compatible market between 1981 and 1995.

A master boot record (MBR) is a special type of boot sector at the very beginning of partitioned computer mass storage devices like fixed disks or removable drives intended for use with IBM PC-compatible systems and beyond. The concept of MBRs was publicly introduced in 1983 with PC DOS 2.0.

sfdisk is a Linux partition editor. In contrast to fdisk and cfdisk, sfdisk is not interactive. All three programs are written in C and are part of the util-linux package of Linux utility programs.

References

  1. 1 2 "fdisk(8) — PC slice table (MBR) maintenance program". System Manager's Manual. FreeBSD, NetBSD, OpenBSD, DragonFly BSD.
  2. 1 2 "fdisk — PC slice table maintenance utility". BSD Cross Reference. FreeBSD.
  3. 1 2 "fdisk — MS-DOS partition maintenance program". BSD Cross Reference. NetBSD.
  4. 1 2 "fdisk — partition table maintenance program". BSD Cross Reference. OpenBSD.
  5. 1 2 "fdisk — PC slice table (MBR) maintenance program". BSD Cross Reference. DragonFly BSD.
  6. 1 2 "fdisk.tproj/fdisk.8", macOS 10.14.1, Apple
  7. Wolverton, Van (2003). Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition. Microsoft Press. ISBN   0-7356-1812-7.
  8. "Datalight ROM-DOS User's Guide" (PDF). www.datalight.com.
  9. DR DOS 6.0 User Guide Optimisation and Configuration Tips
  10. http://www.bitsavers.org/pdf/digitalResearch/flexos/1073-2003_FlexOS_Users_Guide_V1.3_Nov86.pdf Archived 2019-09-25 at the Wayback Machine [ bare URL PDF ]
  11. "PTS-DOS 2000 Pro User Manual" (PDF). Buggingen, Germany: Paragon Technology GmbH. 1999. Archived (PDF) from the original on 2018-05-12. Retrieved 2018-05-12.
  12. "ibiblio.org FreeDOS Group -- FreeDOS Base". www.ibiblio.org. Retrieved 2020-06-03.
  13. "How to Use the Fdisk and Format Tools to Partition or Repartition a Hard Disk". Support (6.0 ed.). Microsoft. 28 June 2012.
  14. "Fdisk Does Not Recognize Full Size of Hard Disks Larger than 64 GB". Support (4.0 ed.). Microsoft. 24 August 2012.
  15. "JaTomes Help - OS/2 Commands". Archived from the original on 2019-04-14. Retrieved 2019-06-20.
  16. "JaTomes Help - OS/2 Commands". Archived from the original on 2019-04-14. Retrieved 2019-06-20.
  17. "Fdisk".
  18. Sharma, Deepesh (2021-02-22). "How to Create, Resize and Delete Linux Partitions With Cfdisk". MUO. Retrieved 2023-05-15.

Further reading