I run the command df -g to get the GB block sizes in the second column (left to right). If I want to get the total capacity for all hard disks, which command should I use?
OS is AIX.
I run the command df -g to get the GB block sizes in the second column (left to right). If I want to get the total capacity for all hard disks, which command should I use?
OS is AIX.
for i in `lspv | awk '{print $1}'`
do
echo $i
lsattr -El -a size_in_mb $i
done
Or via ODM:
odmget -q"name like hdisk* and attribute=size_in_mb" CuAt
Total size of all disks (sum). Output in GB.
TOTAL=0; for DISK in $(lspv | awk '{ print $1 }');do SIZE=$(bootinfo -s $DISK); TOTAL=$(echo "$TOTAL + $SIZE"|bc); done; echo "$TOTAL / 1024" | bc
Used Commands
lspv: lists all disks
bootinfo -s: gives you the real size of the disk
bc: used for calculating
The following command will help you to find total size of each hdd on your system.
fdisk -l | grep Disk
I know you didn't ask this directly but df -h
lists created partition sizes which is sometimes more useful.
For AIX try the following, which does NOT need to be run as root:
get_conf DISK_SIZE /dev/hdisk0
The output will be returned in MB.
Not sitting in front of an AIX system, but try this:
df --total -h
Edit: this won't work in AIX. But I'll leave this here for anyone else who might need it on GNU systems.