The purpose is to obtain information about the physical hard disk under the Linux platform. The required information include:
- physical hard drive name (caption)
- device path (such as
- read/write rate and read and write throughput of each physical disk
- total disk capacity
- remaining available capacity per physical disk
I eventually need to get this information in the program in C++. But I would also accept the command line acquisition method.
I have tried
fdisk, etc. But some of these commands are not available on different Linux distributions. As well, these methods can't get all the information I want.
I also tried to get information from
/sys/block, etc., but it didn't solve the problem. The confusion between logical disks and physical disks also makes processing difficult. It is important to emphasize that the information you need to obtain is for each physical disk.
Is there a more general way to use on most distributions?