LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-27-2011, 04:33 AM   #1
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Rep: Reputation: 12
test mount


Hi all

Another question...
How do i check if NFS mounts are still up and running?

when i do the command MOUNT , i get some result, but how can i see (or check) if they still up and running?
I'm not so familiar with this command, so i hope that someone can guide me

I know that there must be some NFS links mounted, so if one fails, i need to see that with like an echo or something.
So my main question is, how do i check this?

Thanks in advance everyone !
 
Old 04-27-2011, 05:18 AM   #2
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.0 at present.
Posts: 1,168

Rep: Reputation: 201Reputation: 201Reputation: 201
OK, just an off-the-wall thought. How about if you embed a small file on each mount, just a text file that says something like " NFS Mount #1 alive" then set up something which will poll the files and verify the mount's existance every half hour/ hour or whatever and flag you if it gets lost.

You'll note I'm into concepts at the moment so I won't bother you with details!

My

Play Bonny!
 
Old 04-27-2011, 05:21 AM   #3
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
i know what you mean about the concept, and maybe it's a last case scenario, because they want me to deal with it with the least of extra files (if you know what i mean)
So if i suggested this, they would 'like' it, but they'll ask me to look for another solution

can't i do something with this command ??
Code:
# showmount
i really would like this to work guys
 
Old 04-27-2011, 05:54 AM   #4
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.0 at present.
Posts: 1,168

Rep: Reputation: 201Reputation: 201Reputation: 201
What do you get with
Code:
 # mount
It should show all local and NFS mounted disks/partitions I would think.
Here's my next thought... If you know you've got everything mounted you could run
Code:
# mount > default_mount
which should give you a file with your, er... default or "what's expected" mounts.
Then, if you ran
Code:
# mount > current_mount
at whatever time period you want and compared default_mount with current_mount (deleting current_mount after the comparison) you'd get a go/no go answer.

Any use?

Play Bonny!

Last edited by Soadyheid; 04-27-2011 at 05:55 AM. Reason: Typo
 
Old 04-27-2011, 06:01 AM   #5
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
first of all, thanks for your reply i'll sure test it

Code:
# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
So are these the mounts that are installed AND working? because i see there something like NONE , do i first need to filter them out? or is that normal?

greetz
 
Old 04-27-2011, 06:25 AM   #6
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
okay, i've filtered the 'none' pieces with

Code:
mount | grep -v none > /default_mount
and then i made a script which does the following:

Code:
#!/bin/sh

mount | grep -v none > /current_mount

sdiff default_mount current_mount
output:
Code:
# ./testscript.sh
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)           /dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
usbfs on /proc/bus/usb type usbfs (rw)                        usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw)                             /dev/sda1 on /boot type ext3 (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)        sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
so, you see that both files are the same. So how do i transfer this to a message, like 'Files are the same' ? or something like that
 
Old 04-27-2011, 07:20 AM   #7
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
okay, this is my function

Code:
test_mount() {
	$touch /current_mount
	$chmod 777 /current_mount
	$mount | $grep -v none > /current_mount

	VAR=`$diff -s /default_mount /current_mount`

	if  [ "$VAR" = "Files /default_mount and /current_mount are identical" ]; then
		# OK
                value6=0
	else
		# CRITICAL
                value6=2
	fi
	
	$rm -f /current_mount
}
i think this is a temporarily solution, but for now it works
 
Old 04-27-2011, 07:26 AM   #8
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.0 at present.
Posts: 1,168

Rep: Reputation: 201Reputation: 201Reputation: 201
I can only see one NFS mount, [code]sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)[/quote] would that be correct?
You've also got sda1 which I'll asume is your main system disk.

I'd have to check what you can do with "sdiff" but I'm not sitting at my Linux system at present (See XP flag bottom left of Post!)

If there's a trap you should be able to catch it with an "if then" sort of statement within your script. (Good grief, I haven't programmed anything in years!)

You should be able to test it by plugging a USB pen in to fail the comparison.

Anyway, Play Bonny!

Last edited by Soadyheid; 04-27-2011 at 07:27 AM.
 
Old 04-27-2011, 08:06 AM   #9
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
i don't understand (yet) how to see what are mounts and which are not, i know what they do, but i can't say for sure if that are the mounts on that server ...

diff or sdiff compares the content of files. sdiff really shows the output and diff not, so i don't need them to show what they are comparing, i just need to know if they are the some or not (that's why i use diff and argument -s)

I know it's rather strange to check the IF statement like i programmed, but i still don't know how to get the result (the diff is giving) to transform them as a number or a boolean or whatever...

so if anyone has a suggestion, i'd like to hear ^^
 
Old 04-27-2011, 09:45 AM   #10
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.0 at present.
Posts: 1,168

Rep: Reputation: 201Reputation: 201Reputation: 201
Thought.... What do you get when you type
Code:
# df -h
It should show you filesystems rather than mounts but it may be more readable/understandable.

Play Bonny!
 
Old 04-28-2011, 02:04 AM   #11
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
Quote:
Originally Posted by Soadyheid View Post
Thought.... What do you get when you type
Code:
# df -h
It should show you filesystems rather than mounts but it may be more readable/understandable.

Play Bonny!
Code:
# df -h
Filesystem                          Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00     143G  5.5G  131G   5% /
/dev/sda1                            99M   13M   81M  14% /boot
none                               1013M     0 1013M   0% /dev/shm
 
Old 04-28-2011, 04:47 AM   #12
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.0 at present.
Posts: 1,168

Rep: Reputation: 201Reputation: 201Reputation: 201
Hmmm... I'd have thought any NFS mounts/filesystems should have shown up.
Anybody else out there with any ideas?

Play Bonny!
 
Old 04-28-2011, 04:51 AM   #13
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
yeah, that's the problem, i don't know if there are NFS mounts on the serve i currently use...
But when i need to integrate this to the original server, there must be normally NFS mounts..
 
  


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
"automount: test mount forbidden or incorrect kernel protocol version" in RHEL 5 jackofalltrades Linux - Networking 2 08-01-2012 04:20 AM
[SOLVED] Silencing the line "echo test > test/test.txt" in a shell script Arenlor Linux - General 2 06-18-2010 02:37 PM
test if smbfs is used for mount? taiwf Linux - Software 1 04-11-2006 03:23 AM


All times are GMT -5. The time now is 05:19 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration