2

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.

freiheit
  • 14,544
  • 1
  • 47
  • 69
Vladimir
  • 179
  • 1
  • 1
  • 6

6 Answers6

2
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
Cakemox
  • 25,209
  • 6
  • 44
  • 67
1

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

keilr
  • 11
  • 2
  • 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 04 '14 at 11:00
0

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

fdisk -l  | grep Disk
Suku
  • 2,036
  • 13
  • 15
0

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

Jonathan Ross
  • 2,183
  • 11
  • 14
0

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.

Andrew Lott
  • 132
  • 12
hcsg25
  • 1
-1

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.

Joseph Kern
  • 9,899
  • 4
  • 32
  • 56