You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is what I use in my project. All of them don't require root privileges.
Windows:
the raw device file is called \\.\PhysicalDriveX, while X is 0, 1, 2, 3... without empty slots.
Get the number of drives in HKLM\SYSTEM\CurrentControlSet\Services\disk\Enum\Count, or just keep open the raw device file until getting INVALID_HANDLE.
Get vendor, model name and serial number with IOCTL_STORAGE_QUERY_PROPERTY / StorageDeviceProperty
Get disk size with IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
Linux:
All physical disks are in /sys/block/
Get disk name with /sys/block/X/device/vendor and /sys/block/X/device/model
Get serial number with /sys/block/X/device/serial
Get disk size with /sys/block/X/size
macOS:
All physical disk can be get with IOServiceMatching(kIOMediaClass)
Get name with the entry name of IOMedia service
Get serial number with kIOPropertyProductSerialNumberKey
Get disk size with kIOMediaSizeKey
FreeBSD:
Use libgeom, or parse sysctl kern.geom.confxml manually. All physical disks have rank = 1
No description provided.
The text was updated successfully, but these errors were encountered: