Remotely backing up Nextcloud?


#1

The machine I was using to self host my Nextcloud instance just died.

Thankfully the hard drive isn’t the issue, so I haven’t permanently lost my data, however it drove home just how fragile self hosting can be when you only have one machine responsible for your most critical data. I won’t have access to my data for days, but I was “lucky” that it wasn’t permanently destroyed.

So, how do we go about protecting our data from something happening to our single home server, such as a power surge / leak / fire / spilled drink etc from taking out everything?

Setting up RAID arrays seems complicated and still doesn’t help if your house burns down. I’m not interested in giving my data away to some external company. I’m more interested in something like using IPFS as an encrypted external storage source.

So how do you go about setting up a simple, easy to maintain, offsite backup of your Nextcloud install?


#2

From my perspective, RAID seems easier than IPFS, but maybe that’s only because I am just now learning about IPFS. Just throwing this out there: Crashplan for free allows you to backup to a remote location (like a friend’s house) if they also run Crashplan and have enough storage space available. Otherwise maybe you could “roll your own” by syncing with another Nextcloud server at a different location (federation maybe?).
Maybe keep a drive connected to USB, and rsync all the data to it every night. You could swap out different drives and keep them in separate remote locations.
I’m just not sure about the idea of free remote storage… I just pay for Crashplan and back everything up automatically, but you could encrypt that data on your cloud before it’s transmitted, so they only see an encrypted version.


#3

I addressed this issue by setting up KVM virtualized server with LVM and making nightly lvm snaphots backups every night from the nextcloud virtual vm disk using dd + gzip, having a 2 day history.

Nothing fancy, but useful for self-hosted environments.

I’ve heard that RAID could mirror flaws on the backup disk :open_mouth:, maybe dd does that too :joy:.
But haven’t that issue so far.
Cheers!


#4

I use duplicity to incrementally backup the data encrypted to a remote location.
So my problem is actually to backup the database incrementally


#5

@linucksrox - Even if RAID was ultra simple, it’s still not a remote backup. When I tried to read up on it though, I quickly found it to get confusing, while the IPFS demo video looks really simple. I like the idea of syncing to another NC instance. I’m just not quite sure how. Do you mean something like having all folders shared via federation?

@Ark74 Isn’t that still keeping the backup on the same machine?

@pascal_dher That’s the sort of thing I’m thinking of, although as you say, backing up the database securely is a bit of an issue, as is - in my case - finding someone else with a server that I can trust. Unfortunately, I don’t personally have friends running servers as I am, which is why I like the idea of encryption+IPFS or something similar, where I don’t need to personally know all of the people running the nodes.


#6

@Bugsbane rsync baby!


#7

I think IPFS is too new to trust over a reputable company because there will probably be many security issues that have yet to be found and fixed. However, I would like to know how that works out for you if you decide to use IPFS, what the limitations are, etc.
Besides that, your options are to do your own backups locally (even manually rotate them offsite), backup to a trusted computer you have some control over in a remote location (friend/family house) which could be rsync, federation, paid tools, etc., or pay for a backup service. Friends don’t need to have servers necessarily, but any computer that is always connected to the internet, and some extra storage space. Any of the remote options require some level of trust, you just have to decide what your’e comfortable with.
And don’t underestimate the value of extra local backups, avoid the temptation to store everything on a single drive! :slight_smile:


#8

I do not have a solution to get your Nextcloud instance quickly up and running again, if you have a hardware failure, but I can share my backup strategy.

I create a daily dump of my MariaDB database into a file. Then I use a backup tool to create a backup of this file, my Nextcloud folder, and the data folder onto a different hard drive. I use Borg backup, which I can highly recommend. It supports encryption and connections over SSH, which can help you concerning offsite storage and if your second hard drive is located on a different machine. But any other good backup tool, like the before mentioned Duplicity, will work. After the backup is completed, I use rsync to copy everything to a friend’s house. He does the same thing with his data onto my home server. We each have implemented a SFTP only user over SSH with key authentication. With the encrypted backup and SFTP only, nobody can read your data and you do not have access to the server, except for the files you store there.

If you can offer to store your friend’s data on your computer too and not asking for full access to their system, that might make finding an offsite storage location easier. Maybe you can even get an additional hard drive and a SoC device like a Raspberry Pi and place this at your family’s or friend’s house. This would be a cost effective option in my opinion.


#9

Hello, I was searching for such information but can’t find any tutorial.

Is there any easy way to sync my data into a remote location please ?
Could you explain it step-by-step considering I am beginner ?
Thank you very much.


#10

@prog-amateur,
Yes u can Backup your Data with Rsync to a remote server or u can use Duplicati (Full- Incremental Backup).

Best regards,

Flavio


#11

This could be useful. Read it slowly, and try out the commands. The guide can be used for most task, between doing a simple backup to an external HDD, to a automated task that do incremental backups an off-site computer.

Rsync - Guide


#12

Thank you all, I will reas the link and feedback if possible


#13

A late reply but I use as backup crashplan. I make a local and a remote copy easily incl. retention etc.
works like a charm