1

I am trying to set up rsync backup for my FreeBSD servers.

I’ve put together an rsync-command that looks like this:

rsync -avzhe ssh --progress --delete --delete-excluded \
--exclude-from=/root/rsync-excludes \
-e ssh / [email protected]:Backups/location

My /root/rsync-excludes file looks like this:

- *~
+ /root
+ /usr/home
+ /usr/srv
+ /etc
+ /usr/local/etc
+ /var/backups
+ /usr/local/pgsql/backups
- /root/.my.cnf
- /*

But for some reason, it only backs up /etc and /root, leaving out the other files. Can someone explain why?

Solution

As per the answer from Gilles, I figured it out, and my config now looks like this:

- *~
+ /etc
+ /root
+ /usr/
+ /usr/home
+ /usr/local/
+ /usr/local/etc
+ /usr/local/git
+ /usr/local/pgsql/
+ /usr/local/pgsql/backups
- /usr/local/pgsql/*
+ /usr/local/varnish
- /usr/local/*
+ /usr/srv
- /usr/*
+ /var/
+ /var/backups
- /var/*
- /root/.my.cnf
- /*
1
  • Do you think you can restore full system using rsync.
    – BigSack
    Aug 18, 2013 at 13:20

2 Answers 2

3

During a recursive traversal, rsync matches each directory against the rules. When it comes to /usr, the first matching rule is - /*. Therefore /usr is excluded, and rsync doesn't even look at anything below it. Fix: explicitly include /usr, as well as /usr/local, /usr/local/pgsql and /var.

The rsync manual has a more extended discussion under “include/exclude pattern rules” (admittedly not the easiest read).

0
0

It looks like you are getting --one-file-system behavior. This may be the default on freebsd.

I also see that your destination is not a root account which should break retaining permissions and ownership.

1
  • --one-file-system is not the default, I was rather that I had the exclusion rules wrong as Gilles suggested. As for the destination not being root, that is true, but it’s not really an issue for my use.
    – mikl
    Aug 21, 2010 at 19:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .