* Bernhard Voelker
On 08/22/2014 09:21 PM, Greg Freemyer wrote:
To backup /usr to /mnt/usr (on the external drive), I think this will work:
sudo rsync --archive /usr /mnt/usr
The only tricky part is knowing if you need a trailing /. ie. the command might be:
sudo rsync --archive /usr/ /mnt/usr
I always have to experiment with the trailing / everytime I use rsync.
Same here - almost, because I got used to use the trick to append "/." on both the source and the target side ;-)
sudo rsync -Haix /usr/. /mnt/usr/.
Here's how I understand the trailing slashes in rsync: 1. A trailing slash on the destination does not affect anything; you can use either with or without; it is identical either way. 2. Omitting a trailing slash on the source means that the last path component in the source will be first path component in the destination dir. 3. Including a trailing slash on the source means that only the contents of the source dir, and not the dir itself, will appear in the destination dir. Note that all files, even files beginning with a dot, will be included in this case (which beats using a "*"). Examples: rsync -a /usr/bin /backup would result in /backup/bin being created with everything in /usr/bin in it, whereas rsync -a /usr/bin/ /backup would result in all of /backup/bin/* (as well as /backup/bin/.??* if there are any files beginning with ".") being included in /backup, but not the bin directory itself (essentially; that 2nd wildcard is imperfect, but hopeuflly serves to make the point). The 2nd case eliminates one directory level from the destination copy. Given that, using the prev described: rsync -a --one-file-system / /backup would copy everything in the root filesystem to the backup directory such that doing a "ls /backup" would look the same as doing a "ls /" exept that the copy would not include any other filesystems (e.g., /dev, /proc, /home (if it is in a separate filesystem), etc. Easy to visualize [for me at least] once I understood it, but still not so easy to communicate clearly. HTH, --Phil -- Philip Amadeo Saeli openSUSE, CentOS, RHEL psaeli@zorodyne.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org