许多现代存储类型使用 Thin provisioning分配 block 。我需要得到 Block allocation map对于磁盘设备。有 FSCTL_GET_VOLUME_BITMAP 获取卷位图,但它是特定于文件系统的,我需要一种不是特定于 FS 的方法。 从 Windows 8 开始 Windows is sending "TRIM and Unmap" hints to storage media to track allocated blocks .
UNMAP is the SCSI command by which an application or the system can communicate to the storage stack and the disk that a certain sector or range of sectors are currently not in use, including sectors that were previously in use by files that were later deleted.
所以这应该是可能的。不幸的是,我找不到 Disk Management Control Code或磁盘管理功能来获取它。也许有人知道如何获得它?
最佳答案
就像 gubblebozer 所暗示的那样 - SBC-3 中引入的 GET LBA STATUS
命令是从设备本身检索低级映射的方法。来自 Thin Provisioning
The application can call the IOCTL DSM allocation routine to send the SCSI
command and retrieve the mapped or unmapped state of each slab in a particular
range. If the LBA provisioning status returned does not describe the entire
allocation range, the application sends another SCSI command to retrieve the
provisioning status of the remaining LBA range.
看起来这可以在 IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES 的帮助下完成 然后 DEVICE_DATA_SET_LB_PROVISIONING_STATE 结构将包含一个位图 平板分配。
关于windows - 如何确定为磁盘设备分配了哪些 block ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36531598/