I have a VPS production server that serves web apps that I make for clients. I have an rsync cron job running on my dev server that does a daily backup of the entire production server.
#!/bin/sh
RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
KEY=/root/backup-rsync-key
RUSER=root
RHOST=xxx.xxx.xxx.xxx
LPATH=/home/backup
RPATH=/
$RSYNC -avz -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH $LPATH
It works OK but gives errors of the type:
...
rsync: read errors mapping "/sys/module/yenta_socket/parameters/disable_clkrun": No data available (61)
ERROR: sys/module/yenta_socket/parameters/isa_probe failed verification -- update discarded.
rsync: read errors mapping "/sys/module/yenta_socket/parameters/isa_probe": No data available (61)
ERROR: sys/module/yenta_socket/parameters/pwr_irqs_off failed verification -- update discarded.
rsync: read errors mapping "/sys/module/yenta_socket/parameters/pwr_irqs_off": No data available (61)
ERROR: sys/power/state failed verification -- update discarded.
rsync: read errors mapping "/sys/power/state": No data available (61)
rsync error: some files could not be transferred (code 23) at main.c(1298) [generator=2.6.8]
(this is just a snippet of the errors)
How can I backup everything except for the stuff that won't backup?
Thanks
You have to exclude unnecessary files.
Good start is -x
(from man rsync(1)). That excludes filesystems you didn't specify explicitly. Remember that then you have to list all mount points you want to include.
mount
gives list for you.Another useful option is
--exclude
:Your command would be something like
You can exclude specific files using the --exclude option, like '--exclude=/sys'. Also, you can use the --exclude-from option to exclude files listed in a specific file.
Have a look at the
--exclude-from
command line option that allows you to define a file that contains a list of files and directories that rsync should exclude.