LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to get mounted IP address into text file (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-get-mounted-ip-address-into-text-file-884754/)

hk_centos 06-06-2011 02:06 AM

how to get mounted IP address into text file
 
I am sharing directories using NFS.so one machine mounted those locations (Server). so i need to get what are the machine which successfully mounted (IP address of mounted locations).
At the boot time server mount the remote location.but i want to get what are the successfully mounted location into text file.

thanks,

the_bigbalu 06-06-2011 02:26 AM

Usually, you can see it on /etc/mtab

i hope thats what you meant

manyrootsofallevil 06-06-2011 02:34 AM

Quote:

Originally Posted by hk_centos (Post 4377501)
I am sharing directories using NFS.so one machine mounted those locations (Server). so i need to get what are the machine which successfully mounted (IP address of mounted locations).
At the boot time server mount the remote location.but i want to get what are the successfully mounted location into text file.

thanks,

From the NFS server you could run this, but according to the manual this is not reliable.

Code:

showmount -a > textfile
Thus, you are better off looking at the network connections

Code:

netstat -a | grep nfs > textfile

hk_centos 06-08-2011 02:02 AM

What is a mean about this error
 
when type a command
showmount -a

it will give a error message
mount clntudp_create:RPC:Program not registered

how can i solve this problem

thanks,

venikathir 06-08-2011 02:11 AM

u are not configured the NFS on ur machine.
check the machine NFS is running and configured then try showmount -e <server ip/name>

Regds
KVK
India

hk_centos 06-08-2011 02:22 AM

still i'm having same problem mates.

I'm unable to get machines IP's which were successfully mounted into NFS Client. Actually my NFS client work as distributor. he will store the data files among his NFS servers. NFS server only export his location to NFS client.(one NFS client and many NFS servers)

to store data files NFS client need to know what are the successfully mounted remote locations(NFS Servers).Because some NFS server machine can be in power off state. therefore i need to get success fully mounted NFS servers IP's

Please Help Me Friends,

thanks.

hk_centos 06-08-2011 02:26 AM

Quote:

Originally Posted by venikathir (Post 4379529)
u are not configured the NFS on ur machine.
check the machine NFS is running and configured then try showmount -e <server ip/name>

Regds
KVK
India

Dear KVK,

I restart nfs service like this
service nfs start
chkconfig nfs on

now it'sworking

still i'm unable to get IP's of successfully mounted machines

Thanks,

hk_centos 06-09-2011 01:53 AM

How to run script just before shutdown/restart the LInux machine
 
Hey Guys,
I need to know how to run script just befor shutdown /restart the linux machine. actually what i want is pass the message to another machine saying I'm shutting down.

Please give sample script (specially mention how to set runlevels)

Thanks,

manyrootsofallevil 06-09-2011 02:22 AM

Quote:

Originally Posted by hk_centos (Post 4379535)
still i'm having same problem mates.

I'm unable to get machines IP's which were successfully mounted into NFS Client. Actually my NFS client work as distributor. he will store the data files among his NFS servers. NFS server only export his location to NFS client.(one NFS client and many NFS servers)

to store data files NFS client need to know what are the successfully mounted remote locations(NFS Servers).Because some NFS server machine can be in power off state. therefore i need to get success fully mounted NFS servers IP's

Please Help Me Friends,

thanks.

I'm a bit confused, by this. You have 1 client and multiple servers?

The mount is initiated by the client, so if you have only one client, that is where you need to look, namely in the client. As pointed out before by the_bigbalu, you just need to look at /etc/mtab, which will tell you what is currently mounted at the moment by the server. You could also just run mount, which will tell you what file systems the client has mounted.

In order to run a script during shutdown, just place the script in /etc/rc.d/rc0.d (/etc/rc.d/rc6.d for reboot) and prepend Knn to the name of the script, where nn is a number that indicates the running order of the script if memory serves right.

To check whether a server is up, you could ping the host once ping <ip> -c 1 and parse the output to check whether it responds.

Hope this helps, but I'm not sure this is what you want.

hk_centos 06-09-2011 06:55 AM

i when i type
vi /etc/ftab | grep nfs
it shows all mounted point and location (by nfs) it is ok, but suddenly one machine can be down (power failure or any reasons).Then i'm unable to access that location.
again i typed same command and shows a same result. but actually one location is physically down. hw can i solve this problem.

PS: Are there any methods to restart mount location without restarting machine.(My server can't reboot it work as 24/7 )

hw to re-mount nfs location without restarting machine

thanks,

chrism01 06-10-2011 01:31 AM

Code:

/etc/fstab
is just a wish list as far as the OS is concerned.
If you
Code:

cat /etc/mtab
that will tell you what is actually mounted, as will
Code:

df -h
You can use the mount cmd to mount a specific drive; http://linux.die.net/man/8/mount. Use the -a switch to (attempt to) mount everything mentioned in /etc/fstab.

hk_centos 06-10-2011 03:12 AM

Dear Chris,

Thank you for your kind assistant.

df -h

list down all actually mounted location. in a situation mounted location can be unavailable (power failure). still df -h provide same result. how can i get that unexpected failure to know up and running mounted locations.

PS:- What i want is to get actually mounted location repeatedly. (it can be kind of script which runs given interval)

Thanks

hk_centos 06-12-2011 12:09 AM

mount -a -t nfs

mount all nfs type remote location accordingly /etc/fstab

eachn nfs server will run this command at each reboot time

exportfs -r ( try to add this into init.d )


All times are GMT -5. The time now is 11:14 PM.