LINUX - find out drive disk size

HOW TO CALCULATE DISK SIZE ON SYSTEMS WITHOUT SMARTCTL

#########################################################


SIMPLE:

Here is a simple way as blockdev is a command thats even included on old  units

blockdev --report /dev/hdc

Sector Size is in bytes

Disk Size is given sectors

Multiply the two to get the answer

Formula:

sector size (in bytes) * disk size (in sector) = size of disks


ANOTHER WAY: blockdev and notice the option that says get device size in bytes for me its --getsize64

blockdev --getsize64 /dev/sdc

OUTPUT: 2000398934016 

Plug that # to www.wolframalpha.com appended with the word bytes: "2000398934016 bytes" -> www.wolframalpha.com


ALSO THE BEST AND SIMPLEST WAY!!!:

dmesg

LOOK FOR:

sd 0:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

sd 1:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)


​NOTICE THE COMMON WORD - THERE ARE A FEW BUT blocks IS THE LOGICAL WORD TO PICK:

dmesg | grep -i "blocks" 

OUTPUT:

sd 0:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

sd 1:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

sd 6:0:0:0: [sdc] 244736 512-byte logical blocks: (125 MB/119 MiB)

sd 7:0:0:0: [sdd] 62816256 512-byte logical blocks: (32.1 GB/29.9 GiB)


WITH SMARTCTL

################

smartctl -a /dev/sda | grep -i "user capacity"​

SelectionFile type iconFile nameDescriptionSizeRevisionTimeUser
Comments