none
How to check the SSD 4k alignment programmatically? RRS feed

Answers

  • If you know the device Index and partition #: (Run as admin)

    C:\Windows\system32>wmic partition get Name, StartingOffset
    Name                   StartingOffset
    Disk #4, Partition #0  135266304
    Disk #6, Partition #0  135266304
    Disk #7, Partition #0  1048576
    Disk #1, Partition #0  135266304
    Disk #5, Partition #0  1048576
    Disk #2, Partition #0  1048576
    Disk #2, Partition #1  165675008
    Disk #2, Partition #2  249581010944
    Disk #3, Partition #0  135266304
    Disk #0, Partition #0  135266304
    Disk #2, Partition #1 is my SSD (Drive C:)

    165675008 / 4096 = 40448, evenly divisible by 4096 so it is 4K aligned (165675008 mod 4096 = 0)

    Somewhere I have code to map a drive letter to a device, Partition # - so far I cannot find it..

    • Marked as answer by gaxjyxq Friday, September 28, 2018 3:01 AM
    Friday, September 28, 2018 2:30 AM
    • Marked as answer by gaxjyxq Friday, September 28, 2018 3:01 AM
    Friday, September 28, 2018 3:01 AM

All replies

  • I don't have SSD but maybe you can query STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR

    (P/Invoke DeviceIoControl)

    Thursday, September 27, 2018 3:30 PM
  • If you know the device Index and partition #: (Run as admin)

    C:\Windows\system32>wmic partition get Name, StartingOffset
    Name                   StartingOffset
    Disk #4, Partition #0  135266304
    Disk #6, Partition #0  135266304
    Disk #7, Partition #0  1048576
    Disk #1, Partition #0  135266304
    Disk #5, Partition #0  1048576
    Disk #2, Partition #0  1048576
    Disk #2, Partition #1  165675008
    Disk #2, Partition #2  249581010944
    Disk #3, Partition #0  135266304
    Disk #0, Partition #0  135266304
    Disk #2, Partition #1 is my SSD (Drive C:)

    165675008 / 4096 = 40448, evenly divisible by 4096 so it is 4K aligned (165675008 mod 4096 = 0)

    Somewhere I have code to map a drive letter to a device, Partition # - so far I cannot find it..

    • Marked as answer by gaxjyxq Friday, September 28, 2018 3:01 AM
    Friday, September 28, 2018 2:30 AM
  • Hi,

    1.On the desktop of the computer, press the key combination "Win + R" to open the running window, enter "MSINFO32", press the Enter key to confirm, as shown below:

    2.The system information window will pop up, click on “Components--Storage--Disks” in the window, then find the “Partition Starting Offset” in the list of items on the right, and divide the values after it by 4096 respectively. The result is an integer, which means that the current hard disk has been 4k aligned, otherwise no.

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, September 28, 2018 3:01 AM
    • Marked as answer by gaxjyxq Friday, September 28, 2018 3:01 AM
    Friday, September 28, 2018 3:01 AM