[svlug] Need a shell/bash loop over each partition and execute dd && rm

John Sokol john.sokol at gmail.com
Mon Aug 1 21:16:20 PDT 2011

Good catch Rick, don't want to do that in wrong file systems.

Also NFS mounts would be bad, really bad.

On Mon, Aug 1, 2011 at 9:09 PM, Rick Moen <rick at linuxmafia.com> wrote:

> Quoting John Sokol (john.sokol at gmail.com):
> > Make sure the list of partitions looks correct.
> If you'll pardon brief kibbitzing, here's a very minor refinement to your
> script, to exclude various abstract or odd Linux filesystems, in
> addition to the df header line with the word 'Available' in it:
> #!/bin/bash
> for h in $( `df | egrep -v
> 'Available|tmpfs|udev|ramfs|romfs|cramfs|debugfs' | \
> awk '{print $NF}'`   );do
>   echo "Cleaning partition $h"
>   sudo dd if=/dev/zero of=$hzerofile && sudo rm $hzerofile
> done
> Only the udev and tmpfs ones are likely to be common problems, but
> I threw in the others just in case.
> _______________________________________________
> svlug mailing list
> svlug at lists.svlug.org
> http://lists.svlug.org/lists/listinfo/svlug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.svlug.org/archives/svlug/attachments/20110801/99b46488/attachment.htm

More information about the svlug mailing list