Question : To find the total space occupied by some partitions

I have a list of partitions from which I have to find out the total disk space and free space from selected partitions.

Example from the below:

/proc                    0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
fd                       0K     0K     0K     0%    /dev/fd
/dev/vx/dsk/bootdg/var
                        12G   5.0G   6.7G    43%    /var
swap                   8.4G   184K   8.4G     1%    /var/run
dmpfs                  8.4G     0K   8.4G     0%    /dev/vx/dmp
dmpfs                  8.4G     0K   8.4G     0%    /dev/vx/rdmp
swap                   8.5G   140M   8.4G     2%    /tmp
/dev/vx/dsk/bootdg/home
                        12G   5.8G   5.9G    50%    /export/home
/dev/vx/dsk/datadg/appsvol
                        20G    18G   2.2G    89%    /WebLogic/apps
/dev/vx/dsk/datadg/appdata1vol
                        29G    26G   3.2G    89%    /WebLogic/appdata1

I want to find out the total disk space and free space for /dev/vx/dsk/datadg/appsvol and /dev/vx/dsk/datadg/appdata1vol.

Total space: 49G
Used Space:44G
Free Space:5.4G

Answer : To find the total space occupied by some partitions

you can always do df -k /mountpoint e.g.

df -k /export/home

which gives

Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t2d0s3    51622984 1601501 49505254     4%    /export/home

you may put it in a script:

fsys=$1
set `df -k $fsys | tail -1`
ts=`expr $2 / 1024 / 1024`
us=`expr $3 / 1024 / 1024`
fs=`expr $4 / 1024 / 1024`

echo "$fs:
Total Space: $ts GB
Used Space: $us GB
Free Space: $fs GB"

Random Solutions  
 
programming4us programming4us