Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Which OS? I'm guessing Linux? –  growse Mar 31 '11 at 14:15
add comment

6 Answers 6

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
share|improve this answer
add comment

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

share|improve this answer
1  
Thank you for this. However, we do prefer at least a little explanation (such as what command you're getting the data from, I assume lspv plus bootinfo) and the reason for the scripting around it. Nonetheless, an upvote to you. –  Falcon Momot Jun 4 at 11:00
add comment

The following command will help you to find total size of each hdd on your system.

fdisk -l  | grep Disk
share|improve this answer
add comment

I know you didn't ask this directly but df -h lists created partition sizes which is sometimes more useful.

share|improve this answer
add comment

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.

share|improve this answer
2  
AIX commands don't support GNU like parameters. –  Benoit Mar 31 '11 at 15:18
    
hmmmm .... I thought that was too easy ... –  Joseph Kern Mar 31 '11 at 16:29
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.