Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Rsync Oddities and Strange '/Volumes' Behavior

Rsync Oddities and Strange '/Volumes' Behavior
Thread Tools
vwgtiturbo
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Jan 15, 2009, 10:00 PM
 
Hello there,
I was trying to run 'rsync' on my MacBook (10.5.6) to sync a folder on an external USB drive (External200) to a network share (Linux server using Samba). Imagine my surprise when my terminal window showed that all of the files on the server were being deleted

I have run this script many times before with no problems, so I was at a bit of a loss. My rsync command is:

rsync --rsh='ssh -p xxxxx' --delete -v --force --modify-window=300 --ignore-errors -az --stats --progress /Volumes/External200/Music/ [email protected]:/fileserver/music/

I am copying from the music directory on the mounted USB drive (External200/Music/) to a network share (/fileserver/music/)
I have had this issue before and found out why it happened this way, but never found out why this condition exists... By looking at my Mac's directory structure (ls /Volumes), I see this:

Mounted Volume Reference

Now, for whatever reason, the last time I had this drive mounted, the system created 'External200' in /Volumes, but when I unmounted the drive, that link wasn't removed. When I mounted the drive this time, 'External200' was already there, SO the system created 'External200 1'. This explains why, when I tried to 'rsync' 'External200' to the server, all of my files on the server were deleted (as 'External200' is empty, with all of the files on the external drive now being mounted at /Volumes/External200 1/).

Can anyone shed some light into why my system is not handling these mounts correctly? I ALWAYS properly unmount the external drive, so I am not sure what is happening, or how I can change my script to handle this accordingly. All I know is that now, instead of copying 400 files, I am having to copy 10,000

Thanks in advance for any assistance.
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
Hal Itosis
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Jan 15, 2009, 11:27 PM
 
Originally Posted by vwgtiturbo View Post
I ALWAYS properly unmount the external drive, so I am not sure what is happening, or how I can change my script to handle this accordingly.
Does that mean you 'manually' eject those items, or is that done inside the script?

Also, this part looks rather odd:

drwxrwxrwx 1 Ron staff 32768 Jan 15 09:25 EXTERNAL200 1
drwx------ 0 Ron staff 16384 Jan 15 09:56 music

How does one obtain directories with 1 and 0 "links" respectively?
The smallest that number can be is supposedly 2 [i.e., '.' and '..']

Directory damage perhaps. (have you repaired these disks lately?)
-HI-
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Jan 16, 2009, 12:45 AM
 
Yes, I manually unmount them. My earlier statement made so much more sense in my head
One odd thing I notice... I came home today and mounted the volumes 'lossless music', 'External200', and 'mp3 music' (those are the actual volume/share names), and before I mounted them, I checked /Volumes on the terminal, and all three names already existed with the user set to 'Ron' and the group set to 'admin'. After mounting these three, all of them mounted with either a ' 1' or '-1' suffix (because the system already had links in /Volumes for the base volume name) and each with a ' 1' or '-1' suffix mounted as user 'Ron' and group 'staff'.
The last time this happened, I simply removed the old links from /Volumes, but that didn't last forever, I suppose...
I haven't repaired the disks... ever. I could do that with the 'External200', but can't really do much for the network share (which also suffers from this weird behavior).
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Jan 16, 2009, 02:34 AM
 
I think I have this figured out. It is related to a program called PowerTunes (that manages multiple iTunes libraries). I know... why use a program to manage multiple libraries when I could just hold the 'Option' key when starting iTunes to select another library? Doing it that way does not allow separate preferences for EACH library... all of the libraries would have to share the same prefs.

I unmounted all volumes, then deleted any reference to them in /Volumes (e.g. 'External200', 'lossless music', and 'mp3 music') so that only 'Macintosh HD' showed when using 'ls -l'.

Anyways, here is a screenshot, and I'll explain each step:

PowerTunes and 'Mounted' Volumes

I have three libraries managed by PowerTunes on three sets of media: one on 'External200', one on 'lossless music' (network share) and the last on 'mp3 music' (also on a network share).

The first 'll' (ls -l) shows me only having 'External200' mounted.

I then started PowerTunes and it started querying the storage locations of my libraries. The problem is, only 'External200' was mounted. 'lossless music' and 'mp3 music' were NOT mounted. However, PowerTunes created the 'mount points' for the locations that SHOULD contain the music libraries (e.g. External200 was mounted and present in /Volumes, so PT didn't do anything with that, BUT created a directory for 'lossless music' and 'mp3 music' even though those volumes were not mounted). This is demonstrated by the second 'll'.

Next, I mounted the network volume 'lossless music' through Finder/PathFinder. Whoops... 'lossless music' already exists in /Volumes, so the system mounted the network share as 'lossless music 1' (results shown in the third 'll'). Now, both PT, Finder, and iTunes are all smart enough to follow the ' 1' suffixed volumes, BUT rsync is not.

So, that is why my script fails, as I have it syncing the network share to 'External200' NOT 'External200 1'. This is why the files on my server were deleted, as rsync was trying to sync the network share to an empty directory.

I suppose I should learn some if-then statements for my shell scripting, eh?
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
Hal Itosis
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Jan 16, 2009, 03:42 PM
 
The way things work in /Volumes is still somewhat of a mystery (to me). Terminal tells us that those are directories in there... while Finder shows them as aliases. Use Finder's Go menu --> Go to Folder… feature (or enter open /Volumes in Terminal) to view the contents with Finder. If you see anything that doesn't look like an "alias" (for example a folder or non-alias file), then chances are it doesn't belong there. How it got there and how to prevent it from appearing will depend on what it is (i suppose).
-HI-
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Jan 16, 2009, 04:04 PM
 
This PowerTunes issue is, I suspect, a result of a fix for another issue with PT. If libraries are stored on an external/network volume that is not mounted, PT would seem to hang. After the fix was released, I didn't notice this current issue, as I hadn't used it in this manner until now (before, all of my libraries were stored locally). Hopefully, this is an easy fix.
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:04 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,