Question: I need to report on the sum of disk allocated for Linux directories dedicated to DB2 LUW directories . How can I sum the directories disk allocated ?
I've tried various procedures but the sums arent't adding to same totals that are displayed when df - h is printed
Answer: There's a few different ways of getting to the same total . Here's a simple example of the sum of disk allocated for two directories. In the example below - I'm adding disk allocated for /mydir and /mydir/logs
df -h /mydir/ /mydir/logs | awk '{ alloc += $1 } END {print alloc}'
In this example the directories allocated as static . If the requirement was to do something more dynamic - you'll need to put some extra scripting around this code to drop the directory names in the line
Top 10 Yoda tips for the Linux command line