Linux – How to Get Hard Disk Information from /proc and /sys

hard-disklinuxprocsysfs

How can I get hard disk capacity, usage, etc. using the /proc or /sys filesystems?

If it is possible, please tell me which file(s) I need to process to get that information.

Best Answer

Refer kernel docs for block device subsystem. stat.txt is for block device I/O stats.

Kernel/userspace ABI docs is also useful, see sysfs-block for comprehensive list of available sysfs entries.

You can also get block device capacities from /proc/partitions.

Related Question