Operating System - HP-UX
1827458 Members
5305 Online
109965 Solutions
New Discussion

Local File System Checks?

 
Jonathan Parkinson
New Member

Local File System Checks?

Has anyone written a script that checks if all volumes have been mounted and if they are present?

IE checks /etc/fstab and /usr/sbin/mount and compares them together?
4 REPLIES 4
Sridhar Bhaskarla
Honored Contributor

Re: Local File System Checks?

Jonathan,

#sed -n '/localmount/,/-----/p' /etc/rc.log

If there were any errors, they should be listed in /etc/rc.log. So, it's beter to check up this file.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Deshpande Prashant
Honored Contributor

Re: Local File System Checks?

Hi
Try this.
for i in `cat /etc/fstab |awk '{print $2}'`
{
echo "FS is ${i} :\c"
bdf |grep $i >/dev/null
if [ $? = 0 ]
then
echo " Mounted.."
else
echo " NOT MOUNTED.."
fi
}

Thanks.
Prashant.

Take it as it comes.
Roger Baptiste
Honored Contributor

Re: Local File System Checks?

hi,

grep -e hfs -e vxfs /etc/fstab >/tmp/checkfs
while read -r lv mt fs x y z
do
bdf $lv >>/tmp/checkfs.out 2>&1
if [ $? -eq 0 ]
then
echo "$lv is mounted ">>/tmp/checkfs.yes
else
echo "$lv is NOT mounted"
fi
done
***

-raj
Take it easy.
Bernie Vande Griend
Respected Contributor

Re: Local File System Checks?

I'd check against /etc/mnttab instead of using bdf:
This example used the devices, but you could change it to grab the mount points instead if you want.

for i in `grep ^\/dev /etc/fstab| awk '{print $1}'`
do
grep $i /etc/mnttab >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo $i is not mounted
fi
done

Hope this helps!

Ye who thinks he has a lot to say, probably shouldn't.