Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rsync prints "skipping non-regular file" for what appears to be a regular directory

I back up my files using rsync. Right after a sync, I ran it expecting to see nothing, but instead it looked like it was skipping directories. I've (obviously) changed names, but I believe I've still captured all the information I could. What's happening here?

$ ls -l /source/backup/myfiles drwxr-xr-x 2 me me  4096 2010-10-03 14:00 foo drwxr-xr-x 2 me me  4096 2011-08-03 23:49 bar drwxr-xr-x 2 me me  4096 2011-08-18 18:58 baz  $ ls -l /destination/backup/myfiles drwxr-xr-x 2 me me  4096 2010-10-03 14:00 foo drwxr-xr-x 2 me me  4096 2011-08-03 23:49 bar drwxr-xr-x 2 me me  4096 2011-08-18 18:58 baz  $ file /source/backup/myfiles/foo /source/backup/myfiles/foo/: directory 

Then I sync (expecting no changes):

$ rsync -rtvp /source/backup /destination sending incremental file list backup/myfiles skipping non-regular file "backup/myfiles/foo" skipping non-regular file "backup/myfiles/bar" 

And here's the weird part:

$ echo 'hi' > /source/backup/myfiles/foo/test $ rsync -rtvp /source/backup /destination sending incremental file list backup/myfiles backup/myfiles/foo backup/myfiles/foo/test skipping non-regular file "backup/myfiles/foo" skipping non-regular file "backup/myfiles/bar" 

So it worked:

$ ls -l /source/backup/myfiles/foo -rw-r--r-- 1 me me  3126091 2010-06-15 22:22 IMGP1856.JPG -rw-r--r-- 1 me me  3473038 2010-06-15 22:30 P1010615.JPG -rw-r--r-- 1 me me        3 2011-08-24 13:53 test  $ ls -l /destination/backup/myfiles/foo -rw-r--r-- 1 me me  3126091 2010-06-15 22:22 IMGP1856.JPG -rw-r--r-- 1 me me  3473038 2010-06-15 22:30 P1010615.JPG -rw-r--r-- 1 me me        3 2011-08-24 13:53 test 

but still:

$ rsync -rtvp /source/backup /destination sending incremental file list backup/myfiles skipping non-regular file "backup/myfiles/foo" skipping non-regular file "backup/myfiles/bar" 

Other notes:

My actual directories "foo" and "bar" do have spaces, but no other strange characters. Other directories have spaces and have no problem. I 'stat'-ed and saw no differences between the directories that don't rsync and the ones that do.

If you need more information, just ask.

like image 988
Richard Avatar asked Aug 24 '11 18:08

Richard


People also ask

Why is rsync skipping a directory?

Similarly, the rsync skipping directory error can occur when miss to put it into a recursive mode like -r or -a. In addition, use -a instead of -r. -a means to reproduce file hierarchies, including special files and permissions. Also, the option -r only to recurse on directories whereas -a needed for a data backup.

Does rsync Skip existing files?

rsync –ignore-existing command enables a user to resume an interrupted backup and ignore the destination's existing files.

What happens if files change during rsync?

rsync first scans the files and builds a list. so once the file is listed for sync, rsync will sync the latest change of file. but if the file is not in the list of files to be synced, which was built before starting the sync operation, then it will not sync it.

Does rsync follow symlinks?

rsync copies the symlinks in the source directory as symlinks to the destination directory using this option. Copying the symlinks is successful in this case.


2 Answers

Are you absolutely sure those individual files are not symbolic links?

Rsync has a few useful flags such as -l which will "copy symlinks as symlinks". Adding -l to your command:

rsync -rtvpl /source/backup /destination 

I believe symlinks are skipped by default because they can be a security risk. Check the man page or --help for more info on this:

rsync --help | grep link 

To verify these are symbolic links or pro-actively to find symbolic links you can use file or find:

$ file /path/to/file /path/to/file: symbolic link to `/path/file` $ find /path -type l /path/to/file 
like image 195
zaTricky Avatar answered Sep 22 '22 21:09

zaTricky


Are you absolutely sure that it's not a symbolic link directory?

try a:

file /source/backup/myfiles/foo 

to make sure it's a directory

Also, it could very well be a loopback mount try

mount 

and make sure that /source/backup/myfiles/foo is not listed.

like image 41
Gauthic Avatar answered Sep 19 '22 21:09

Gauthic