#!/bin/ksh
#< Quick check of lost+found directories - should be scheduled as a cronjob
# For best results, periodically run ff and store the output - then you
# have a better chance of identifying the files based on inode number if they
# do end up in a lost+found directory
# Platform: Solaris
if [ `id | sed 's/^uid=\([0-9][0-9]*\)(.*$/\1/'` -ne "0" ]; then
echo "You must be root to run this script" >&2
exit 1
fi
# the awk regex allows for md devices too
df -k | awk '$0 ~ /^\/dev.*\/dsk\// {print $6}' | while read fs; do
checkMe=$(echo "${fs}/lost+found" | sed 's!^//!/!')
if [ -d "${checkMe}" ]; then
echo "Listing lost+found on ${fs}"
ls -l ${checkMe}
fi
done
exit 0