Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer the physical block size over the logical block size #133

Open
nl6720 opened this issue Jan 8, 2025 · 0 comments
Open

Prefer the physical block size over the logical block size #133

nl6720 opened this issue Jan 8, 2025 · 0 comments

Comments

@nl6720
Copy link

nl6720 commented Jan 8, 2025

On block devices with 4096 byte physical block size and 512 byte logical block size (so called 512e), mkfs.ntfs/mkntfs chooses 512 bytes as the file system sector size.

# lsblk -t /dev/sdc
NAME   ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE  RA WSAME
sdc            0   4096      0    4096     512    1 none      256 128    0B
└─sdc1         0   4096      0    4096     512    1 none      256 128    0B

Using Arch Linux's ntfs-3g 2022.10.3-1 package:

# mkntfs -Q /dev/sdc1
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
# ntfsinfo -m /dev/sdc1
Volume Information
        Name of device: /dev/sdc1
        Device state: 11
        Volume Name:
        Volume State: 91
        Volume Flags: 0x0000
        Volume Version: 3.1
        Sector Size: 512
        Cluster Size: 4096
        Index Block Size: 4096
        Volume Size in Clusters: 15624703
MFT Information
        MFT Record Size: 1024
        MFT Zone Multiplier: 0
        MFT Data Position: 24
        MFT Zone Start: 0
        MFT Zone End: 1953091
        MFT Zone Position: 4
        Current Position in First Data Zone: 1953091
        Current Position in Second Data Zone: 0
        Allocated clusters 7 (0.0%)
        LCN of Data Attribute for FILE_MFT: 4
        FILE_MFTMirr Size: 4
        LCN of Data Attribute for File_MFTMirr: 7812351
        Size of Attribute Definition Table: 2560
        Number of Attached Extent Inodes: 0
FILE_Bitmap Information
        FILE_Bitmap MFT Record Number: 6
        State of FILE_Bitmap Inode: 80
        Length of Attribute List: 0
        Number of Attached Extent Inodes: 0
FILE_Bitmap Data Attribute Information
        Decompressed Runlist: not done yet
        Base Inode: 6
        Attribute Types: not done yet
        Attribute Name Length: 0
        Attribute State: 3
        Attribute Allocated Size: 1953792
        Attribute Data Size: 1953088
        Attribute Initialized Size: 1953088
        Attribute Compressed Size: 0
        Compression Block Size: 0
        Compression Block Size Bits: 0
        Compression Block Clusters: 0
        Free Clusters: 15607730 (99.9%)

The physical block size is the smallest unit a physical storage device can write atomically and it should generally be preferred over the logical block size and many other file system mkfs utilities do so. This means trying BLKPBSZGET before BLKSSZGET.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant