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 ...
-
8th November 2010, 04:20 PM #1 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 ?
-
-
IDG Tech News
-
8th November 2010, 04:47 PM #2 It sounds like something is hanging open
What does lsof tell you? specifically
-
-
9th November 2010, 04:04 PM #3 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
-
-
9th November 2010, 07:05 PM #4 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)
-
Thanks to pete from:
januttall (12th November 2010)
-
12th November 2010, 11:41 AM #5 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:
Similar Threads
-
By Shuriken1 in forum How do you do....it?
Replies: 5
Last Post: 28th October 2010, 12:55 PM
-
By notalot in forum Windows 7
Replies: 4
Last Post: 13th May 2010, 10:07 AM
-
By Athlona in forum Windows Server 2000/2003
Replies: 4
Last Post: 24th April 2010, 05:38 AM
-
By reggiep in forum Virtual Learning Platforms
Replies: 9
Last Post: 18th May 2009, 08:36 PM
-
By theeldergeek in forum Mac
Replies: 15
Last Post: 4th December 2008, 08: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
-
Forum Rules