8

I want to reformat an exFAT USB drive with the same allocation size as the current factory exFAT partition, so when it ask me for allocation size, I don't know what to answer:

Cluster size in format dialog

Thus the question: How can I check the sector size of an exFAT partition on Windows? For example, on Linux you'd do:

echo print all | parted /dev/sda

Output:

GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print all
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
  • Here it says sector size 512 bytes.
3
  • 1
    You’ll want to know which memory chip is being used, since they have the physical sector sizes. It’s probably either 512 byes or 4096 (alternative fact), but you could just try different sizes and see which meets your performance compromise; it may be faster to transfer fewer, larger blocks than many smaller ones for a typical (a.f.) task, although you may be waring the drive down by writing sectors that may have gone untouched with smaller units. 🤷🏽‍♂️ Commented Jun 4, 2022 at 21:33
  • 1
    @LouisWaweru generally a good idea, but in this case i just want to make sure that the factory settings are retained, even if the factory settings are suboptimal :)
    – hanshenrik
    Commented Jun 4, 2022 at 21:38
  • Allocation unit size is the cluster size, not sector size, and it's a filesystem thing, not related to the disk. Only sector size is defined by disks
    – phuclv
    Commented Jun 5, 2022 at 16:09

3 Answers 3

6

Sector size is more related to physical disk drives than partitions/volumes because file systems in partitions will combine sectors together into clusters instead. The "Allocation unit size" in your screenshot is the cluster size and not sector size!!! To check cluster size see Check the cluster size of an exFAT drive on Windows

Anyway reformat the drive with the same allocation size as the current factory exFAT partition is pointless because allocation unit size has nothing to do with the sector size and depends on your data. For example if you store mostly large media files then choose big allocation size for better performance, and if you use the drive mainly for very small files then you need to choose a small allocation size, otherwise the overhead will be large and things like this will happen

it appears to be one of those fake-capacity chinese USB sticks with firmware crafted to fake capacity, it REPORTS 8TB, but files get corrupted when i tried moving 200GB to it, so it's real capacity is <=200GB

Most fake-sized crappy USB sticks are not even 4GB, let alone 200GB. There's no chance for you to get the data back. Most likely when you write more than the drive's size it already wraps back to the start and overwrite the metadata of the filesystem, making the sector size appears large but it's actually isn't. And you can't find a way to reflash the drive's firmware to get the real size either, so just throw it away


Again, you should just care about cluster size and shouldn't be worry about sector size, but if you're really curious then there are lots of ways to obtain sector size, one of that is by querying WMI with wmic

C:\> wmic diskdrive get DeviceID,BytesPerSector,DefaultBlockSize,MinBlockSize,MaxBlockSize
BytesPerSector  DefaultBlockSize  DeviceID            MaxBlockSize  MinBlockSize
512                               \\.\PHYSICALDRIVE0

or Get-WmiObject in PowerShell

PS C:\> (Get-WmiObject win32_diskdrive).BytesPerSector
512

although WMI was deprecated and new code should use Get-CimInstance instead

PS C:\> (Get-CimInstance win32_diskdrive).BytesPerSector
512

With fsutil beside sectorInfo you can also check the ntfsInfo/refsInfo outputs if the partition is among those file systems

> fsutil fsinfo ntfsinfo C: | findstr /c:"Bytes"
Bytes Per Sector  :                512
Bytes Per Physical Sector :        4096
Bytes Per Cluster :                4096  (4 KB)
Bytes Per FileRecord Segment    :  1024
5

Use fsutil:

fsutil fsinfo sectorInfo D:

Output

LogicalBytesPerSector :                                 4096
PhysicalBytesPerSectorForAtomicity :                    67108864
PhysicalBytesPerSectorForPerformance :                  67108864
FileSystemEffectivePhysicalBytesPerSectorForAtomicity : 4096
Device Alignment :                                      Not Aligned (0x1000)
Partition alignment on device :                         Not Aligned (0x100000)
Performs Normal Seeks
Trim Not Supported
Not DAX capable
Not Thinly-Provisioned
4
  • your Physical Bytes Per Sector is 64MB which is really weird. It shouldn't be that large unless you're using a very big RAID array of 16384 drives or similar things that make the smallest block size so big
    – phuclv
    Commented Jun 5, 2022 at 10:26
  • @phuclv yeah it appears to be one of those fake-capacity chinese USB sticks with firmware crafted to fake capacity, it REPORTS 8TB, but files get corrupted when i tried moving 200GB to it, so it's real capacity is <=200GB - haven't figured out its real cap yet though. if you have any suggestions on that topic, i'm all ears
    – hanshenrik
    Commented Jun 5, 2022 at 16:26
  • unfortunately I don't think you can do anything with it. I've had situations like that and the only way I can do is throw the USB stick away, since data has been overwritten when data wraps around. There's no way you can get a firmware for the drive and reflash it to get real size
    – phuclv
    Commented Jun 5, 2022 at 16:30
  • @phuclv wrote a program to find the device's real capacity: github.com/divinity76/captester - and it seems safe to find the real capacity, and format a partition to the size of the drive's real cap... even so, it's probably better to follow your advice and just throw it away :P
    – hanshenrik
    Commented Oct 1, 2022 at 18:16
2

Run the following command:

chkdsk d:

The 3rd output line from bottom up says {XXX bytes in each allocation unit}.

3
  • the 3rd output line from bottom up says XXX bytes in each allocation unit which is the cluster size and not sector size. And it's pointless to run a disk check just to get the size
    – phuclv
    Commented Jun 6, 2022 at 15:56
  • I did not mention "sector size". Why are you referring to "sector size"? This is not the question. Furthermore chkdsk works from DOS until the most recent Windows version. "chkdsk" is easy to remember. The time I need to lookup the exact wording for fsutil and wmic chkdsk has already finished. As I don't know when Microsoft introduced fsutil and the question does not contain the windows version "chkdsk" is my easy one fits all question. But if you have "fsutil fsinfo sectorInfo D:" and other complicated shell commands in your mind, congratulations. I think your answer is way too long.
    – r2d3
    Commented Jun 6, 2022 at 19:45
  • Thanks for proposing a better wording, I adapted your proposal!
    – r2d3
    Commented Jun 6, 2022 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .