Backup on Raspberry PI

I am running Yunohost on a Raspberry Pi in my basement. I’m using it for email, RSS, XMPP Server, etc. It works great …

But = backups!

I want to rely on this system for the future, but I fear that I’m one RPi failure (or corrupted after power outage) away from losing all my data. The backup system in Yunohost seems to work, but places the backup onto the same SD card that could easily fail. Further I have to run this backup manually … it’s not automated.

What I’m looking for is a simple system that I can install on my Yunohost server that will run regular backups and place those backups on an external thumbdrive that I have plugged into my RPi. I need the data and settings from all my applications backed up. I would hate to loose all my RSS feeds on TinyTinyRSS for instance.

Does anyone have a system like this running? Can anyone advise how to do this?

Hello !

Basically you mention two issues : storing backup archive on an external storage, and automation.

Archives on an external storage : if you want to rely on a USB thumb drive for instance, then the simple thing to do would be to mount that storage, and mount it as /home/yunohost.backup/archives I think.

Automatic backups : a cron job should do the trick. You can put a simple script in, for instance, /etc/cron.weekly with the command yunohost backup create --apps wordpress nextcloud --ignore-system for instance. (You need to be a bit careful about adding the #!/bin/bash at the beginning of the file, and adding proper permissions I think)

Doing this depends on how comfortable and familiar you are with command line and linux in general though :wink:

lol. Not comfortable at all.

Yunohost attracts people like me because it is so easy to set up and work with. So I think there are others like me who are not command liners that need step by step instruction manuals for how to set this up. Yunohost is a great step in the right direction for those of us who want to keep our own data, but is still on the very edge of most people’s technical ability. I am one of those people. I have to break something 5 times before I figure it out. lol.


1 Like

Sure :stuck_out_tongue: Well hopefully you are learning things along the way :sweat_smile: But the long-term goal is to make your kind of use case easy to setup I believe.

So, let’s try to mount your external drive and use it to store backup archives on it.

I think this should go like with something like this :

  1. Move your existing backup in some other folder (on the same storage you currently have)
  2. Mount your external drive to use it as /home/yunohost.backup/archives (the place where backup archives are stored in the context of yunohost)
  3. Put back you old archives (implicitly moving them to your USB stick)

First step then : you can move your existing backup archives with something like :

mv /home/yunohost.backup/archives /root/my_precious_archives

This shouldnt take too long (maybe immediate) as, for linux, it internally just changes the name of a few files.

Second step : plug your USB drive in, then run fdisk -l.

It should show you a whole bunch of info about your drives / storage, and in particular, around the end, you should see something like Device /dev/sdb1 ... Size 30Go (assuming this is a ~30 Go stick). This means that your USB drive is called /dev/sdb (without the 1!) and has a partition /dev/sdb1 (and maybe some others). The name /dev/sdb might differ on your system, but basically you should check that the sizes are consistent with the size of your USB drive, just to make sure you’re not mistaking the /dev/sdthing with another drive !

Once you are okay with this, assuming you only have one partition on your USB drive, mount it with something like :

mkdir /home/yunohost.backup/archives
mount /dev/sdb1 /home/yunohost.backup/archives
chmod o-rxw /home/yunohost.backup/archives

Basically, the mount line “just” tell the system to use your first partition of your USB drive to store everything that should go into /home/yunohost.backup/archives

Last step then ! Just do basically the reverse of the first step :

mv /root/my_precious_archives/* /home/yunohost.backup/archives/

And this will take a bit longer as it will move all your archives to your USB drive. This might take a while depending of the size of your archives. Don’t cancel this command though ! If you want to be extra careful, we can tell you a bit more about copying to the destination, then removing the source :wink:

If you successfully do this, then the step about setting up automatic backups should be a bit easier !

Huh, I would say simply use Archivist, which is design to this purpose.
With this app, you can simply make a backup where you want, and automate it.

Wow … Archivist seems to do exactly what I’m trying to do. Is there a reason why you didn’t suggest it @Aleks? Works for RPi’s?

Ah, no idea, I actually never used it / had a look at it so I didn’t know it also does that xD

According to the last CI test, Archivist works on Raspberry.
But I should admit that I never tried it, however, there’s no raison that it wouldn’t works.

I cannot get Archivist to install on my system. Will start a new thread for this issue.