This discussion is archived
0 Replies Latest reply: Nov 28, 2012 4:11 PM by 976733 RSS

Discovering partitions for automated script routine

976733 Newbie
Currently Being Moderated
Hi all,
I've been working on a script to run a disk wipe (using Jim Garlick's scrub tool) on the filesystem in Xerox production printer RIPs.
Easy enough if there's just one partition, but I need to cater for the possibility of multiple drives/partitions, and either ZFS or UFS (don't know if that matters).
I can't quite figure out how to detect whether the partitions are on separate partitions (or even HDDs), and set a string/variable to trigger a second process or not.
e.g., I always want to run against the root, and typically there's a second partition with /var/spool/XRXnps mounted on it, so a second (perhaps simultaneously by backgrounding the first one) run on that (unless it's mounted on the root as well).

I hope that's clear (I'll paste my code so far below, but note ../XRXnps directory exists regardless whether under its own partition, or under the root partition).

Cheers, DD
echo "Performing scrub process on root partition..."
/usr/local/bin/scrub -f -p dod -X /junk &

# perform same routine on second partition (if it exists)
if [ -d "/var/spool/XRXnps" ]; then
     echo "Performing scrub process on XRXnps partition..."
     /usr/local/bin/scrub -p dod -X /var/spool/XRXnps/junk
echo "Disk scrub complete."

Edited by: 973730 on Nov 28, 2012 4:09 PM


  • Correct Answers - 10 points
  • Helpful Answers - 5 points