After @Alexios suggestion I tried rebooting but /proc/partitions didn't change. Both /dev/sda and /dev/sdb are identical 500GB drives, but /dev/sda I formatted unaligned (using default 512 byte sector size starting after sector 63) and /dev/sdb aligned (using 4096 sector size starting after sector 255). As we can see, the system considers /dev/sdb just has less blocks than /dev/sda, although both were partitioned with the same sizes:

After you modified the partition table, did you ensure the kernel re-read it? If you change the partition table for a disk which has any partitions in use (even swap), the kernel won't re-read it. /proc/partitions will still reflect the old state of affairs. At that point, doing anything to that disk can have strange effects. The easy way to fix that is to reboot. (though there are better ways)
–
AlexiosAug 8 '12 at 7:18

Alexios, thanks for the tip. It didn't change though. I issued a partprobe before making the filesystems and after a reboot it kept the same (results on the recent edit).
–
ClaudioAug 8 '12 at 12:57

1 Answer
1

What is happening is that the -b switch is nonsense and should not even be there. The sector numbers recorded in the MBR are always interpreted to be in units of the drive's logical sector size ( 512 bytes ). By using the -b switch, you are causing fdisk to divide all of the sectors it records by 8, so the kernel interprets the partitions to be 1/8th the size you intended.

If you use parted instead of fdisk, it will make sure your partitions are properly aligned automatically. With fdisk, just make sure that the starting sectors are a multiple of 8.

Thanks for the input @psusi. What I did to solve the problem was indeed to repartition without the -b switch and start my first partition on sector 4096 to guarantee alignment, making both fdisk and mkfs stop complaining about performance degradation due to physical sectors misalignment. But I was still wondering why the system was interpreting the number of blocks as 512 byte long when the "right" switch was used.
–
ClaudioAug 8 '12 at 19:41

@Claudio, The -b switch is never "right" since it causes fdisk to pretend the size is not what it really is.
–
psusiAug 8 '12 at 20:01

Yeah.. I used "right" as an irony, because the simple existence of the switch misleads the user into thinking it should be used to specify the correct size to match the physical block.
–
ClaudioAug 8 '12 at 20:13