Is the file located under:/sys/block/<xxx>/sizeConstantly referencing to 512 byte block count, or is there any special cases where the block count changes?I'm curious because:thinkpad :: /sys/block/sdf % cat queue/physical_block_size                                                                                                                         4096thinkpad :: /sys/block/sdf % cat queue/logical_block_size                                                                                                                          4096thinkpad :: /sys/block/sdf % cat size                                                                                                                                              1540864015408640 * 512 bytes / 1000000000 = ~8GB -> the size of my device, its correct but the device is a 4K block device.
sysfs block size count
sysfs
The size entry returns the nr_sects field of the block device structure. Traditionally, in Unix disk size contexts, sector or block means 512 bytes, regardless of what the manufacturer of the underlying hardware might call a sector or block. I can't find authoritative documentation, but looking at the Linux source code (e.g. 1) 2) it looks like the nr_sects field is indeed expressed in units of 512 bytes.You can approach it another way: since there is no file reporting the unit, it has to be a constant unit, otherwise applications wouldn't know what the value means. (The queue subdirectory is not necessarily present, it depends on the block device.)