+ Post New Thread
Results 1 to 5 of 5
Scripts Thread, Problems with unmounting a network share in linux in Coding and Web Development; I have written a short script to back up a proxy server running ubuntu 10.10 using smbfs share and rsync ...
  1. #1
    januttall's Avatar
    Join Date
    Sep 2010
    Posts
    225
    Thank Post
    17
    Thanked 28 Times in 28 Posts
    Blog Entries
    1
    Rep Power
    13

    Problems with unmounting a network share in linux

    I have written a short script to back up a proxy server running ubuntu 10.10 using smbfs share and rsync but when the rsync is complet it fails to unmount the directory i have also tryed forcing the umount and this also fails.
    umount -fv /mount_location
    umount: Device or resource busy

    [script]
    mount -t smbfs -o username=*,password=* //Remote_Mount /Local_Mount_Point

    /Local_Mount_Point/rsync (this runs the actual rsync comand as i was having errors on rsync if the mount failed and with this option it cant run if the mount fails)

    [rsync script]
    rsync -auv --exclude /remotemnt --exclude /squidcache /* /Local_Mount_Point

    cd /var

    umount -fv /Local_Mount_Point

    any ideas ?

  2. #2


    Join Date
    Dec 2005
    Location
    In the server room, with the lead pipe.
    Posts
    4,619
    Thank Post
    275
    Thanked 777 Times in 604 Posts
    Rep Power
    223
    It sounds like something is hanging open

    What does lsof tell you? specifically
    Code:
    lsof | grep rsync

  3. #3
    januttall's Avatar
    Join Date
    Sep 2010
    Posts
    225
    Thank Post
    17
    Thanked 28 Times in 28 Posts
    Blog Entries
    1
    Rep Power
    13
    thanks for the reply I have run
    lsof | grep rsync
    and nothing is displayed however when the below is run
    lsof | grep /Local_Mount_Point
    shows the local user that mounted the drive is in the folder even when the script tells it to go back to the home directory after running rsync

  4. #4


    Join Date
    Dec 2005
    Location
    In the server room, with the lead pipe.
    Posts
    4,619
    Thank Post
    275
    Thanked 777 Times in 604 Posts
    Rep Power
    223
    Sorry, I should have read your initial post more clearly. You're trying to unmount /Local_Mount_Point using the rsync script sitting inside it - that'll never work.

    You can't unmount something that's being accessed. You especially can't if the thing you're trying to umount it with is the thing sitting inside it. Even though you change directory to /var within the script, the script is still running from /Local_Mount_Point.

    Run your script from the user's homedir and pick another way of checking for a failed mount, say checking /proc/mounts for your particular share.
    Code:
      if ! grep -q /Remote_Mount /proc/mounts ; then
        if ! mount /Remote_Mount ; then
          echo "failed"
          exit 1
        fi
      fi
      echo "succeeded."
      # do rsync stuff here
    (Example nicked from ServerFault)

  5. Thanks to pete from:

    januttall (12th November 2010)

  6. #5
    januttall's Avatar
    Join Date
    Sep 2010
    Posts
    225
    Thank Post
    17
    Thanked 28 Times in 28 Posts
    Blog Entries
    1
    Rep Power
    13
    Thanks for the help. I have run several tests and it seems to have worked as the mount is disconnected and the backup did complete.

SHARE:
+ Post New Thread

Similar Threads

  1. Network Share Layout
    By Shuriken1 in forum How do you do....it?
    Replies: 5
    Last Post: 28th October 2010, 12:55 PM
  2. Problems accessing a Share from windows 7
    By notalot in forum Windows 7
    Replies: 4
    Last Post: 13th May 2010, 10:07 AM
  3. Profile & Share Permission Problems:(
    By Athlona in forum Windows Server 2000/2003
    Replies: 4
    Last Post: 24th April 2010, 05:38 AM
  4. Having problems installing moodle on linux server?
    By reggiep in forum Virtual Learning Platforms
    Replies: 9
    Last Post: 18th May 2009, 08:36 PM
  5. OS X Network Share for all users
    By theeldergeek in forum Mac
    Replies: 15
    Last Post: 4th December 2008, 07:16 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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