What's the difference between a partition blocksize and a volume blocksize in NTFS?

I've recently formatted a new disk (mount point) and wanted to verify the correct block size on Windows Server 2012 R2. Using PowerShell, I checked the WMI counters

gwmi win32_volume | select name,blocksize

yielded:

M:\Volume2\ 65536

I wanted to check the starting offset so I checked the partition:

gwmi win32_diskpartition | select name,startingoffset,blocksize

which yielded:

Disk #5, Partition #0 1048576 512

so the partition blocksize is 512, but the volume is 64K. Could someone help me understand the difference between these two "block sizes?"

At a very basic level I understand the difference between a partition and a volume, but I'm looking for the implications of the measurements and perhaps the differences in what they're actually measuring, if any.


Solution 1:

The volume block size can also be thought of as the 'logical block size' this is the block size that the filesystem you lay down on a hard drive is set to.

The partition block size is essentially the size at which the hardware that is writing bits to the hard drive can write at (a/k/a "Physical Block Size"). On lower end and desktop controllers this will generally be fixed (normally in the 8 to 64k range) on higher end controllers this is configurable up to some maximum that is set by the manufacturer.

Now, why are block sizes important? Well, that's a bit of a longer answer. but depending on your application and the size of the files that it reads and writes. Generally you have two places that you need to pay attention to:

File Size:

Each file will take up at least one block, generally many more. You cannot have multiple files written to the same block. In the case of many small files, you will start losing a good deal of your available disk space. For example: I have a disk that is 1024 MB with a block size of 64k for a total of 16,000 blocks on the disk, however I'm only writing files that are 2kb a piece that means that for each 2k of data I write I take up 64k of space on the disk. This would lose me ~62k of disk space per write.

Performance:

Where block size comes in to play for performance is that you want your logical block size to align with your physical block size so that when you are reading or writing to disk you don't have to go fetch more blocks from the controller than you really need. For example say your blocks are not aligned. They are both 64k, and you are reading a 59k file. Now when you go to read that file from disk your controller need to go out and grab two blocks for a total of 128k being pulled through the controller just to grab the data that is contained on one block of data on the logical partition.

On the opposite end, if you are reading or writing large files from disk it is more efficient to use a larger block size so that the controller and file system can grab more data in one pass than the would with smaller block sizes.