LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-11-2011, 01:08 PM   #1
matthes138
LQ Newbie
 
Registered: May 2009
Posts: 6

Rep: Reputation: 0
Looking for a way to check mount point is mounted and is writeable


Looking for a way to check a mount point is mounted and is writable and if not remount the mount point. For some reason this mount point will become unavailable to write too and when the script runs, to copy files to the mount point it fails.
In the fstab it is listed as
/dev/sdc1 /mnt/iscsi ext3 _netdev 0 0
this has worked fine for a couple of years but now it will get lost for some reason?
And if I umount and mount the device again it will work for a while?

I need to write a shell script to monitor a Linux mount point on Linux. Basically, this is what I want the script to do:

* check if the mount point is there; if yes, do nothing

* if no, try to mount it again
I can put this into a cron job to run ever so often



Thanks for any help.


Any help would be great!!!

Last edited by matthes138; 11-11-2011 at 02:21 PM.
 
Old 11-11-2011, 01:40 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Quote:
Originally Posted by matthes138 View Post
Looking for a way to check a mount point is mounted (..) For some reason this mount point will become unavailable (..) this has worked fine for a couple of years but now it will get lost for some reason? And if I umount and mount the device again it will work for a while?
IMHO looking for a 'if iscsiadm sez status umounted || mount' fix is like treating symptoms. As it worked before you should review system changes, check system and daemon logs for clues, maybe run in the iscsi daemon debug mode, monitor network conditions, etc, etc to find the actual cause.
 
Old 01-03-2012, 01:56 AM   #3
digitaldude
LQ Newbie
 
Registered: Sep 2010
Posts: 20

Rep: Reputation: 0
use "monit" to check whether a device is mounted or not.

This is how it'll be:

Code:
check filesystem datafs with path /dev/sdb1
       group server
       start program  = "/bin/mount /data"
       stop program  =  "/bin/umount /data"
       if failed permission 660 then unmonitor
       if failed uid root then unmonitor
       if failed gid disk then unmonitor
       if space usage > 80 % then alert
       if space usage > 94 % then stop
       if inode usage > 80 % then alert
       if inode usage > 94 % then stop
       alert root@localhost
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to ensure mount point is mounted correctly ? hk_centos Linux - Newbie 4 06-24-2011 07:14 AM
Mount problem - device already mounted or mount point busy zahoo Linux - General 7 08-28-2009 06:02 PM
Mount Problem: evice already mounted or mount point busy paldebojyoti Linux - Distributions 5 08-27-2009 03:46 AM
SCRIPT: check if auto-mount mount-points are still mounted markus1982 Linux - Software 0 05-25-2003 06:48 AM
making a vfat mount point writeable for users stevenhasty Linux - Newbie 27 03-31-2003 10:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration