What is the command line command to get the number of physical disks in Linux Server and how much space is used on each?
|
I put the sudos in there because I got no output from fdisk and only partial output from df when I ran the commands as a regular user, I suppose because the commands read from somewhere off limits to non-admins. |
||||
|
|
|
You'd think there'd be a simple answer to this, but it actually depends on what you mean by "physical disk". iSCSI volumes and RAID devices (for example) appear as physical disks, but the tools one uses to examine these differ. If you just mean a plain SATA or SCSI drive attached directly to a host controller on the motherboard of the server, you're looking for actively used devices located at /dev/sdN, so you can grep through your dmesg for them (dmesg | grep sd) or you could look in /dev/disk/by-id or yet again you can look in /proc/diskstats. Once you've identified the /dev/ entry for devices that are present, you can use the appropriate tool to check for free space. This again depends on other info, such as how they were partitioned, whether they use the lvm, and so on. |
|||||||||
|