Automated Backup

Automated Backup of a File Server

After setting up a Samba file server for your home network, the next task is to setup a backup server. I find that for my needs a simple cron job that runs rsync over ssh is sufficient.

It should be noted that backing-up gigabytes of files over a home network is semi-impractical from a speed standpoint. The first backup is best handled by plugging both SDDs or HDs into the same computer and using rsync to copy one disk to the other. Future backups are incremental and can happen much quicker. If you are backing up movies or other large media files you would be better off with a one computer - two hard drive strategy. For home usage, incremental backup of less than 100-300 Mb then networked SBCs are probably sufficient.

I use my faster SBCs for media servers, etc. and use my older SBCs such as RPi 2B for backup. It may take longer, but speed is not critical.


Assuming you already have a DietPi Samba server named "archive" with an SSD mounted under the name "ssd" the following steps are needed.

  1. Set up DietPi on a second Pi.
  2. Name this second Pi "backup"
  3. Mount an SSD under the mount point "ssd"
  4. From "backup" as "root" generate an ssh key and install it on archive
  5. Run rsync on a test file to make sure it works.
  6. Set up a cron job to run the rsync command at night
  7. Check the next morning to make sure all is well