That is : How can I check the drive size which is not formatted... Don't consider the formatted drives...just unformatted drive.
Under Linux, if you want the size of the entire drive, read /sys/block/sda/size
.
To find the size of a partition, read /sys/block/sda/sda1/size
.
Replace sda
, sda1
with names of your devices/partitions.
Or, if you can open the raw device file, you can use the BLKGETSIZE
ioctl
.