1

I would like to do a partial backup from a server with rsync.

my exclude file looks like this

bin/
boot/
dev/
initrd.img
initrd.img.old
lib/

my problem is now, that every lib, bin and so on folder will be skipped in every folder but i just want to skip the /lib, /boot ... folder on the root file system

how to handle this ?

Garog
  • 9
  • 3

1 Answers1

2

Global exclude paths are anchored at the root of the transfer and thus are sensitive to the particular rsync invocation, e.g. if the trailing slash is specified. If the root of the transfer is a file system root, then to exclude /lib/ we need to use exactly this exclude pattern, not lib/. See man rsync for details. Consider this example:

$ find .
.
./root1
./root1/lib
./root1/lib/file
./root1/home
./root1/home/lib
./root1/home/lib/file
./root2
./exclude

$ cat exclude
/lib/

$ rsync -aPn root1/ root2/
sending incremental file list
./
home/
home/lib/
home/lib/file
lib/
lib/file

$ rsync -aPn --exclude-from=exclude root1/ root2/
sending incremental file list
./
home/
home/lib/
home/lib/file
Andrey
  • 121
  • 4