Just a little story about tonight's task. :-)
Due to a slight modification in our Final Cut Pro setups, I'm concerned with being able to quickly see the available space on our standard data volume. I checked the Extension Attributes page here at the Nation and found Boot Volume Free Space, a very simple script (I like simple!) that goes like this:
#!/bin/bash
free=`diskutil info / | grep "Free Space"| awk '{print $4}'`
echo "<result>"${free%.*}"</result>"
Pretty close...but it needs a couple of minor modifications to suit my needs. First, we need to change / to the appropriate volume, of course:
unit=`diskutil info /Volumes/Data Drive/ | grep "Free Space"| awk '{print $4}'`
Once I set this & ran recon on a group of machines, I found another problem: the output of this command puts out the number returned in the Free Space field - but it does not print the unit of measure! I saw several entries like 496, 197, etc - now, I know these are in GB, but several of my group are reading "1"...it was a moment before I realized that it wasn't because the drives were almost full, but that this meant 1 TB. Soo...let's try:
#!/bin/bash
free=`diskutil info /Volumes/Data Drive/ | grep "Free Space"| awk '{print $4}'`
unit=`diskutil info /Volumes/Data Drive/ | grep "Free Space"| awk '{print $5}'`
echo "<result>"${free%.*} $unit"</result>"
Perfect! Now, I get back meaningful readings (496 GB, 1 TB, etc).
And thus concludes a day (er, night) in the life. Onward...
