My understanding is that the block (in the phrase "block size") is like an IO buffer, or minimum IO size for a device. Since partitions are built on top of physical devices, how can they have blocks of even smaller size? For example on my machine, I got 1024 for xvda1 but 4096 for xvda. See the code below:

λ> sudo blockdev --getbsz /dev/xvda
λ> sudo blockdev --getbsz /dev/xvda1
λ> sudo fdisk -l /dev/xvda
Disk /dev/xvda: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8be88ed1

Device     Boot    Start       End  Sectors  Size Id Type
/dev/xvda1 *        2048    409599   407552  199M 83 Linux
/dev/xvda2        409600  41943039 41533440 19.8G 83 Linux
/dev/xvda3      41943040  58720255 16777216    8G 82 Linux swap / Solaris
/dev/xvda4      58720256 104857599 46137344   22G 83 Linux


I think "block size" of a block device (eg. a partition), and "block size" of a file system, are two different things. Eg:

λ> sudo dumpe2fs -h /dev/xvda3 | grep -i 'block size'
dumpe2fs 1.42.13 (17-May-2015)
dumpe2fs: Bad magic number in super-block while trying to open /dev/xvda3
λ> sudo blockdev --getbsz /dev/xvda3
  • Curiously, I've found that extended partitions (number >= 5, as opposed to primary partitions 1-4) have the 4096 again. – o11c Apr 7 '16 at 17:36
  • I don't understand you edit. xvda3 is a swap partition, how could dumpe2fs report anything about it? – L. Levrel Apr 9 '16 at 20:08
  • That is exactly my point. What I was asking is the block size of a partition (xvda1 or xvda3) and a disk (xvda), not a file system. However your answer seems to be about filesystem. – wlnirvana Apr 9 '16 at 21:23

fdisk reports "bogus" physical sector sizes. A kind of "historical compatibility".

The system or the disk hardware is able to emulate 512-byte sectors if the alignment of your partitions requires this, but it is slower (and probably wears off SSDs faster). That's why it is widely recommended to align partitions on larger boundaries, as are yours (they are aligned on 2048*512=1 MB).

  • Could you please elaborate on this? I don't really understand how it is related to block size (instead of sector size). – wlnirvana Apr 8 '16 at 8:47
  • AFAIU blocks of a filesystem are logical, just as 512-byte sectors are, so the 1 kB reported for partition 1 has no hardware basis. On big SSDs the erase block size (hardware) can be 1 MB I think. – L. Levrel Apr 8 '16 at 20:39
  • I think blocks of a file system are different from blocks of a block device. See update above. – wlnirvana Apr 9 '16 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.