[svlug] Need a shell/bash loop over each partition and execute dd && rm
Robert Hajime Lanning
lanning at lanning.cc
Tue Aug 2 04:34:08 PDT 2011
On 08/01/11 21:51, Robert Hajime Lanning wrote:
> Also note that long /dev paths will break df output to two lines.
>
> Maybe parsing the output of "mount"?
> I know on Linux, you can:
> echo $( mount | grep "^/" | cut -d" " -f3 )
>
> I don't have a BSD machine to check mount's output there.
>
I know, bad form to reply to my reply... :)
#! /bin/bash
# hopefully BSD uses the same output format for mount(8)
mount | grep "^/" | sed 's/^.* on \(.*\) type .*$/\1/' | \
while read MOUNTPOINT; do
echo "Zeroing unused blocks in ${MOUNTPOINT}"
sudo dd if=/dev/zero of=${MOUNTPOINT}/zerofile && \
sudo rm ${MOUNTPOINT}/zerofile
done
--
END OF LINE
--MCP
More information about the svlug
mailing list