cp command, problems with archiving from only one file system...
Hello all,
I'm trying to figure out how to copy all files recursively from a certain point, but I need to avoid following a bind mount in that structure. The bind mount is from another part of the same structure I'm copying. I've tried -x and --one-file-system, but it still follows the bind mount. HELP! PS: I'm working on an uptodate (as of this writing) version of CentOS4. |
Quote:
tar cf <path_to_source_dir> | tar xf - -C <path_to_new_dir> Tar does not follow symbolic links by default. |
Quote:
The correct behavior can sort of be seen with "find /somewhere -mount". Here "find" will not follow hard links underneath /somewhere. I need to do the same thing with a recursive copy. Does anyone have any experience with the -x option of the cp command? |
Most likely bind mounts are treated by cp as being on the same filesystem (as rsync does) so that the -x, --one-file-system option doesn't take effect. Using rsync instead, you can easily skip the bind mount point using an explicit --exclude option.
|
Quote:
As colucix says, the --exclude directive might be your best bet. |
I'm marking this thread solved because I don't think the cp command will do what I was asking. Also the solution suggested will do exactly what I needed it to do, that is use rsync with the --exclude option.
Thanks to all. |
All times are GMT -5. The time now is 01:51 AM. |