There are two allocation sizes that matter when looking at a file system: the filesystem's block size and the disk's sector size. Most SATA drives have 512-byte sectors, although there are exceptions: drives with 4KB sectors are not uncommon. You can get this information with
# hdparm -I /dev/sdb|grep Sector
Logical/Physical Sector size: 512 bytes
When mapped to filesystem blocks, however, 512 bytes imposes a fair amount of overhead when naming blocks if the drive is large enough (the metadata required to store allocation information is space that can't be used to store data.) Generally, the block size is determined automatically by the format program, but you can usually override it. For example, the method used for ext3/4 is as follows:
Specify how the filesystem is going to be used, so that
choose optimal filesystem parameters for that use. The usage types
that are supported are defined in the configuration file
/etc/mke2fs.conf(5). The user may specify one or more usage types
using a comma separated list.
If this option is is not specified,
mke2fs will pick a single
default usage type based on the size of the filesystem to be created.
If the filesystem size is less than or equal to 3 megabytes,
will use the filesystem type
floppy. If the filesystem size is greater
than 3 but less than or equal to 512 megabytes,
mke2fs(8) will use
mke2fs(8) will use the default
The defaults indicate that 4KB blocks are the default, as my
base_features = sparse_super,large_file,filetype,resize_inode,dir_index,ext_attr
default_mntopts = acl,user_xattr
enable_periodic_fsck = 0
blocksize = 4096
inode_size = 256
inode_ratio = 16384
%B is showing you the size of the physical sectors, which when multiplied by the number of sectors used
%b gives you the total number of bytes allocated on disk. It's usually of no relevance at all, as no filesystem allocation will be smaller than the block size, but it does help you determine that all allocations of physical sectors will be multiples of 8 (4KB/512 bytes=8):
# stat test.img
Size: 536870912 Blocks: 1048584 IO Block: 4096 regular file
So, with this information, you can determine the number of bytes allocated on-disk and unused allocated space for this file:
Number of blocks * block size = 1048584 blocks * 512 bytes/block = 536875008 bytes.
Amount of unused allocated space: 536875008-536870912 bytes = 4096 bytes unused.