Re: command to add filesystems size

dkoleary_at_attbi.com
Date: 11/13/03


Date: Thu, 13 Nov 2003 13:28:06 GMT

yls177 <yls177@hotmail.com> wrote:
> i did a df | grep SID |awk '{x+= $2} END {print "Sum is: " x}' and the
> result is "Sum is: 3.85679e+07"
> how do i interpret that?

Badly.

At least on the HP systems with which I'm familiar, df reports the
number of free blocks as field 4, not field 2. Assuming you're
getting the number of free blocks, divide the number by 2 to
get the number of free K in the filesystem. It's much easier to
do something like the following though:

bdf | grep SID | awk '{
        alloc+=$2; used+=$3; avail+=$4}
END {
        printf ("Alloc: %7.2f\nUsed: %7.2f\nFree: %7.2f\n",
                alloc/1024,used/1024,avail/1024)
}'

NOTE: Ensure the entire printf statement is on one line; I broke
it up for readability.

Doug

--------
Senior UNIX Admin
O'Leary Computer Enterprises
dkoleary@attbi.com (w) 630-904-6098 (c) 630-248-2749
resume: http://home.attbi.com/~dkoleary/resume.html