#StackBounty: #linux #partition #block-device Units for size in /proc/partitions don't make sense

Bounty: 50

I have a Seagate 750GB drive.

Parted shows the drive as 750GB

parted /dev/sdc print
Model: ST375064 0AS (scsi)
Disk /dev/sdc: 750GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End    Size   File system  Name     Flags
 1      17.4kB  750GB  750GB  ext3         primary

However, the size entry in /proc/partitions is supposedly in blocks:

cat /proc/partitions
major minor  #blocks  name
8       32  732574584 sdc

Parted says the block size is 512B, blockdev --getbsz /dev/sdc says the block size is 4096.

But… it is clear that /proc/partition is wrongly reporting the device size in KiB rather than blocks.

Can this behavior be depended on across Linux and/or kernel versions? (I need a scriptable and consistent way of finding the size of a block device)

Centos 6.6 with 3.10 kernel.

EDIT I

lsblk -o kname,phy-sec,log-sec,min-io
KNAME PHY-SEC LOG-SEC MIN-IO
sda       512     512    512
sda1      512     512    512
sda2      512     512    512


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.