Find the answer to your Linux question:
Results 1 to 8 of 8
I have Windows shares mounted on my Ubuntu media center. However, when the Windows machine is down the Linux machine hangs when trying to access folders that have links to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2003
    Posts
    51

    Linux hangs when network share is unavailable


    I have Windows shares mounted on my Ubuntu media center. However, when the Windows machine is down the Linux machine hangs when trying to access folders that have links to the Windows shares. So going into /media for example will hang because I have a videosd and videose folder that point to the Windows shares. It's really annoying. On top of that when I restart the machine it tries mounting the shares and will hang there forever trying to access the files it doesn't seem to time out. Anyone got any tips I can try. Here's my /etc/fstab file:

    # /etc/fstab: static file system information.
    #
    # <file system> <mount point> <type> <options> <dump> <pass>
    proc /proc proc defaults 0 0
    # /dev/sdb2
    UUID=77a55212-d927-4e48-9039-5b79d7c0a848 / ext3 relatime,errors=remount-ro,noatime 0 1
    # /dev/sdb1
    UUID=810a5d9d-d8a0-4fdd-9f92-032ff7e3ae03 none swap sw 0 0
    #/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
    LABEL=bigdrive /media/bigdrive ext3 defaults,noatime 0 0
    LABEL=usb /media/usb ext3 defaults,noatime 0 0
    LABEL=systemspare /media/systemspare ext3 defaults,noatime 0 0
    //192.168.1.101/videosd /media/videosd cifs defaults,username=gene,password=hea9671,uid=gene,u mask=000 0 0
    //192.168.1.101/videose /media/videose cifs defaults,username=gene,password=hea9671,uid=gene,u mask=000 0 0
    //192.168.1.101/dvd /media/mainbox_dvd cifs defaults,username=gene,password=hea9671,uid=gene,u mask=000 0 0
    LABEL=160GB-USB /media/160GB-USB ntfs-3g defaults,force,umask=000 0 0
    //192.168.1.101/software /media/software cifs defaults,username=gene,password=hea9671,uid=gene,u mask=000 0 0
    /dev/scd0 /media/usbdvd udf,iso9660 user,auto,exec,utf8 0 0
    //192.168.1.101/backup /media/backup cifs defaults,username=gene,password=hea9671,uid=gene,u mask=000 0 0
    //192.168.1.101/documents /media/documents cifs defaults,username=gene,password=hea9671,uid=gene,u mask=000 0 0
    //192.168.1.101/downloads /media/downloads cifs defaults,username=gene,password=hea9671,uid=gene,u mask=000 0 0

  2. #2
    Just Joined!
    Join Date
    Jul 2009
    Posts
    58
    What would like to happen to you go to a mount point that is not available? It can't magically show you the files. If you decrease the timeout you're going to have issues accessing large files across your network.

  3. #3
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    You could solve this pretty easily with a shell script, assuming you have root or sudo access. Instead of automounting them in fstab, you have a script that executes on startup. Here is the script:
    Code:
    #!/bin/bash
    
    ping -c 1 192.168.1.101 > /tmp/ping.txt
    
    if [ ! `grep "1 received" /tmp/ping.txt` = "" ] ; then
     echo "Mounting shares..."
     mount -t cifs -o defaults,username=gene,password=hea9671,uid=gene,umask=000 //192.168.1.101/videosd /media/videosd
     mount -t cifs -o defaults,username=gene,password=hea9671,uid=gene,umask=000 //192.168.1.101/videose /media/videose
     mount -t cifs -o defaults,username=gene,password=hea9671,uid=gene,umask=000 //192.168.1.101/dvd /media/mainbox_dvd
     mount -t cifs -o defaults,username=gene,password=hea9671,uid=gene,umask=000 //192.168.1.101/software /media/software
     mount -t cifs -o defaults,username=gene,password=hea9671,uid=gene,umask=000 //192.168.1.101/backup /media/backup
     mount -t cifs -o defaults,username=gene,password=hea9671,uid=gene,umask=000 //192.168.1.101/documents /media/documents
     mount -t cifs -o defaults,username=gene,password=hea9671,uid=gene,umask=000 //192.168.1.101/downloads /media/downloads
     echo "Done mounting shares."
    else
     echo "192.168.1.101 is not up!"
    fi
    This should work.

  4. #4
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    Also, here is how you make it start on boot
    Code:
    Write a script. put it in the /etc/init.d/ directory.
    Lets say you called it FOO. You then run
    
    update-rc.d FOO defaults
    
    You also have to make the file you created, FOO, executable, using
    chmod +x FOO

  5. #5
    Just Joined!
    Join Date
    Jul 2009
    Posts
    58
    I don't think his complaint is mount or unmounting, its when both systems are up and mounted. Than the .101 server goes away, the mount shouldn't hang.

    There is no way to "fix" that since it isn't broken. That's the expected result. To unmount with force is a horrible idea, so a script isn't going to help.

  6. #6
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    877
    Not exactly wht you asked ... but I take this Ubuntu runs as a kind of server? Better would be to mount server volumes from desktops than vice versa. Make sure the server has a big enugh hard drive and let desktops use it for downloads and media sharing.

  7. #7
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    Quote Originally Posted by aram535 View Post
    I don't think his complaint is mount or unmounting, its when both systems are up and mounted. Than the .101 server goes away, the mount shouldn't hang.

    There is no way to "fix" that since it isn't broken. That's the expected result. To unmount with force is a horrible idea, so a script isn't going to help.
    If you read the original post by OP, OP says that when windows machine is down and ubuntu machine is booted, it hangs trying to mount the shares. This script solves that problem.

  8. #8
    Just Joined!
    Join Date
    Jul 2009
    Posts
    58
    Quote Originally Posted by coopstah13 View Post
    If you read the original post by OP, OP says that when windows machine is down and ubuntu machine is booted, it hangs trying to mount the shares. This script solves that problem.
    I guess we're both reading different part of the message. The first two sentenses talk about access while linux up, windows down. The last sentense is about rebooting which you're absolutely right, the script would fix.

    The first is still an issue though.

Posting Permissions

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