The Windows Disk Management 6

 

 

 

 

 

Disk Management Control Codes

 

The file system provides an abstraction of the physical characteristics of storage devices so that applications can simply write to and read from files. However, storage in an enterprise relies heavily on the concept of disks. The following table identifies the control codes that are used in disk management.

 

Control code

Operation

IOCTL_DISK_CREATE_DISK

Initializes the specified disk and disk partition table by using the specified information.

IOCTL_DISK_DELETE_DRIVE_LAYOUT

Removes the boot signature from the master boot record.

IOCTL_DISK_FORMAT_TRACKS

Formats a contiguous set of floppy disk tracks.

IOCTL_DISK_FORMAT_TRACKS_EX

Formats a contiguous set of floppy disk tracks with an extended set of track specification parameters.

IOCTL_DISK_GET_CACHE_INFORMATION

Retrieves the disk cache configuration data.

IOCTL_DISK_GET_DRIVE_GEOMETRY_EX

Retrieves information about the physical disk's geometry.

IOCTL_DISK_GET_DRIVE_LAYOUT_EX

Retrieves information about the number of partitions on a disk and the features of each partition.

IOCTL_DISK_GET_LENGTH_INFO

Retrieves the length of the specified disk, volume, or partition.

IOCTL_DISK_GET_PARTITION_INFO_EX

Retrieves partition information for AT and EFI (Extensible Firmware Interface) partitions.

IOCTL_DISK_GROW_PARTITION

Enlarges the specified partition.

IOCTL_DISK_IS_WRITABLE

Determines whether the specified disk is writable.

IOCTL_DISK_PERFORMANCE

Provides disk performance information.

IOCTL_DISK_PERFORMANCE_OFF

Disables disk performance information.

IOCTL_DISK_REASSIGN_BLOCKS

Maps disk blocks to spare-block pool.

IOCTL_DISK_SET_CACHE_INFORMATION

Sets the disk cache configuration data.

IOCTL_DISK_SET_DRIVE_LAYOUT_EX

Partitions a disk.

IOCTL_DISK_SET_PARTITION_INFO_EX

Sets the disk partition type.

IOCTL_DISK_UPDATE_PROPERTIES

Invalidates the cached partition table of the specified disk and re-enumerates the disk.

IOCTL_DISK_VERIFY

Performs logical format of a disk extent.

 

The following list identifies the obsolete control codes:

 

  1. IOCTL_DISK_CONTROLLER_NUMBER
  2. IOCTL_DISK_GET_DRIVE_GEOMETRY
  3. IOCTL_DISK_GET_DRIVE_LAYOUT
  4. IOCTL_DISK_GET_PARTITION_INFO
  5. IOCTL_DISK_HISTOGRAM_DATA
  6. IOCTL_DISK_HISTOGRAM_RESET
  7. IOCTL_DISK_HISTOGRAM_STRUCTURE
  8. IOCTL_DISK_LOGGING
  9. IOCTL_DISK_REQUEST_DATA
  10. IOCTL_DISK_REQUEST_STRUCTURE
  11. IOCTL_DISK_SET_DRIVE_LAYOUT
  12. IOCTL_DISK_SET_PARTITION_INFO

 

Disk Management Enumeration Types

 

The following enumeration types are used with disk management:

 

  1. MEDIA_TYPE
  2. PARTITION_STYLE

 

MEDIA_TYPE Enumeration Definition

 

Represents the various forms of device media. The Syntax:

 

typedef enum _MEDIA_TYPE {

  Unknown,

  F5_1Pt2_512,

  F3_1Pt44_512,

  F3_2Pt88_512,

  F3_20Pt8_512,

  F3_720_512,

  F5_360_512,

  F5_320_512,

  F5_320_1024,

  F5_180_512,

  F5_160_512,

  RemovableMedia,

  FixedMedia,

  F3_120M_512,

  F3_640_512,

  F5_640_512,

  F5_720_512,

  F3_1Pt2_512,

  F3_1Pt23_1024,

  F5_1Pt23_1024,

  F3_128Mb_512,

  F3_230Mb_512,

  F8_256_128,

  F3_200Mb_512,

  F3_240M_512,

  F3_32M_512

} MEDIA_TYPE;

 

Constants

 

Constant

Meaning

Unknown

Format is unknown

F5_1Pt2_512

A 5.25" floppy, with 1.2MB and 512 bytes/sector.

F3_1Pt44_512

A 3.5" floppy, with 1.44MB and 512 bytes/sector.

F3_2Pt88_512

A 3.5" floppy, with 2.88MB and 512 bytes/sector.

F3_20Pt8_512

A 3.5" floppy, with 20.8MB and 512 bytes/sector.

F3_720_512

A 3.5" floppy, with 720KB and 512 bytes/sector.

F5_360_512

A 5.25" floppy, with 360KB and 512 bytes/sector.

F5_320_512

A 5.25" floppy, with 320KB and 512 bytes/sector.

F5_320_1024

A 5.25" floppy, with 320KB and 1024 bytes/sector.

F5_180_512

A 5.25" floppy, with 180KB and 512 bytes/sector.

F5_160_512

A 5.25" floppy, with 160KB and 512 bytes/sector.

RemovableMedia

Removable media other than floppy.

FixedMedia

Fixed hard disk media.

F3_120M_512

A 3.5" floppy, with 120MB and 512 bytes/sector.

F3_640_512

A 3.5" floppy, with 640KB and 512 bytes/sector.

F5_640_512

A 5.25" floppy, with 640KB and 512 bytes/sector.

F5_720_512

A 5.25" floppy, with 720KB and 512 bytes/sector.

F3_1Pt2_512

A 3.5" floppy, with 1.2MB and 512 bytes/sector.

F3_1Pt23_1024

A 3.5" floppy, with 1.23MB and 1024 bytes/sector.

F5_1Pt23_1024

A 5.25" floppy, with 1.23MB and 1024 bytes/sector.

F3_128Mb_512

A 3.5" floppy, with 128MB and 512 bytes/sector.

F3_230Mb_512

A 3.5" floppy, with 230MB and 512 bytes/sector.

F8_256_128

An 8" floppy, with 256KB and 128 bytes/sector.

F3_200Mb_512

A 3.5" floppy, with 200MB and 512 bytes/sector. (HiFD).

F3_240M_512

A 3.5" floppy, with 240MB and 512 bytes/sector. (HiFD).

F3_32M_512

A 3.5" floppy, with 32MB and 512 bytes/sector.

 

The MediaType member of the DISK_GEOMETRY data structure is of type MEDIA_TYPE. The DeviceIoControl() function receives a DISK_GEOMETRY structure in response to an IOCTL_DISK_GET_DRIVE_GEOMETRY control code. The DeviceIoControl() function receives an array of DISK_GEOMETRY structures in response to an IOCTL_STORAGE_GET_MEDIA_TYPES control code. The STORAGE_MEDIA_TYPE enumeration type extends this enumeration type.

 

PARTITION_STYLE Enumeration Definition

 

Represents the format of a partition. The syntax is:

 

typedef enum _PARTITION_STYLE {

  PARTITION_STYLE_MBR   = 0,

  PARTITION_STYLE_GPT   = 1,

  PARTITION_STYLE_RAW   = 2

} PARTITION_STYLE;

 

Constants

 

Constant

Meaning

PARTITION_STYLE_MBR

Master boot record (MBR) format. This corresponds to standard AT-style MBR partitions.

PARTITION_STYLE_GPT

GUID Partition Table (GPT) format.

PARTITION_STYLE_RAW

Partition not formatted in either of the recognized formats, MBR or GPT.

 

 

 

Disk Management Functions

 

The following functions are used in disk management.

 

Function

Description

CreateFile()

Creates or opens a file object.

DeleteFile()

Deletes an existing file.

GetDiskFreeSpace()

Retrieves information about the specified disk, including the amount of free space on the disk.

GetDiskFreeSpaceEx()

Retrieves information about the specified disk, including the amount of free space on the disk.

 

 

 

 

< Windows Disk 5 | Win32 Programming Index Page | Windows Disk Index | Windows Disk 7 >