Recommended rsync tutorials?
Joshua Judson Rosen
rozzin at geekspace.com
Tue Oct 19 16:00:42 EDT 2010
bruce.labitt at autoliv.com writes:
> gnhlug-discuss-bounces at mail.gnhlug.org wrote on 10/19/2010 10:17:56 AM:
>
> > Tom Buskey <tom at buskey.name> writes:
> > > On Mon, Oct 18, 2010 at 8:28 PM, Bruce Labitt
> > > <bruce.labitt at myfairpoint.net>wrote:
> > > >
> > > > I'm looking to use rsync on a cron job to do some
> > > > 'backup'. I've read man rsync and a few 'tutorials'. It
> > > > looks not too hard - this worries me. :)
[...]
> > And don't forget --dry-run to see what you're going to do before
> > you do it, and --one-file-system to skip over (active)
> > mountpoints.
>
> Thanks for the tip on --dry-run. I don't understand --one-file-system,
> what does that do?
>From the manual:
-x, --one-file-system
This tells rsync to avoid crossing a filesystem boundary when
recursing. This does not limit the user’s ability to specify
items to copy from multiple filesystems, just rsync’s recursion
through the hierarchy of each directory that the user specified,
and also the analogous recursion on the receiving side during
deletion. Also keep in mind that rsync treats a "bind" mount to
the same device as being on the same filesystem.
So, it tells rsync to *not go into* directories where another filesystem
is mounted.
If, for example, you do:
rsync --archive / /var/spool/backup/
... then rsync will try to copy *everything* into /var/spool/backup:
including everything under /sys, /proc, /dev/shm, /dev/pts,
any NFS or other network mounts, *and also* /var/spool/backup
(in which case it'll try to copy /var/spool/backup to
/var/spool/backup/var/spool/backup...).
If, on the other hand, you do:
rsync --archive --one-file-system / /var/spool/backup/
... then rsync will just skip over all of those mountpoints.
The "find" command has an equivalent switch ("-mount" or "-xdev"),
if you just want to watch directory-traversal happen with/without
mountpoints being skipped, e.g.: "find / -xdev" vs. "find /".
Oh, ALSO...: note that it *matters* to rsync whether you include
a trailing slash when writing the paths to your directories.
--
"Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."
More information about the gnhlug-discuss
mailing list