Before partitioning a drive or getting information about the partition layout of a drive, you must first understand basic and dynamic disks.
There are two types of disks: basic and dynamic. Disks that contain basic partitions are referred to as basic disks, and disks that contain dynamic partitioning are referred to as dynamic disks. A volume cannot contain basic and dynamic partitions. On dynamic disks, volumes generally have no relation to the partitions on the disk
The main differences between basic and dynamic disks are:
- Dynamic disks support multipartition volumes; basic disks do not.
- Windows stores basic disk partition information in the registry and dynamic disk partition information on the disk.
The operations common to basic and dynamic disks are the following:
- Check disk properties, such as capacity, available free space, and current status.
- View volume and partition properties, such as size, drive-letter assignment, label, type, and file system.
- Establish drive-letter assignments for disk volumes or partitions, and for CD-ROM devices.
- Establish disk sharing and security arrangements for a volume or partition.
- Upgrade a basic disk to dynamic, or revert a dynamic disk to basic.
Basic Disks
You can create up to four partitions on a disk: either four primary partitions, or three primary and one extended. The extended partition can contain one or more logical drives. The following figure illustrates the layout of three primary partitions and one extended partition on a basic disk. The extended partition contains four extended partitions within it.
.png)
The BIOS implementations in x86-based computers require that basic disks must contain one or two partitions where information about the Windows operating system and the partitions on the disk are stored. The operating system information and the disk partition information are placed in separate volumes, and these two volumes may be located in separate partitions (as is shown in the above figure) or in a single partition. The disk partition information is contained in the master boot record, or MBR.
The following operations can only be performed on basic disks:
- Create and delete primary and extended partitions.
- Create and delete logical drives within an extended partition.
- Format a partition and mark it as active.
- Delete volume, striped, mirror, or stripe sets with parity.
- Break a mirror from a mirror set.
- Repair failed legacy fault-tolerant volumes, such as mirror sets or stripe sets with parity.
Unless you specify otherwise, Windows initially partitions a drive as a basic disk by default. You must explicitly convert a basic disk to a dynamic disk. However, there are disk space considerations that must be accounted for before you attempt to do this—this consideration will be described later in this section. Another consideration is that because the dynamic disk partitioning scheme is proprietary, converting a dynamic disk to a basic disk requires repartitioning the entire disk.
Dynamic Disks
Dynamic disks are the preferred partitioning scheme. To encourage the use of dynamic disks, multipartition volume support was removed from the standard partitioning scheme now referred to as the basic partitioning scheme, and is now exclusively supported on dynamic disks.
The Logical Disk Manager, or LDM, is the subsystem of Windows that manages dynamic disks. It uses information contained in the LDM databases that are located on each disk to do this.
The partitioning scheme of a dynamic disk is illustrated in the following figure.
.png)
As you can see in the figure, dynamic disks contain a master boot record at the beginning of the disk, one LDM partition, and an LDM database at the end. The MBR exists on a dynamic disk for backward compatibility with disk management utilities that operate on basic disks. The LDM database is where all of the partitioning information used by the LDM is located. No matter how much partition information the LDM database contains, it uses exactly 1MB of disk space.
Because of the location and size of the disk space needed by the LDM database, Windows cannot convert a basic disk to a dynamic disk unless there is at least 1MB of unused space on the disk.
The following operations can be performed only on dynamic disks:
- Create and delete simple, spanned, striped, mirrored, and RAID-5 volumes.
- Extend a simple or spanned volume.
- Remove a mirror from a mirrored volume or break the mirrored volume into two volumes.
- Repair mirrored or RAID-5 volumes.
- Reactivate a missing or offline disk.
Detecting the Type of Disk
There is no specific function to programmatically detect the type of disk a particular file or directory is located on. There is an indirect method.
First, call GetVolumePathName. Then, call CreateFile to open the volume using the path. Next, use IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS with the volume handle to obtain the disk number and use the disk number to construct the disk path, such as "\\?\PhysicalDriveX". Finally, use IOCTL_DISK_GET_DRIVE_LAYOUT_EX to obtain the partition list, and check the PartitionType for each entry in the partition list.
See Also
- Basic Disks and Volumes Technical Reference
- Dynamic Disks and Volumes Technical Reference
Send comments about this topic to Microsoft
Build date: 7/9/2009