User Tools

This is an old revision of the document!


Backup

Doing backups for your data is, how to day, critical! But you need to answer a few questions first:

  • What do i want to backup?
  • Where can i store my backups?

And always remember the 3, 2, 1 rule of backup: three copies of your data, kept in two locations and one location is off-site.

Also remember that RAID is not backup.

What do i want to backup?

Backing up everything would require a duplicate of your storage. Is it really needed? No it's not.

First of all, i do not backup anything that i could download again.

Also, i don't backup binaries, services or the Operating System itself.

I do backup all personal data like documents, scanned documents, photos taken by me, source code written by me, calendars and contacts and so on.

I also backup all my Gentoo /etc folder, because it's easy to misstep and delete something important while upgrading your system.

Where to store my backups?

Don't store them on the server. I have OpenWRT WiFi Access Points with a USB plug, so i connected a big enough SSD over USB and that's my first backup destination. I have mounted that filesystem via NFS on the server so it's easy and simple.

You will also need a second, off-site backup storage: some cloud system (like gdrive or dropbox) might work, but using your external server could even be a better idea. After all, you already pay for it and 99% of it's storage space is probably wasted anyway.

Of course, if you have your in-laws with good internet connection you might plug a usb-drive there too and use that as well… More the better…

Backup Solutions

There are tons of backup solutions out there. I wanted a no fuss, jut works practical solution that is encrypted, has been around for long enough to be stable, and has outstanding user feed-backs.

I ended up going with Restic that it's simple, don't get in the way, and its rock solid.

Restic

A solid and well proven backup solution, it could be completed with a GUI to manage stuff, but it's not critical to have one.

Restic can backup anything to anywhere, including SSHFS (for remote shares) and most of commercial cloud solutions.

Installation

emerge restic

Usage

Create new storage repository with:

 restic init --repo /backup/NAS/backup/server-etc

think of a good password.

Then perform backup to the repository:

restic -r /backup/NAS/backup/server-etc --verbose backup /etc

You will need to use the password you thought about before.

Now, save that password in a file under /root folder to be sure nobody can sniff it:

echo password > /root/restic-password

(maybe use a less conspicuous filename!)

Then you want to automate the backup, so add this line to root's crontab (crontab -e):

0 0 * * * restic -r /backup/NAS/backup/server-etc -p /root/restic-password backup /etc

There you go. You need the stored password to automate the backup.

+ put into crontab

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information