DiskMap — Display a Map of the Disk

This utility produces a report on the configuration of the disk that you specify. It provides information about the disk characteristics and a description for each partition and logical drive on the disk.

DiskMap can be run from the command prompt. The syntax is:


diskmap /d<drive#> [/h]

These are the options for DiskMap

Option

Description

/d<drive#>

Drive# is the physical disk for which you want a map.

/h

Indicates hexadecimal output. The default is decimal output.


Some fields in the DiskMap report are always hex or always decimal, regardless of whether you specify the /h option when you run the utility. These fields are shown in the next table. You can see the fields in the DiskMap sample report, shown later in this section.

Always hex

Always decimal

Signature

The MB portion of the DiskSize field

System ID

Partition number


As an example, Figure 22.1 is a Disk Administrator screen shot of a computer with one hard disk.

Figure 22.1 Disk Administrator screen shot

You get the following report for the disk configuration shown in Figure 22.1when you enter diskmap /d0 at the command prompt:


Cylinders  HeadsPerCylinder SectorsPerHead BytesPerSector MediaType
     1023                16             63            512      12
TrackSize = 32256, CylinderSize = 516096, DiskSize = 527966208 (503MB)

Signature = 0x14f24efd
     StartingOffset    PartitionLength StartingSector PartitionNumber
*             32256          210018816             63               1
          210051072          209534976         410256               2
          472227840           10321920         922320               3
          419618304           10289664             63               4
          429940224            8225280             63               5
          438197760           12354048             63               6
          450584064           16998912             63               7

MBR:
         Starting               Ending       System    Relative  Total
  Cylinder Head Sector  Cylinder Head Sector   ID      Sector    Sectors
*        0    1    1         406   15   63     0x06        63     410193
       407    0    1         812   15   63     0x07    410256     409248
       813    0    1         914   15   63     0x05    819504     102816
       915    0    1         934   15   63     0x01    922320      20160

EBR: (sector 819504)
         Starting               Ending       System    Relative  Total
  Cylinder Head Sector  Cylinder Head Sector   ID      Sector    Sectors
       813    1    1         832   15   63     0x87        63      20097
       833    0    1         848   15   63     0x05     20160      16128
         0    0    0           0    0    0     0x00         0          0
         0    0    0           0    0    0     0x00         0          0

EBR: (sector 839664)
         Starting               Ending       System    Relative  Total
  Cylinder Head Sector  Cylinder Head Sector   ID      Sector    Sectors
       833    1    1         848   15   63     0x01        63      16065
       849    0    1         872   15   63     0x05     36288      24192
         0    0    0           0    0    0     0x00         0          0
         0    0    0           0    0    0     0x00         0          0

EBR: (sector 855792)
         Starting               Ending       System    Relative  Total
  Cylinder Head Sector  Cylinder Head Sector   ID      Sector    Sectors
       849    1    1         872   15   63     0x07        63      24129
       873    0    1         905   15   63     0x05     60480      33264
         0    0    0           0    0    0     0x00         0          0
         0    0    0           0    0    0     0x00         0          0

EBR: (sector 879984)
         Starting               Ending       System    Relative  Total
  Cylinder Head Sector  Cylinder Head Sector   ID      Sector    Sectors
       873    1    1         905   15   63     0x87        63      33201
         0    0    0           0    0    0     0x00         0          0
         0    0    0           0    0    0     0x00         0          0
         0    0    0           0    0    0     0x00         0          0

This utility is very useful for producing hardcopy reports for each disk, which should be kept with the other configuration information that you maintain for your computer. You can create a hardcopy by redirecting the output to a printer or to a file, which you can then print. This example creates a file:


diskmap /d0 >disk0map.txt

The first three lines of the output:


Cylinders  HeadsPerCylinder SectorsPerHead BytesPerSector MediaType
     1023                16             63            512      12
TrackSize = 32256, CylinderSize = 516096, DiskSize = 527966208 (503MB)

are information that DiskMap obtained by using IOCTL_DISK_GET_DRIVE_GEOMETRY. The information is the geometry of the disk as seen by Windows NT. The hardware might have different physical geometry, because translation can be performed either at the hardware or device driver layer. It is important to know what geometry Windows NT is using. You can use this information if you need to repair the Partition Table, which is described in the section entitled "Editing and Repairing the Partition Table," later in this chapter. The TrackSize, CylinderSize, and DiskSize values are bytes.

The second section of the output is information about the disk returned from IOCTL_DISK_GET_DRIVE_LAYOUT. Windows NT uses the signature to correlate information in the HKEY_LOCAL_MACHINE\SYSTEM\DISK Registry subkey with the appropriate physical disk when the disk contains volume sets or stripe sets. The StartingOffset and PartitionLength fields are the values for each of these data in bytes.

The MBR and EBR sections on the printout describe the contents of the Partition Table(s). The MBR section is for the Partition Table contained on the first sector of the disk. If there is no extended partition on the disk, there are no EBR sections. Otherwise, there is one EBR section for each logical drive in the extended partition. The fields in each of these sections are described in the "Partition Table" section in Chapter 17, "Disk and File System Basics."

Each partition that has an asterisk (*) at the left side is a system partition, which contains the files used to load an operating system such as Windows NT. On an x86-based computer, each disk can have a system partition, but there should only be one partition with the * on each disk. RISC-based computers can have more than one system partition on a disk.

The DiskMap utility has several possible error messages. Some messages are not serious, and you can easily correct them. Other messages usually are caused by some type of hardware problem or corruption of the data on the disk. This table describes the error messages that you might see. The N and E in the message indicate numbers.

Message

Meaning

BLOCKED: CreateFile() Failed /dN [Error E]
Ensure that you have selected a valid drive number and that the selected drive is not locked by another process.

The attempt to open physical disk N failed. Either some other program, such as Disk Administrator or DiskProbe, has the drive open, or the value following /d is invalid (out of range or not a number).

Unable to get drive layout using IOCTL_DISK_GET_DRIVE_GEOMETRY. Error: [Error E].
This is a fatal error.

The call to DeviceIoControl() with the parameter IOCTL_DISK_GET_DRIVE_ GEOMETRY failed. You would get this error if you removed the disk in a removable media device. Otherwise, it could indicate a hardware failure where a device that was available at startup is no longer available.

Unable to allocate memory

DiskMap tried to allocate memory for a temporary buffer and no memory was available. Try closing other programs.

Unable to get drive layout using IOCTL_DISK_GET_DRIVE_LAYOUT. Error: [Error E].

The call to DeviceIoControl() with the parameter IOCTL_DISK_GET_DRIVE_LAYOUT failed. In attempting to walk the Partition Table chain, some kind of error was encountered. This error indicates Partition Table corruption, hardware RAID array corruption, hardware failure, or a change in apparent disk geometry that makes portions of the volume inaccessible. More information about why the call failed might be available in other parts of the utility where it walks the chain manually.

Unable to read next EBR. Error: [Error E].

A call to ReadFile() failed. This is usually caused by an attempt to read past the end of the disk, as in the case where the pointer to the next EBR is not valid. It can also indicate a bad sector at the EBR location.

Next EBR failed to pass sanity check.

This message means that the Ending Head for each of the four Partition Table entries is not 0 or not equal to TracksPerCylinder-1, or that the last two bytes in the sector are not 0x55 0xAA. The problem is either an error in the chain of EBRs or this sector has been corrupted.

Detected partition corruption.

This message means that the value in the Relative Sector field for a Partition Table entry is not equal to the SectorsPerHead value.


In general, if the partition size and layout displayed by DiskMap looks about right and the utility does not display any error messages, then the Partition Tables are probably correct.

An example of where DiskMap can be very useful is when a Partition Table was written incorrectly and the last EBR referenced is past the end of the disk. Disk Administrator will not initialize in this situation, because it depends on the information from IOCTL_DISK_GET_DRIVE_LAYOUT, which would fail. DiskMap would also display an error about IOCTL_DISK_GET_DRIVE_LAYOUT, but would display the EBRs that it can read up to the point of failure. If you have a hardcopy of a map of the disk that had no errors, you can see where the two chains diverged. You can restore the original partition information by correcting the first EBR that has bad values by using a low-level disk editor such as DiskProbe. Typically, the rest of the original EBRs would not have been damaged by the bad EBR chain. Sometimes, though, it might be necessary to repair more than one EBR.