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

Jesse Monroy jesse650 at gmail.com
Tue Aug 2 12:08:26 PDT 2011

No. BSD differs slightly. Output below.


===FreeBSD 7.2-RELEASE===
[warehouse] ~> mount
/dev/ad4s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad4s1e on /tmp (ufs, local, soft-updates)
/dev/ad4s1f on /usr (ufs, local, soft-updates)
/dev/ad4s1d on /var (ufs, local, soft-updates)

===Ubuntu 10.10===
jessem at pavlov:~$ mount
/dev/loop0 on / type ext4 (rw,errors=remount-ro,commit=0)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
/dev/sda1 on /host type fuseblk
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc
gvfs-fuse-daemon on /home/jessem/.gvfs type fuse.gvfs-fuse-daemon

On 8/2/11, Robert Hajime Lanning <lanning at lanning.cc> wrote:
> 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
> --
>       --MCP
> _______________________________________________
> svlug mailing list
> svlug at lists.svlug.org
> http://lists.svlug.org/lists/listinfo/svlug

More information about the svlug mailing list