Using rsynch

From Bradnor
Jump to navigation Jump to search

⇐ Backup

Using rsynch

create exclude file
exclude file lists directories to exclude from backup
suggested list
/proc/*
/sys/*
/dev/*
/boot/*
/tmp/*
/run/*
/mnt/*
/media/*
run or cron
substitute exclude file above for <excludefile>, backup destination for <dest> and log file for <logfile> name
e.g. <excludefile> /rsynch_exclude.txt
<dest> /mnt/freecom/backups/bradnorRP1/
<logfile> /backuplog_bradnorRP1.log
rsync -av --delete-delay --exclude-from=/<excludefile>.txt / <dest> >> /<logfile>.log
or to preserve hard links and keep remote mirror of rsnapshot
rsync -aHv --delete-delay --numeric-ids --exclude-from=/<excludefile>.txt / <dest> >> /<logfile>.log
to another server
create a key for root which does not require a password
$ ssh-keygen -t rsa
and specify a filename for the key but no password
set up key-based authentication for ssh on target server
create user on target server which accepts root's key for authentication
copy the file to the server you wish to authenticate to and add the public key you created to the ~/.ssh/authorized_keys file of the target user
use rsync to copy files, e.g.
sudo rsync -aHv --delete-delay --numeric-ids /var/lib/rsnapshot rpbackup@192.168.192.203:/rpbackups/RP1-rsnapshot