1

I'm trying to make a full filesystem backup of a server through rsync, following this guide. I'm using the following command:

rsync -aAXH --progress --delete --stats --exclude={\
    "/dev/*",\
    "/proc/*",\
    "/sys/*",\
    "/tmp/*",\
    "/run/*",\
    "/mnt/*",\
    "/media/*",\
    "/lost+found"}\
    /* \
    newserver:/mnt/oldserver-backup

However, it still backs up the /media/x folders, causing there to not be enough space in the target. How can this be corrected?

2 Answers 2

3

The --exclude={x,y,z} construct only works in bash and needs to be on one line without spaces, only then can bash expand this correctly.

I'd suggest putting the list in a separate file and using --exclude-from=file, or doing as megahallon suggests and repeat the --exclude= option part yourself.

Note also that you usually do NOT want /* as your source; let rsync take care of recursing, so just specify /. that way dot files in / also get copied. I also always add a trailing slash to the destination directory to prevent surprises; a good habit to get into.

2
  • That explains it. I know rsync is picky about slashes, but I copied that part exactly from the archlinux wiki...
    – dtech
    Sep 25, 2014 at 14:14
  • Just because it's in a wiki doesn't mean it's (completely) correct :-)
    – wurtel
    Sep 25, 2014 at 14:21
1

From the rsync man page

   Note also that the --filter, --include, and --exclude options take one
   rule/pattern each. To add multiple ones, you can repeat the options on     
   the command-line, use the merge-file syntax of the --filter option, or  
   the --include-from/--exclude-from options.

So in your case you should you probably just want to repeat the --exclude for each directory.

You must log in to answer this question.

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