Synchronize Files With rsync
Automatic Syncing With SSH Keys
#!/usr/bin/env bash
rsync -az –delete /home/kevin/source/ server.example.com:/home/kevin/destination
Automatic Syncing With SSH Keys
#!/usr/bin/env bash
rsync -az –delete /home/kevin/source/ server.example.com:/home/kevin/destination
In the first part of this three-part series using a Raspberry Pi for network-attached storage (NAS), we covered the fundamentals of the NAS setup, attached two 1TB hard drives (one for data and one for backups), and mounted the data drive on a remote device via the network filesystem (NFS). In part two, we will look at automating backups. Automated backups allow you to continually secure your data and recover from a hardware defect or accidental file removal.
A guide on setting up rdiff-backup and using sudo to run rdiff-backup without running it as the root user.
Significantly, it preserves subdirectories, dev files, hard links, and critical file attributes such as permissions, uid/gid ownership, modification times, extended attributes, acls, and resource forks. It can work in a bandwidth-efficient mode over a pipe, in a similar way as the popular rsync backup tool.
rdiff-backup backs up a single directory to another over a network using SSH, implying that the data transfer is encrypted thus secure. The target directory (on the remote system) ends up an exact copy of the source directory, however extra reverse diffs are stored in a special subdirectory in the target directory, making it possible to recover files lost some time ago.
…you can not backup and use –remove-older-than in the same command. You must execute these commands separately. You will receive an error if you attempt to do so.