#!/bin/sh
# http://www.berklix.com/~jhs/bin/.sh/lslf
# ~/bin/.sh/lslf by Julian H. Stacey

# This is run manually after a crash to see if there is junk to clean up

# mount -p        | awk '{printf "%s\n",$2}' | sort | grep -v /host | grep -v /.amd_mnt | grep -v /dev | grep -v /proc > /tmp/filter
# mount -p -t ufs | awk '{printf "%s\n",$2}' | sort                                                                    > /tmp/ufs
# cmp /tmp/filter /tmp/ufs	# same, but do we got lost+dound on msdosfs too ? 
# & do all FFS UFS show up as -t ufs ? 
# so use the longer version till those questions are resolved

for i in `mount -p | awk '{printf "%s\n",$2}' | sort | \
	  grep -v /host | grep -v /.amd_mnt | grep -v /dev | grep -v /proc`
	do
	# This does discover /host/lapr/crypt/fs/1700m/lost+found/#*
	echo "Testing $i/lost+found:"
	if [ -d $i/lost+found ]
		then	# {
		echo $i/lost+found
		ls $i/lost+found
		echo "Above is $i/lost+found"	# In case big page title after.
		echo " "
		fi	# }
	if [ -d $i/tmp/RM ]
		then	# {
		echo "Suggestion: rm -rf $i/tmp/RM"
		# These are created by a human who at time of removal
		# does not want to either:
		# - slow the machine by deleting big trees. Or
		# - Risk a machine crash half way through leaving a half 
		#   depleted tree, which might later be mistaken for a 
		#   full tree.
		# So human moves it to top of tree for later removal,
		# in case it gets forgotten & consumes space, be
		# reminded to remove the litter
		echo " "
		fi	# }
	done

echo "vi -r	As normal user:"
vi -r
echo
echo "vi -r	As super user:"
xs vi -r
