A traditional disk in the MBR format will have some code at the beginning, followed by a number of partitions that are defined by a “partition table”. The most common size for a partition table is 64 bytes (512 bits). A partition is defined by a “partition table entry”, a.k.a. a “partition table record”. Each of these entries/records is 16 bytes, so four of them may fit in a partition table that is 64 bytes long.
An MBR may not have a specific signature to detect (although bootable disks should have a signature which is sometimes referred to as the “magic” signature). In general, if the MBR is not filled with zeros, data in the first sector is commonly using a traditional MBR-style format except in cases where a specific other format is detectable from the MBR data.
- Non-MBR formats that use an MBR structure
There are some newer formats (GPT, and Microsoft's “Dynamic Disk” format) which may use specific values for some bytes in the MBR. If the data in an MBR is consistent with one of the other disk formats, then chances are higher than not that the data is stored in a different format. Software that writes to an MBR would be doing good by detecting these alternate formats, and being aware that changing the MBR might affect these alternate disk layouts.
- One partition of type 0xEE will be shown to contain the entire disk, if the disk is less than 2TB, or else will show as taking up (about?) 2TB. For further details, see the section about GPT.
- Dynamic Disks created by Microsoft Windows (Server/Pro)
- Disks that have the MBR specify a partition type of 0x42, especially if all other partitions are of type 0x42 and/or 00 and/or 05, may be using a format that Microsoft calls “Dynamic Disks”.
- The format of a boot record
This details in this section provide more information than what is typically needed by most end users, or even technicians who create partitions and install operating systems. Specialized tools are often used to set up partitions, and they may take care of the task of writing necessary data to the correct specific locations. However, some people may be interested in knowing how data is laid out on the disk.
- Beginning of a boot record
The MBR contains starts by containing (assembled) machine code that gets executed when the system starts up. The precise length of this code, and how it operates, may vary. (In the case of a boot manager, it could even be interactive, allowing a user to determine what code will be run next.)
In a Partition/Volume Boot Record (“PBR”/“VBR”), these bytes may contain code meant for loading an operating system.
In an “extended partition”, the drives are traditionally not bootable. In this case, Wikipedia's article on “Extended boot record”: “Structures” section would indicate that this code is typically filled with zeroes.
Previously, this section did describe at least some of the first 446 bytes. After reviewing some technical documentation a bit further, the documented information was actually describing a PBR, and so the information has been moved to the section about PBRs.
- Variations: Usage of other bytes up through byte 446
Some different operating systems will use the data before the first four standard primary partitions in different ways.
- [#mbrfvprt]: More than 4 primary partitions
Despite all of the documentation that says no more than 4 primary partitions may exist, and despite how official some of that documentation may seem, the fact is that using more than 4 4 primary partitions on an MBR-style partition is entirely possible. The limitation of 4 primary partitions is simply a limit that is agreed upon by the makers of many popular operating systems. However, some operating systems have supported more than 4 partition tables. So the rather unnecessary limit of 4 primary partitions is simply a limit imposed by some operating systems (and, in fact, many operating systems), but not others.
Note, however, that most modern popular software that involves interaction with a partition table, including software which is part of an operating system and also including third party software that interacts with partitions, will be limited to 4 primary partitions on drives using an MBR. Therefore, trying to use more than 4 primary partitions on such drives may often result in some of those partitions not being likely to work well with many operating systems and other software.
As a breif side note, MSDN: Using GPT drives identifies that up to 128 partitions can be supported on drives using a GPT. So, discussions of small limits to the number of primary partitions is likely related to how MBR partitions are formatted.
Examples of support for more than 4 primary partitions on an MBR include the following:
- NEC's release of MS-DOS 3.3
- NEC MS-DOS 3.3 (which might use partition type 0x24 per a List of partition types) has been documented to support up to 8 primary partitions. This is documented by Boot Records (section about DOS 3.30) and similar/related pages: DOS 3.3 and DOS 3.3 mirrored.
- AST (“locally sectored”)
- AST MS-DOS 3.x (which might use partition type 0x14 as an AST DOS “logically sectored FAT” drive, as noted by a List of partition types) may support more than 4 partitions, according to Wikipedia article on MBR and/or Andries Brouwer's “Partition types: Properties of partition tables”, section 2.8 (section called “Structure of the MBR - OS Additions”).
- [#ptsfivpt]: PTS-DOS
“Partition types: Properties of partition tables”, section 2.9 (“The Advanced Active Partition” of PTS-DOS) may have added some intentional support for a 5th partition which involves using the “boot flag” byte more than some other operating systems.
In all probability, operating systems that do not support a 5th partition will probably be happy to ignore the data in the unrecognized partition, which would probably be what the other operating systems identify as the first partition. As long as typical rules are being followed, like not having partitions overlap, using more than 4 partitions will probably work fine in the operating system that supports the extra partition(s). However, the unrecognized partition(s) will probably not be supported by the boot loaders that are bundled with the other operating system, so code from a supporting operating system will probably be needed to be booting into one of the partitions that is not recognized by many other pieces of software.
- Disk signature
There may be a 32-bit disk signature starting at the 441st byte. (That leaves a two byte gap between the disk signature and the first traditional partition table entry.) Wikipedia's article on the Master Boot Record indicates this may normally be NULL.
Possibly related: MS KB 227704
Andries Brouwer's “Partition types: Properties of partition tables”, section 2.8 (section called “Structure of the MBR - OS Additions”) refers to NT having a “disk signature”/“volume ID”/“Drive Serial Number” at 0x1b8. The page states, “It is used to map drive letters to disks: in the HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices registry item the drive letter is coupled with this disk signature. It is used as a disk label to map disk info to disks in the HKEY_LOCAL_MACHINE\SYSTEM\DISK registry item.” If the value is zero, then “This signature is generated by the Disk Administrator when it initializes the disk”. (“it” must be referring to Disk Administrator software.) This same web page also notes Win2K/XP and Linux use this ID.
OpenBSD's support (or non-support?) of this: http://ftp3.usa.openbsd.org/pub/OpenBSD/src/sys/arch/amd64/stand/mbr/mbr.S does document the NT sector, http://ftp.fr.openbsd.org/pub/OpenBSD/src/sbin/fdisk/fdisk.8 says “Note that this option will overwrite the NT disk signature, if present.” (But that doesn't seem to be OpenBSD's “manual page” for
Andries Brouwer's “Partition types: Properties of partition tables”, section 2.8 (section called “Structure of the MBR - OS Additions”) provides some of the uses, such as DR-DOS's password stored at offset 0x1b6.
- Bytes 447-510: Standard “partition table entries”/“partition records”
Four partition table entries/records, each of which is sixteen bytes. (Note that the 447th byte may often be referred to as byte number 446. This is simply because a zero-based numbering scheme is used, which means that the first byte is assigned the number zero. Using this same numbering method, the last byte, which is the 512th byte, would be called byte number 511. The next byte would be past the end of the last partition table entry/record, past the end of the partition table, and past the end of the MBR.)
Sources: Wikipedia's article on structures. TechNet: Windows XP Pro RK: Troubleshooting Disks and File Systems looks like it may have some of these same details.
The partition table entries/records represent:
- [#partblaf]: Byte 1: Contains the “Active” flag
Partition types: Properties of partition tables indicates that older DOS versions look for a value of 0x80 or 0x00, while newer DOS versions might just look at the seventh bit.
Andries Brouwer's “Partition types: Properties of partition tables”, section 2.9: “The Advanced Active Partition of PTS” indicates that the whole byte is used usefully by that operating system. The byte is used as a device ID, and so if the value is at least 0x80, it points to the hard drive that has the code that should be run. Booting off of a second hard drive is, therefore, possible with this operating system.
Many partition modifying programs will only set the flag active on one partition, clearing that flag from any other partitions when it does so. Not all do: It is possible to set multiple partitions to have a flag active if using OpenBSD's
Partition types: Properties of partition tables discusses a possible alternate use.
- Bytes 2-4: Starting CHS
As derived from Wikipedia's article on disk partitioning, backed up by Ralf Brown's info on INT 19: section on partition table entry records
- Byte 2 (bits 17-24)
- Bytes 3 and 4
- Bits 25-30: sector info, Bits 31-40: cylinder info
(This limit may be discussed in slightly more detail in the section on MBR: LBA Starting Sector.)
- [#mbrprtyp]: Byte 5: The partition “type” identifier value
The “type” of partition is typically used by an operating system to determine what kind of filesystem(s) is/are likely to be included in a partition.
For information about how the values are commonly used, see details in the section about interacting with the MBR Disk Partition Type Identifier.
To tasks of seeing the values and/or changing the values are commonly provided by many programs that work with hard drive partitions. The
programs that come bundled with various versions of MS-DOS (and possibly other DOS operating systems) may be common exceptions to this generalization. (The solution is simply to use other software.)
GNU GRUB documentation: section titled “parttool” mentions modifying a partition by setting “the hidden bit in its partition type code”. Presumably that would be the 4th bit, as there are over half a dozen partition types (1, 4, 6, 7, B, C, E) that are widely identified as “hidden” by increasing the value by 16. (However, the author of this text has not found any additional authoritative source that specifies that the 4th bit is officially called the “hidden” bit of a partition type code.)
[#mbrenchs]: MBR: Ending CHS details
Bytes 6-8: Ending CHS
As drived from Wikipedia's
article on disk partitioning:
- Byte 6 (bits 17-24)
- Bytes 7 and 8
- Bits 49-54: sector info, Bits 55-64: cylinder info
MBR: LBA Starting sector:
Bytes 9-12: Starting sector (in LBA format)
4 octets are used to identify which sector is used as the start of a partition. 4 octets, storing 32 bits, could 4,294,967,296 possibilities, and since zero is one of the possibilities used, the starting sector could be anywhere from zero to 4,294,967,295.
Many people have identified that an MBR does not support disks above 2TB. Well, that is... um... kind of true. Presuming 512 byte sectors, which has been the most common implementation before GPT usage became widespread, partitions can only start up to approximately 2TB. The latest sector that could start a partition would be sector 4,294,967,295 which is byte 2,199,023,255,040, which is 512 bytes short of the 2TB mark.
Then, the partition size does not support partitions longer than approximately 2TB. So a partition that started at sector 4,294,967,295 (just short of 2TB) and had a size of 4,294,967,295 sectors could go up 8,589,934,590 sectors of 512 bytes each, with a result of the latest byte being byte number 4,398,046,510,080, which is 1 KB (1,024 bytes) less than 4TB. However, there would be no way to start a partition on the third TB of the drive (even if the partition was only a smaller fraction of the drive's capacity, like a 1TB partition). Also, a 3TB partition would not be possible (even if the partition started at the beginning of the drive). So drives over 2TB will not have all of the space be as easily usable as the first 2TB of space.
Some of these numbers are based on the idea that a sector is 512 bytes. PDF (archived by the Wayback Machine @ Archive.org) states:
Enterprise drives (Parallel SCSI/SAS/FC) support 520/528 byte “fat” sectors
So some drives have been known to have 528 bytes per sector. Then, “Advanced Format” drives have been known to have more bytes, like 4KB, per sector. (More information on AF may be found from IDEMA's “Advanced Format” Technology Committee, IDEMA's Advanced Format (AF) Technology, and Wikipedia's page for “Advanced Format”.) In theory, larger capacities could be achieved with a typical MBR by using larger sector sizes. In reality, if a system isn't supporting GPT, chances seem high that the system won't be flexible enough to work with various sector sizes, so that probably won't work any better. (Some information, which might be related, may be found at Wikipedia's page for “Advanced Format”, “512e” section.)
- Bytes 13-16: Partition size
Some partition software may have a certain mode that allows the viewer to see what the last sector is. This isn't directly stored in the partition table, although it can be calculated based on the starting sector and the size.
- [#btrcxtdp]: Boot records that define an “Extended partition”
In an “extended partition” used by MS-DOS and similar operating systems (like Windows 98 or OS/2), the first partition table entry/record defines the boundaries of a partition. (Official documentation usually calls such a partition a “logical drive”.) Unless this boot record is describing the last logical drive, the second partition table entry/record of this type of boot record will point to the sector where there is another boot record. Wikipedia's entry on “Extended boot record”: “Structures” section indicates that all other partition entries (the third and fourth entry on each boot record) are zeroes. This Wikipedia article cites TechNet: Windows XP Pro RK: Troubleshooting Disks and File Systems, although the cited source seems to indicate that the third and forth “Extended Partition Table Entries” (in each “Extended boot record”). Also, this TechNet documentation indicates that for the last Extended boot record's partition table where “no additional logical drives exist”, the “Second” partition table entry “field is not used.” (Archived Content from the Wayback Machine @ Archive.org: TechNet: Basic Disks and Volumes Technical Reference: “How Basic Disks and Volumes Work” also has this same sort of information.)
- [#mbrbtmgc]: 511th and 512th bytes: Magic signature
On a bootable drive, the last bits are typically set to a value known as the “magic” signature for bootable devices, and that specific value is “0101 0101 1010 1010”. That translates to 0x55AA.
Many documentation sources discussing these bytes will document the bits as they are seen in memory after these bytes are read as a sixteen bit value on a “little endian” platform. That method of reading essentially reverses the bytes, so the first byte 0xAA comes before the second byte, 0x55, when memory contents are viewed. So, if software reports a signature of AA followed by 55, that usually means the contents on the disk are actually (the more commonly desired value of) 0x55AA. (An example of this confusion being noted can be seen at Wikpedia's article on “Volume boot record”: note about 0x55AA vs 0xAA55.)
Most documentation seems to indicate that these bytes just indicate the drive is bootable. e.g.: Wikipedia's article on “Volume boot record”, “Signature” section says, “The presence of an IBM PC compatible boot loader for x86-CPUs in the boot sector is by convention indicated by a two-byte hexadecimal sequence called the boot sector signature (55h at fixed offset +1FEh and AAh at +1FFh) for sector sizes of 512 bytes or more.” (So, if the drive does not have a boot loader present, then it is not bootable.)
Although TechNet: Windows XP Pro RK: Troubleshooting Disks and File Systems states, “At the end of the MBR is a 2-byte structure called a signature word or end of sector marker, which is always set to 0x55AA.” This is not accurate. That is only for bootbale disks. Wikipedia's “Design of the FAT file system”: “Boot sector” also discusses these bytes as indicating whether the system is bootable.
The “boot flag” byte is documented to have had a special meaning by PTS-DOS. “Partition types: Properties of partition tables”, section 2.9 (“The Advanced Active Partition” of PTS-DOS) documents this.
Wikipedia's “Design of the FAT file system”: “Boot sector” notes that if the checksum has a total value of 0x1234, then that affects bootability on Atari ST systems.
- [#xnddprtn]: An “Extended Partition” (which may hold “logical drives”)
An extended drive may use one or more Partition Boot Records. Some more text, later, does provide some information about the bytes in the Partition Boot Records. First, this text is now going to discuss some other details about extended partitions. By placing that information here, right after details about the MBR, many of the details about partition locations can be near each other details about partition locations.
- Number of extended partitions on one drive
Some documentation will state that there may only be one extended partition per drive. Many
programs will not create a second extended partition.
From “The Linux Documentation Project” website: a web page about large disks states, “It is possible to have two extended partitions in one of these partition table sectors so that the partition table chain forks. (This can happen for example with an
that does not recognize each of 5, F, 85 as an extended partition, and creates a 5 next to an F.) No standard
type program can handle such situations, and some handwork is required to repair them. The Linux kernel will accept a fork at the outermost level. That is, you can have two chains of logical partitions. Sometimes this is useful - for example, one can use type 5 and be seen by DOS, and the other type 85, invisible for DOS, so that DOS
will not crash because of logical partitions past cylinder 1024.”
Note, though, that playing around with such varying limitations is generally a recipe for difficulty. Presumably this is done to try (unsuccessfully?) to prevent even worse disaster. (For instance, the quoted text notes that many
type software has no real ability to “handle such situations” well.) Although there seems to be little reason why this limit had to exist, it does seem to exist with some software, so expect troubles if this limitation isn't heeded.
MSDN: Using GPT drives discusses some differences between MBR and GPT, and notes, “Master Boot Record (MBR) disks can support up to four primary partitions and an additional 124 partitions inside extended partitions.” (Of course, an MBR could have more than 4 primary partitions, depending on the operating system. However, the limit of 4 primary partitions is a limit that Microsoft generally imposes.)
Frequently asked questions about the GUID Partitioning Table disk architecture noted, “Only one extended partition can be present on any given drive, and the maximum number of logical drives is MAXULONG/4.” Based on the above quotes, it would seem that MAXULONG is 124*4=496. However, MAXULONG is probably intending to reference 4,294,967,295 (as noted by ULONG_MAX documented at http://www.cplusplus.com/reference/climits/) so we actually have some apparent inconsistency in documentation.
- Actual disk layout of extended partitions
- Software displays may not portray realities on disk
A lot of documentation about partitions may refer to an “extended partition”, and then the partition can have a number of “logical drives”.
When understanding how this information is stored on the disk, the easy way to think of this is not to think of the “extended partition” as a single partition. Instead, each “logical drive” has its starting location and boundaries stored in a boot record, just like how this type of information is stored in the MBR. The first sector of each logical drive is a “partition boot record”. (Partition boot records are described more in a later section.)
When a piece of software supports the concept of an extended partition, the software will notice that a partition in the MBR uses one of the type identifiers that specifies an extended partition. In that case, the software looks at the first PBR of the first logical drive, and sees what sector that drive starts on. The PBR of each logical drive, except the last logical drive, will point to another PBR. (Many computer programmers will refer to this sort of data structure, with each item in a collection pointing to the next item in a collection, as a “linked list”.)
After collecting information about each of the logical drives, many pieces of software will then show that information as if there is just one “extended partition” that contains all of the logical drives. Displaying the information like that may cause the software to match documentation that tells end users that there is an “extended partition”. However, portraying the information in this way might not be a very clear way of explaining just how the information is stored on the disk.
A lot of software that deals with logical drives will hide the complexity to the end user. According to the documentation and the interface of much of the software, it may look like there is one (generally large) “extended partition”, and then logical drives somehow exist within the extended partition.
The reality is this: The first data area of an “extended partition” is simply a partition referenced in the MBR just like any primary partition. What makes an extended partition unique are two things. First, the partition “type” identifier is one of a small number of values that have been used by Microsoft operating systems to store these “extended partitions”: Either 0x05, 0x0F, or 0x0C (listed in the chronological order based on when each of these types commonly started being used). From “The Linux Documentation Project” website: a web page about large disks indicates that 0x85 may be another possible way to specify an extended partition.
Secondly, the boot records of extended partitions may have information that point to another section of the disk. (The implementation is generally called a “linked list” because the implementation so closely resembles how a “linked list” works, which may be an intermediate to advanced topic for computer programmers.) In a standard extended partition created by sane software that enforces restrictions on how the data is laid out, each data segment referenced by these boot records will be laid out consecutively, in order. So, the “extended partition” is the disk space used by all of the disk segments.
The individual segments of the disk that are part of the “extended partition” may be called a “logical drive” (or perhaps the term “logical drive” only applies after the data has been formatted?)
Some software does allow the user to see the individual bootblocks and see how the data partitions are actually laid out. This can include OpenBSD's
. In other operating systems,
(followed by a device name) for Linux can accomplish the task of showing the actual layout.
- [#mbrdspbr]: Partition Boot Records
The term “partition boot record” is used by OpenBSD's manual page for the i386 boot process (and OpenBSD manual page for AMD64 boot process). There are other names for PBRs, such as VBR (“volume boot record”, e.g.: Wikipedia's page for “Volume Boot Record”. TechNet: Windows XP Pro RK: Troubleshooting Disks and File Systems: section titled “Disk Sectors on MBR Disks” uses the phrase “boot sector”, and notes that such a sector “resides at sector 1 of each volume.” Unfortunately, it seems that key people didn't standardize the terminology very well, because Wikipedia's page for “Volume Boot Record” lists even more terms: “volume boot sector” and “partition boot sector”.
Arguably, the actual record could be considered to be the data, while the sector is the actual disk space. However, the first sector on older disks has a long tradition of being called a “master boot record” (“MBR”), and so PBR or VBR simply follow that pattern.
The term “boot sector” (which, as noted above, has been used by at least some Microsoft documentation) is disfavored as many people will consider the MBR to be a boot sector, and so the term “boot sector” seems less clear than PBR.
- Code at the start
TechNet: Windows XP Pro RK: Troubleshooting Disks and File Systems provides some explanation of what some early code may do. (This documentation is likely designed for Win XP Pro. Once again, it should be mentioned that the exact nature of this code may vary between different operating system, including different releases/versions of an operating system.)
TechNet: Windows XP Pro RK: Troubleshooting Disks and File Systems provides some explanation of what this early code may do. (This documentation is likely designed for Win XP Pro. Once again, it should be mentioned that the exact nature of this code may vary.)
The following breakdown of bytes comes from Microsoft KB Q140418: Detailed Explanation of FAT Boot Sector which applies to Windows NT 3.x. This breakdown provides some precise details from some documentation by Microsoft, but realize that major variations are definitely possible. The reality may vary significantly between operating systems and may have little to nothing in common with what is documented in the following detials. For instance, Windows Embedded CE 6.0 R2's new x86 BIOS Boot Loader changes the BPB section. (However, it would not be surprising at all if some operating system versions, especially many of Microsoft's and IBM's early operating systems, may have some similarities to the following documentation.)
- Bytes 1-3
- The first 3 bytes are a “jump” instruction according to Microsoft KB Q140418: Detailed Explanation of FAT Boot Sector.
- Bytes 4-11 (8 bytes)
- Microsoft KB Q140418: Detailed Explanation of FAT Boot Sector documents this as being an “OEM ID”.
- Bytes 12-36 (25 bytes): “Basic Input/Output System Parameter Block” (“BIOS Parameter Block”) (“BPB”)
Microsoft KB Q140418: Detailed Explanation of FAT Boot Sector documents these. (Note that the table starts with an offset of 11; that corresponds to byte number 11 when using a zero-based count, which this documentation calls the 12th byte.)
- Bytes 37-62 (26 bytes): extended Basic Input/Output System Parameter Block (“extended BIOS Parameter Block”, “extended BPB”)
- Microsoft KB Q140418: Detailed Explanation of FAT Boot Sector documents this. (Note that the table starts with an offset of 36; that corresponds to byte number 36 when using a zero-based count, which this documentation calls the 37th byte.)
- Code to perform common tasks
At some point, generally after other data stored at the beginning of the boot sector, additional code (beyond just the first JMP instruction) may perform certain tasks.
MSDN Documentation: x86 BIOS Boot Loader is about Windows CE devices but much of the data may be similar/identical to standard PCs. (Webmaster note to self: Should some of this info be moved to System Start page? Should this page link to that one, and vice-versa?) One common task is to report an error, namely if the boot loader isn't found. “Microsoft KB Q140418 notes, “Typical text strings on FAT volumes formatted by MS-DOS include: "Invalid system disk."; "Disk I/O error."; "Replace the disk, and then press any key"; "Non-System disk or disk error"; "Replace and press any key when ready."; and "Disk Boot failure." Text strings on FAT volumes formatted by Windows NT include: "BOOT: Couldn't find NTLDR."; "I/O error reading disk."; and "Please insert another disk." You should not regard this list as being all-inclusive.”
- Partition data
- If the Partition Boot Block is in an Extended Partition, bytes 447-462 may hold information about a logical drive. When there are multiple logical drives, each will have a PBR, and so bytes 463-478 in most PBRs will simply point to another PBR, thereby creating a collection of sectors that act as PBRs for the logical drives. (This type of collection is what computer programmers call a “linked list”; each item in the collection simply points to the next item. In this case, the collection is a “linked list” of PBRs.) The structure of information about these bytes is interpreted like bytes 447 through 510 of an MBR.
- [#mbrprted]: Software to manipulate partitions
- [#zfrstsct]: Warning: Possible/certain destruction of data in the first sector
Some partition-modifying software, especially the
software that comes with DOS, may erase the first sector of a newly created partition. Often the official documentation for operating systems that have software that do this may assume that any newly created partition should be considered blank, and used from scratch.
Though the practice of erasing the first sector may frequently be the case, some partition-modifying software (which might come pre-bundled with other operating systems) may be very capable of creating a partition boundary around an already-existing filesystem without destroying any of the data of the filesystem. This capability may be needed only very rarely, but when it is used, the capability to make modifications without losing all of the data on the entire filesystem can definitely be very nice!
Software which does not overwrite the first sector of a partition may or may not lead to compatibility issues with other software, mainly DOS's
command. For further information about this compatibility issue, see section about making a filesystem: subsection noting requirements of a partition's first sector, which discusses an expectation of having such a sector's bits being cleared to zero. To prevent any such issues, some software may overwrite the first sector of a partition. Rarely, this step may be optional. More commonly, software that does overwrite such data may do so without any prior warning! This could potentially be quite the nasty surprise to somebody used to dealing with software that does not perform this destructive act.
Other software, such as
programs in Linux, may have code to destroy such data, so this issue is not limited to just DOS (even if the primary motivation for such actions might be to support DOS).
If software does not destroy the first sector's data, but if clearing those bits is desired, then manual destruction of any bits set to one may be manually performed. In Unix, assuming 512-byte sectors (which is generally a safe assumption), this may be doable with “
”, where the
is the name for the virtual device that references the partition.
- Understanding some of the information better
If the concepts of hard drive geometry, Cylinders, Heads/Tracks, Sectors per Track, and offsets are unclear, then the section on “OpenBSD
Partition Report” is recommended. This section provide details that help to explain OpenBSD
, as well as other software that shows such extensive details (or, at least, can show such extensive details), such as Ranish Partition Manager.
- Text mode options
Those looking for an easy solution may want to look at
(eXtended FDisk). If the computer is capable of running a 16-bit DOS program, that may be a pleasant solution for offering an interactive experience.
One of the best rivals to XFDisk may be Ranish Partition Manager, which provides more details about a disk. However, it is also a 16-bit DOS program, which may not help if an x64 system is having troubles running such old code.
Many operating systems will come with a copy of a program called
. This included
program may not be the easiest software to use, nor the safest (as some
programs may even have a bug or two, despite the fact that the role performed by this program is highly critical), but there is the convenience of coming with the operating system. The
software is traditionally (and perhaps always, at least in common practice) text mode.
Since DOS only modifies the partition table when the system starts up, do plan to reboot the machine after making any changes to the partition sizes (or perhaps partition types). Doing otherwise may lead to some instability or other such problems.
This software has historically been used because it was bundled with the operating system. Other programs, including XFDisk, may provide a more pleasant experience in many cases. The primary advantage to this software is just that it is often bundled in the operating system. (So, after installing the operating system, this
software may often be pre-installed.)
software by IBM is likely to be similar to Microsoft's
software. (Actually, such software may also be quite similar to offerings by other organizations. However, Microsoft and IBM had been sharing source code, so their offerings in particular may have often had a lot of the same characteristics, including limitations/bugs.)
In general, more pleasant experiences are likely by using software other than Microsoft's
command. If Microsoft's
is desired, the best bet is to use the latest available code.
The latest downloadable update is from Microsoft KB Q263044. This update provides an executable file that may be run within Microsoft Windows to place the extracted file into Windows\Command and Windows\Options\Cabs (according to the Microsoft KB article... it is more likely that it extracts to locations under %windir%), although the file may also simply be extracted using 7Zip. (This version might be the same as what comes with Windows ME.) (This file has been extracted with 7Zip for Windows. FreeDOS's page about 7zip for DOS may hyperlink to FreeDOS's 7-Zip archive (@ibiblio.org"> and/or other location(s) -- perhaps that software works to extract this file?) Large disks may cause severe cosmetic issues (where data overflows one field and causes later fields to have extra text, causing major alignment issues with what is displayed on the screen).
Microsoft's online documentation: MS KB 255867: How to Use the Fdisk Tool and the Format Tool to Partition or Repartition a Hard Disk.
fdisk.com/fdisk contains some additional information, including command line parameters.
- [#msupfdsk]: Latest Microsoft
- Notes for Linux
A popular manual page for
for Linux (widely mirrored, e.g.: An
man(ual) page) suggests trying to use
, or either of those rather than
, it says, “
is a buggy program that does fuzzy things - usually it happens to produce reasonable results.” ... “Avoid it if you can.” The main complaint about
seems to be its interface, though this article does give credit where it may be due, noting
“is more correct than
and more powerful than both
. Moreover, it can be used noninteractively.)”
GNU PartEd (run using the command “
”) may be another option. Although the name looks like the English word “parted”, Wikipedia's web page for the GNU Parted software notes “the name being the conjunction of the two words PARTition and EDitor”, and so many people do not place much, if any, lower emphasis on the second syllable of this software's name. (As seen by the title of Web page about GNU Parted manual, the name of the program sometimes is shown with the p lowercase, and sometimes uppercase. The page links to various documentation options. One option is GNU Parted documentation in a single HTML page.) There are frontends to this software, including some that are designed to work in text mode, such as nparted. The fatresize program uses code from Parted's library. Pyparted may be another front-end?
Mtools documentation on the
command provides another option, although it seems less likely that such a command would be readily available when
After making changes, it may be unnecessary to restart the operating system. However, the operating system may need to be informed to reload/synchronize the changes from the disk. Perhaps see partx / partprobe / addpart / delpart
- Notes for BSD
OpenBSD has an
program. See: OpenBSD
Partition Report. Of course, OpenBSD also has a
program for modifying the “BSD disklabel”/“bsdlabel”. These programs may be covered in more detail, in an OpenBSD installation guide. For example, OpenBSD
requirements/goals to achieve.
- Notes about
- Other software
- Cross-platform solution(s)
From reading pfdisk.doc, it looks like
is open source, and quite cross-platform, with versions available for at least DOS, ESIX, and Minix. It is probably also scriptable. However, it also looks like it allows creation of partitions only at cylinder boundaries, which is an unusually strict limitation. Also, it appears to have about as much ease-of-use as
- Partition software designed for DOS
- [#xfdisk]: XFDisk
XFDisk comes with FreeDOS. This also comes with a boot manager available. Currently details are simply at TOOGAM's Software Archive: Preboot software (section about XFDisk). This option is fairly easy to use, as far as partition editors go. The one caveat to know is that if “Install Boot Manager” is selected, it might not even bother to install the boot manager unless a Boot Manager menu entry is then used.
Version 0.9.3 Beta EN has been the latest version for years, and has been found to be fully reliable.
- [#ranishpm]: Ranish Partition Manager
Ranish Partition Manager provides quite a few details about the actual disk layout. For those wanting to see actual details of the partitions, this is a very excellent choice.
This is probably not a good idea. However, in case the included
software doesn't handle non-native partitions very well, it might be possible to remove a problematic non-native partition using software that comes with DOS. Instructions for this are documented by Microsoft KB Q106419: Removing Non-DOS Partitions with
(formerly at http://support.microsoft.com/support/kb/articles/Q106/4/19.ASP and officially marked as applying to MS-DOS 6.0 through 6.21, so perhaps this doesn't work as well with some other versions of
?). However, this approach is probably NOT going to be the easiest option, so this is NOT recommended.
- Partition software for Microsoft Windows
- Reserved Space
Microsoft KB Q309044 says a MB of space is needed for conversion between disk layout types, and: “This space is automatically reserved when the partition or volume is created in Microsoft Windows 2000 or Windows XP Professional. However, it may not be available on partitions or volumes that are created in other operating systems.”
For those who expect not to try to switch to Microsoft's Dynamic Disk structure, this may be considered disk space that was intentionally wasted in a propoganda-like effort to get people to use a proprietary disk layout structure.
Worse, Walter Clayton's article, “The case of the disappearing partitions” notes that Vista's 1MB “alignment boundary differs from the alignment boundary that is created by Windows XP.” Then if older software looks at a disk that has been affected by newer software, “the different alignments may cause this problem.”
Many versions come with
Some versions of Windows comes with
. (Microsoft Windows XP Pro documentation: New command-line tools lists this command as a new piece of software in that operating system. It is known that Vista for X64 does not seem to have an
program in its default path.) Microsoft KB Q300415: A Description of the
Command-Line Utility (which includes information about commands that may be used with the “scripting” functionality). Microsoft Windows XP Pro documentation: the
command also has information about using this software.
to gather information is a technique that might not be very useful for using the software to try to make changes. However, unlike
, this method provides an easy way to get exact sector numbers.
For further information about how to use
(for instance, to check remote systems, or to gather other types of information), further details are described at: Common Information Model: WMI.
This is often quite useful:
WMICPARTITION GET DiskIndex,Index,Size,StartingOffset,Type
This next example shows some other information that can be useful. (Of this output, the BlockSize may be particularly unlikely to be different between partitions on a disk.)
WMICPARTITION GET BlockSize,Bootable,BootPartition,DiskIndex,Index,PrimaryPartition
This following is often much less useful, because the Caption and the Name are often identical and the only unique information might be information from the other two columns.
WMICPARTITION GET Caption,DiskIndex,Index,Name
This may also be prone to show some redundancy:
WMICPARTITION GET Description,DiskIndex,Index,Type
This shows even more information, and doesn't use the default output format (which is the “
WMICPARTITION GET /FORMAT:LIST
(This information is rather basic. It doesn't really even qualify as a full tutorial yet.)
You can list the available disks with “
Then, choose a disk. e.g.:
Then, work on a disk, tell
to focus on that disk. e.g.:
HELP SELECT DISKand then
SELECT DISK 0
You can then verify that the disk was selected.
LIST DISKwill show an asterisk in the first column of the row representing that disk.
To see partitions, use:
Partitions seem to be what people will typically use with “simple” MBR-based disk layouts. (Volumes may be more useful for “Dynamic Disks” or maybe GPT?)
The operating system may also come with at least one other option noted in the section about graphical disk management software.
refers to WinNT 3.1 RK file
. The RK is at: WinNT 3.1 RK at reskit.exe found at ftp://ftp.microsoft.com in /bussys/winnt/winnt-public/reskit/nt31/i386/.
- Misc. partition editing options
- Operating system setup
The setup process of at least some (versions of one or more) operating systems may automatically run software to create one or more partitions. This is typically interactive. For Microsoft Windows, earlier versions of the operating system that use text mode installers tended to provide this functionality in text mode, while later versions of operating systems (possibly the same operating system with a different service pack?) may provide such functionality using an interface that uses a (simplified) graphical environment.
- Commercial offerings
Partition Magic is one solution. VCOM made Partition Commander, which apparently became a part of System Commander. VCOM is now “an Avanquest brand”, according to a box mentioned on Avanquest: Obsolete Releases page.
- Graphical partition editing options
Note: Before using any of this software, it is recommended to briefly review the text mode options. There are some notes in the sections describing text mode options about how operating systems may interact with partition changes, and those notes may apply here as well.
- Software for Unix
- Parted front-ends
- GParted (which may prominently describe itself as “Gnome Partition Editor” on its web page, almost making it seem like Gnome Partition Editor is the name of the software), KDE Partition Manager (project files at KDE Partition Manager SF.net page, redirected to by partitionmanager.org). QtParted has been defunct: Wikipedia's page for QtParted says, “After not being maintained since 2005, it has been superseded by KDE Partition Manager.” However, QtParted's web page has stated, “QtParted is back among the living! After seeing the message about QtParted's death, the Ark Linux team have decided to continue maintaining it.”
- Software for Microsoft Windows
Some versions of the operating systems based on Windows NT code may come with the Disk Management Microsoft Management Console, diskmgmt.msc, which is a graphical method of interacting with partitions.
- Partition software for OS/2
Wikipedia's page about
states, “OS/2 versions 4.5 and higher (including eComStation) can use the JFS filesystem as well as FAT and HPFS, and replace fdisk with the Logical Volume Manager (LVM).” Older versions may have both
and, for a more graphical approach,
- Resizing partitions
One option, which most certainly can be (and almost always is quite) destructive to data that may already exist within a partition, is to delete one or more partitions as needed, and then make one or more partitions as desired. Naturally, since this is so destructive, having a successful and ready backup is not generally considered to be highly recommended and sensible options for this sort of activity, but instead, is generally considered to be an absolute requirement.
There are some other options which are supposedly non-destructive. Especially with very early versions of the software, this sort of change does not always go well, and so backups are again needed. Trying to get by without a backup is not recommendable; those who try to skip this step in a pinch should understand there is a noteworthy chance of catastrophe. However, these non-destructive methods might work and, if they do, may be faster than restoring the data.
It should probably be able to go without saying that this process is not intended to magically workaround limits such as a storage device's maximum capacity or various other size limits, such as support by pre-OS system startup code (like the BIOS on 32-bit machines and older machines).
(This guide currently does not provide much detail in using this sort of software. Often, the method considered safest is to purchase a new hard drive, possibly larger than whatever hard drive(s) have been storing the partition that is an undesirable size, and just make a partition structure of the desired size on the new partition.)
GNU Parted may be one option which supports multiple filesystem formats, and is available for a number of operating system platforms.
Speaking of parted, GNU ext2resize's FAQ says parted “uses the ext2resize code to handle ext2 filesystems”. Despite the FAQ suggesting Ext3 support needs to be finished, the main page for GNU ext2resize describes it as “a package which allows resizing ext2 and ext3 filesystems (both shrinking and growing).” This resizing option is unique because there is an option to use a Linux patch that then allows the resizing to occur while the partition remains mounted. (This sort of support has not been very common.)
command, which is part of e2fsprogs, may be an option for Ext2 and successor systems. Wikipedia's page about PartitionMagic: section called “See also” noted this software was partially made by PowerQuest, the creators of PartitionMagic.
Speaking of PartitionMagic, this commercial software has been cherished by some people. Versions have been released for DOS, Microsoft Windows versions prior to Vista, and OS/2. The software may refuse to run on “Server” editions of Microsoft Windows, but a variant called “Server Magic” has been made available for Windows Server editions. Server Magic was also released for Novell Netware. The software has no bright future: After PowerQuest sold the software to Symantec, Symantec discontinued this software.
The “Fully Interactive Partition Splitter” (“FIPS”) for DOS was designed just for FAT filesystems. This GPL'ed software was a very early piece of free software for this sort of task. In addition to being limited to FAT, it did not resize allocation units, and did not support growing, and so became considered to be obsolete compared to GNU PartEd. However, it remains remembered as a historical footnote, providing the capability when other options may not have been quite so available.