If we want to get the byte size of a block device or one of its partitions without calling any binary, and in a way that will always work, is it correct to do:
/sys/block/sda/sda1/size
or /sys/block/sda/size
Multiplied by :
/sys/block/sda/queue/physical_block_size
Or is it logical_block_size or hw_sector_size ?
Is there a better approach?