Find the answer to your Linux question:
Results 1 to 6 of 6
Can you help me in some thing, I have mounted nearly 3 of my Systems to 1 of my Server. I'm using Cent OS 5, if I restart the server ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Location
    I Live at chennai
    Posts
    9

    Losing mounts on CentOS 5


    Can you help me in some thing, I have mounted nearly 3 of my Systems to 1 of my Server. I'm using Cent OS 5, if I restart the server I loose the Mounts, so I've to manually mount them each time I restart.

    is there a shell script to check for all 3 Mounts and automatically start them if Any one of the Mounts are down. how to do this please help me ..

    Thanks if you would help



    Quote Originally Posted by hali View Post
    Hi,

    Either do this by checking for a known file on the NFS-mount (perhaps a mount-check flag file you have created).
    Code:
    if [ -f /nfs/mount1/.tagfile ]; then
     echo "Yep, mounted!"
    else
     echo "No, not mounted!"
    fi
    Another option is to check the /proc/mount 'file' for the desired mount.
    Code:
    if grep "^server:/nfs/mount1" /proc/mounts >/dev/null; then
     echo "YEAH!"
    else
     echo "NO"
    fi
    Good luck with your backup script, rsync rocks

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,915
    Did you declare the NFS mounts in /etc/fstab so that they're automatically mounted at boot time?

    If the other machines are down when the server starts, you do know that the mount process will fail, don't you?

    You can also use the 'mount' command and 'grep' to find if particualar partitions or disks are mounted, try:

    Code:
    # mount |grep 'sda1'
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Location
    I Live at chennai
    Posts
    9
    Thank you very much for your reply, I've already mounted my NFS at /etc/fstab , but it dint work I'm not sure why..

    (example) <server>:/home/data /home/softwares/lists nfs rw,hard,intr,rsize=8192,wsize=8192 0 0

    And since I have mounted nearly 3 to 4 NFS mounts, I thought of writing a script which would check each mounts to dirrerent machines every time individually via a crontab, and restart a particular mount if it is down..

    Any ideas how to do it ?
    suggestions ?

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Nov 2007
    Location
    I Live at chennai
    Posts
    9
    Hi any suggestions Please ?

  6. #5
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,915
    To check if a partition in fstab is mounted, use the mount command. If you grep for it's mountpoint, then it'll either report the mount or not. Try 'mount |grep <mountpoint>'.

    As an alternative, you can still call 'mount -a' and it'll fail to mount anything that is already mounted.
    Linux user #126863 - see http://linuxcounter.net/

  7. #6
    Just Joined!
    Join Date
    Nov 2007
    Location
    I Live at chennai
    Posts
    9
    Hi,

    Thank you very, I tried the following command

    mount -f nfs | grep 'mount point' its worked well.

    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •