Determining volume cluster size without using GetDiskFreeSpace
https://stackoverflow.com/questions/11373603/determining-volume-cluster-size-without-using-getdiskfreespace
You can use DeviceIoControl with IOCTL_STORAGE_QUERY_PROPERTY
. On input, set the PropertyId
in the STORAGE_PROPERTY_QUERY
structure to StorageAccessAlignmentProperty
.
That will get you a STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR
, which contains members for both BytesPerLogicalSector
and BytesPerPhysicalSector
. The linked reference page includes demo code to retrieve and display the logical/physical sector sizes for a device.
physical drive
and itslogical sectors
.FSCTL_GET_NTFS_VOLUME_DATA
. I'm not sure how many other file systems you're likely to care about.