Hard Disk (HDD)
Hard drives, Solid state drives, NVMe, etc.
SpecProbe can probe HDD information by calling the HardwareProber.GetHardDisks() property.
Properties in the HDD information
This populates the following values in accordance to the available information:
HardDiskSize
PartitionCount
Partitions
PartitionTableType
Each partition in the Partitions list contains the following properties:
PartitionNumber
PartitionSize
PartitionType
PartitionBootable
Always false on macOS, and only true on Linux if it's an ESP.
PartitionOffset
How parsing works
This section describes how parsing works for the below systems:
Windows
For Windows systems, it tries to get the list of all the recognized physical Windows drives, including the unmounted partitions, such as your system reserved partition. Once the drive is ready, SpecProbe formulates the Windows kernel partition path for the next step.
After that, it calls the CreateFile() Windows API function to the formulated partition path to add the resulting drive handle to the list of handles.
Then, SpecProbe attempts to access the DeviceIoControl() function for two things:
Drive geometry to get access to the Cylinder, Heads, and Sectors (CHS) info
Device number that gets assigned by the Windows operating system
Then, the hard disk size is calculated by multiplying the four values:
Cylinders
Tracks per cylinder (heads)
Sectors per track (or per head)
Bytes per sector
Next, SpecProbe tries to get information about the partition table for each disk and type for each partition.
Because of the usage of CreateFile() and the DeviceIoControl() Windows API functions on your drives, you need to run every application that uses SpecProbe to probe your hard drives as an elevated administrator. The console app shipped with SpecProbe sets the requirement of the administrator privileges.
To do this in your application, create an app.manifest file and add this inside the requestedPrivileges list:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />Linux
SpecProbe on Linux performs the following steps:
It tries to get all the block devices defined in the
/sys/blockfolder.Once the list of block devices are populated (loop devices are not supported), it first checks the contents of the
removablefile.If the
removablestate is zero, which means that it's a fixed drive, SpecProbe attempts to get the total size of the drive by probing the block size of each drive from thesizefile for each drive.Then, it translates that size to the actual size in bytes by multiplying it by
512. It then tries to figure out the partition table type.For the partitions, SpecProbe gets the device name and attempts to check the block device name to see if it ends with a number (
nvme0n1for NVMe drives,mmbclk0for eMMC drives, ...).After that, it assigns the drive number as appropriate.
SpecProbe attempts to formulate the correct partition block device name in accordance to the drive number existence (
nvme0n1vs.sda) so that it can check to see if that partition exists.Then, SpecProbe tries to get the size of a single partition by parsing the contents of the
sizefile from the partition path and multiplying the block size reported by that file by512to get the total number of bytes.SpecProbe then uses
lsblkto query the partition type and the partition table type, assuming that your system hasudevenabled.
To get this information on Android phones and tablets, your device needs to be rooted and SpecProbe needs to be updated to version 1.1.0. Unrooted Android devices only show little to no information.
macOS
SpecProbe on macOS performs the following steps:
SpecProbe on macOS systems tries to get all the block devices defined in the
/devfolder that their names start withdisk.diskutilthen gets executed with the full path to the block device, such as/dev/disk0for the first disk and/dev/disk0s1for the first partition.If the
Removable Mediastate isFixed, which means that it's a fixed drive, SpecProbe attempts to get the total size of the drive by getting the total number of bytes from theDisk Sizefor physical disks or theVolume Used Spacefor APFS virtual partitions.For the partitions, SpecProbe gets the disk ID and the partition number, and checks to see if the disk is one of the known virtual disks.
Then, SpecProbe adds the disk or partition to the list.
Finally, SpecProbe tries to figure out how to parse the partition table and the partition type.
Last updated