Windows Dev Center

MSFT_Disk class

Represents a Windows disk.

A MSFT_Disk object models the Windows operating system's concept of a disk device. The disk may be directly attached to the computer system, or it may be a virtual disk exposed to the system through the use of a Storage Management Provider.

The following syntax is simplified from Managed Object Format (MOF) code.

Syntax

class MSFT_Disk : MSFT_StorageObject
{
  String  Path;
  String  Location;
  String  FriendlyName;
  String  UniqueId;
  UInt16  UniqueIdFormat;
  UInt32  Number;
  String  SerialNumber;
  String  FirmwareVersion;
  String  Manufacturer;
  String  Model;
  UInt64  Size;
  UInt64  AllocatedSize;
  UInt32  LogicalSectorSize;
  UInt32  PhysicalSectorSize;
  UInt64  LargestFreeExtent;
  UInt32  NumberOfPartitions;
  UInt16  ProvisioningType;
  UInt16  OperationalStatus;
  UInt16  HealthStatus;
  UInt16  BusType;
  UInt16  PartitionStyle;
  UInt32  Signature;
  String  Guid;
  Boolean IsOffline;
  UInt16  OfflineReason;
  Boolean IsReadOnly;
  Boolean IsSystem;
  Boolean IsClustered;
  Boolean IsBoot;
  Boolean BootFromDisk;
};

Members

The MSFT_Disk class has these types of members:

Methods

The MSFT_Disk class has these methods.

MethodDescription
Clear

Removes partition information and uninitializes a disk, returning it to a RAW state.

ConvertStyle

Converts the partition style of an already initialized disk.

CreatePartition

Creates a partition on a disk.

Initialize

Initializes a RAW disk with a particular partition style.

Offline

Takes the disk offline.

Online

Brings the disk online.

Refresh

Refreshes the cached disk layout information.

SetAttributes

Sets the disk's attributes and properties.

 

Properties

The MSFT_Disk class has these properties.

AllocatedSize
Data type: UInt64
Access type: Read-only
Qualifiers: Required, Units (Bytes)

The amount of space, in bytes, that is currently used on the disk.

BootFromDisk
Data type: Boolean
Access type: Read-only

TRUE if the computer is configured to start from this disk. On computers with BIOS firmware, this is the first disk that the firmware detects during startup. On computers that use EFI firmware, this is the disk that contains the EFI System Partition (ESP). If there are no disks, or if there are multiple disks with an ESP partition, this property is not set for any disk.

BusType
Data type: UInt16
Access type: Read-only

The I/O bus type used by the disk.

ValueMeaning
Unknown
0

The bus type is unknown.

SCSI
1

SCSI

ATAPI
2

ATAPI

ATA
3

ATA

1394
4

IEEE 1394

SSA
5

SSA

Fibre Channel
6

Fibre Channel

USB
7

USB

RAID
8

RAID

iSCSI
9

iSCSI

SAS
10

Serial Attached SCSI (SAS)

SATA
11

Serial ATA (SATA)

SD
12

Secure Digital (SD)

MMC
13

Multimedia Card (MMC)

Virtual
14

This value is reserved for system use.

File Backed Virtual
15

File-Backed Virtual

Storage Spaces
16

Storage spaces

NVMe
17

NVMe

 

FirmwareVersion
Data type: String
Access type: Read-only

A string representation of the disk's firmware version.

FriendlyName
Data type: String
Access type: Read-only
Qualifiers: Required

A user-friendly, display-oriented string to identify the disk.

Guid
Data type: String
Access type: Read-only

If the PartitionStyle is GPT, this property contains the GUID for the disk. This property will be NULL for all other disk types.

HealthStatus
Data type: UInt16
Access type: Read-only
Qualifiers: Required, Values ( "Unknown", "Healthy", "Failing", "Failed" ) , ValueMap ("0", "1", "4", "8")

The health status of the disk device.

IsBoot
Data type: Boolean
Access type: Read-only

TRUE if the disk contains the boot partition.

IsClustered
Data type: Boolean
Access type: Read-only

TRUE if the disk is used in a clustered environment, or FALSE otherwise.

IsOffline
Data type: Boolean
Access type: Read-only

TRUE if the disk is offline, or FALSE otherwise.

IsReadOnly
Data type: Boolean
Access type: Read-only

TRUE if the disk is read-only, or FALSE if it is read/write.

IsSystem
Data type: Boolean
Access type: Read-only

TRUE if this disk contains the system partition, or FALSE otherwise.

LargestFreeExtent
Data type: UInt64
Access type: Read-only
Qualifiers: Units (Bytes)

The largest contiguous block of free space on the disk. This is also the largest size of a partition that can be created on the disk.

Location
Data type: String
Access type: Read-only

A string that contains the PnP location path of the disk. The format of this string depends on the bus type. If the bus type is SCSI, SAS, or PCI RAID, the format is AdapterPnpLocationPath#BusType(PPathIdTTargetIdLLunId). If the bus type is IDE, ATA, PATA, or SATA, the format is AdapterPnpLocationPath#BusType(CPathIdTTargetIdLLunId). See the following Remarks section for a table that lists the parts of this string.

Note  For Hyper-V and VHD images, this property is NULL, because the virtual controller does not return the location path.

For more information about this property, see the following Remarks section.

LogicalSectorSize
Data type: UInt32
Access type: Read-only
Qualifiers: Units (Bytes)

The logical sector size of the disk, in bytes. For example, a 4K native disk will report 4096, while a 512 emulated disk will report 512.

Manufacturer
Data type: String
Access type: Read-only

A string representation of the disk's hardware manufacturer.

Model
Data type: String
Access type: Read-only

A string representation of the disk's model number.

Number
Data type: UInt32
Access type: Read-only

The operating system's number for the disk. Disk 0 is typically the boot device. Disk numbers may not necessarily remain the same across restarts.

NumberOfPartitions
Data type: UInt32
Access type: Read-only

The number of partitions that have been created on the disk.

OfflineReason
Data type: UInt16
Access type: Read-only

If IsOffline is TRUE, this property contains the reason for the disk being offline.

One of the following values.

ValueMeaning
Policy
1

The user requested the disk to be offline.

Redundant Path
2

The disk is used for multi-path I/O.

Snapshot
3

The disk is a snapshot disk.

Collision
4

There was a signature or identifier collision with another disk.

Resource Exhaustion
5

There were insufficient resources to bring the disk online.

Critical Write Failures
6

There were critical write failures on the disk.

Data Integrity Scan Required
7

A data integrity scan is required.

 

OperationalStatus
Data type: UInt16
Access type: Read-only
Qualifiers: Required, Values ("Unknown", "Online", "Not Ready", "No Media", "Offline", "Failed", "Missing") , ValueMap ("0", "1", "2", "3", "4", "5", "6")

The operational status of the disk device.

PartitionStyle
Data type: UInt16
Access type: Read-only
Qualifiers: Required

The partition style used by the disk.

ValueMeaning
Unknown
0

The partition style is unknown.

MBR
1

Master Boot Record (MBR)

GPT
2

GUID Partition Table (GPT)

 

Path
Data type: String
Access type: Read-only
Qualifiers: Required

A path that can be used to open an operating system handle to the disk device.

PhysicalSectorSize
Data type: UInt32
Access type: Read-only
Qualifiers: Units (Bytes)

The physical sector size of the disk, in bytes. For example, both 4K native disks and 512 emulated disks will report 4096.

ProvisioningType
Data type: UInt16
Access type: Read-only

The provisioning type of the disk device.

ValueMeaning
Unknown
0

The provisioning scheme is unspecified.

Thin
1

The storage for the disk is allocated on-demand.

Fixed
2

The storage is allocated when the disk is created.

 

SerialNumber
Data type: String
Access type: Read-only

A string representation of the disk's serial number.

Signature
Data type: UInt32
Access type: Read-only

If the PartitionStyle is MBR, this property contains the MBR partition signature. This property will be NULL for all other disk types.

Size
Data type: UInt64
Access type: Read-only
Qualifiers: Required, Units (Bytes)

Total size of the disk, in bytes.

UniqueId
Data type: String
Access type: Read-only

The disk identifier. This contains the VPD Page 0x83 information that uniquely identifies this disk. The following types are accepted (in order of precedence):

  • 8 (SCSI Name String)
  • 3 (FCPH Name)
  • 2 (EUI64)
  • 1 (Vendor Id)
  • 0 (Vendor Specific)
If the disk is an exposed virtual disk, the UniqueId is used to map the association between the two objects.
UniqueIdFormat
Data type: UInt16
Access type: Read-only
Qualifiers: Values ( "Vendor Specific", "Vendor Id", "EUI64", "FCPH Name", "SCSI Name String" ) , ValueMap ("0", "1", "2", "3", "8")

The format of the disk identifier. This property contains the VPD Page 0x83 descriptor type that was used to set the UniqueId property.

Remarks

The following table lists the parts of the location path string used in the Location property.

Location path partDescription
AdapterPnpLocationPathThe adapter's PnP location path. This is retrieved by calling the SetupDiGetDeviceProperty function, passing &DEVPKEY_Device_LocationPaths for the PropertyKey parameter.
BusTypeThe bus type: ATA, RAID, SAS, or SCSI.
Note  If the bus type is IDE, PATA, or SATA, it appears as ATA in the location path string. If it is PCI RAID, it appears as RAID.
PathIdThe number of the bus. This is the value of the PathId member of the SCSI_ADDRESS structure that is returned by the IOCTL_SCSI_GET_ADDRESS control code.
TargetIdThe number of the target device. This is the value of the TargetId member of the SCSI_ADDRESS structure that is returned by the IOCTL_SCSI_GET_ADDRESS control code.
LunIdThe number of the LUN. This is the value of the Lun member of the SCSI_ADDRESS structure that is returned by the IOCTL_SCSI_GET_ADDRESS control code.

 

The following table contains examples of location paths.

Bus typeExample location path
ATAPCIROOT(0)#PCI(0100)#ATA(C01T03L00)
RAIDPCIROOT(0)#PCI(0200)#PCI(0003)#PCI(0100)#RAID(P02T00L00)
SASPCIROOT(1)#PCI(0300)#SAS(P00T03L00)
SCSIPCIROOT(0)#PCI(1C00)#PCI(0000)#SCSI(P00T01L01)

 

Starting in Windows 10 Insider Preview: MSFT_Disk derives from MSFT_StorageObject. It now inherits the property ObjectId, which was formerly a property of MSFT_Disk.

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Namespace

Root\Microsoft\Windows\Storage

MOF

Storagewmi.mof

 

 

Community Additions

ADD
Show:
© 2015 Microsoft