januttall Posted November 8, 2010 Posted November 8, 2010 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 ?
pete Posted November 8, 2010 Posted November 8, 2010 It sounds like something is hanging open What does lsof tell you? specifically lsof | grep rsync
januttall Posted November 9, 2010 Author Posted November 9, 2010 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
pete Posted November 9, 2010 Posted November 9, 2010 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. 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) 1
januttall Posted November 12, 2010 Author Posted November 12, 2010 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now