Backup a Live-NS to running Backup-NS

This will be a bit of a long question/post, so I’ll do this first,
TL/DR;
I want to backup a live NS constantly throughout the day, using LVM snapshots on running system, and then rsync to a running backup NS. I will also need to do all relevant database dumps from live, and then import into backup NS.
What I am hoping to accomplish, is if my Live-NS goes down at any point during the business day, I am backup up and running on backup machine within minutes with minimal data loss. This is not my only backup protection, I run in a VM, which is backed up each evening. The backed up VM is the disaster recovery.

My System
Zentyal is running in a VM on a debian host, and is the DC for my network.
Live-NS is running in a VM, and is connected to Zentyal AD for users/groups.
I have all relevant mount points on NS as their own LVM, but the main one I think I need to backup is /var/lib, or maybe just /var/lib/nethserver.
NS is running WebTop 4 and NextCloud.
Backup-NS is running bare metal, and is also connected to Zentyal AD for users/groups.
It has the same LVM setup as the Live-NS, and is updated and installed with all the same modules and setup the same as the live machine.
I am just in development right now, and hope to go live within a couple of weeks if not sooner.

The Backup Plan
I want to have all email, files shares, nextcloud, and webtop data backed up at different intervals during the day.
For data, besides the main /var/lib LVM, I also have /var/lib/nethserver/ibay and /var/lib/nethserver/ibay/accessdb, so my file server data, and my accessdb can be snapshotted at different intervals, but at the same time as the other LVM snapshots, so say the access db can be backed up, and doesn’t have to wait for the email backup to finish and be unmounted to do so. I hope that makes sense.
Not losing any, or very little of the accessdb data, and our email, is very important to my company during the business day, so I am hoping this plan can work.

The plan was as follows;
-on startup, do an LVM snapshot of /var/lib/ and use rsync to backup all email, and nextcloud data (I may need to split these 2 and create another LVM just for the email) to the backup machine. When done, unmount the snapshot, and immediately repeat.
-at a set interval, probably every 5 minutes, do an LVM snapshot of /var/lib/nethserver/ibay/accessdb, rsync to backup, unmount, repeat in 5 minutes.
-at a set interval, probably every 15 minutes, as file share data is not as critical (so maybe 30 minutes) do an LVM snapshot of /var/lib/nethserver/ibay/, rsync to backup, unmount, repeat.
-at a set interval, probably just a couple times and day, do an LVM snapshot of /var/lib/, and backup anything else relevant, rsync to backup, unmount, repeat.
-at similar intervals as relevant data, do a database dump for the needed db’s (nethserver/webtop/nextcloud), rsync to Backup-NS, and either detect new db dump and import there, or import daily or at time of backup-NS going live.

My questions are as follows;

  1. Will this work in theory? Are there any potential issues?
  2. Is there anything else I can backup that will help the process (config files etc.), and can I safely just do the complete /var/lib
  3. What services need to be shutdown on the backup-NS during the rsync of any of the data
  4. What are the databases I need to backup for NethServer/WebTop/NextCloud, and is there a NS module that can automate this?

Sorry for the long post, and I realize I can find most of this information out by searching, but I have been digging for a couple weeks now, and am no expert in any of this. I just thought, if I could maybe explain my complete plan, and see if anyone here has done something similar, and might be able to provide some insight, or just thinks it’s interesting. The help in this community has been very, very good, and invaluable so far in me getting my system setup.

Hi,
I think you can use the Nethserver backup modul for it. Please install it in the software-center.

For configuration please have a look at the message from Giacomo at this thread.

@wbilger did you resolve?

I did not.
Unfortunately this part of the project has taken a back seat to others for a moment.
But is still probably the most important, I have to get back to it, do you have any suggestions based on anything I mentioned in the original post?

Did you try the internal Backup?

Just starting to look at this again.
How do you suggest using the internal backup, sorry, not exactly sure how it works. I want to do LVM snapshots and backup multiple times per day, different frequencies for different areas of NethServer. For example, email constantly (as soon as backup finished, it takes another snapshot again), and for some data shares in ibay hourly, and others (they have separate LVM partitions so separate snapshots) every 15 minutes etc.
I do not see a way to do this with the internal backup, I only see Full or incremental backups. I need to backup all data, configurations etc, not to a backup file, but to another running NethServer box.

You can’t do with standard internal backup.
Probably you need a lot of coding to achieve what you’re looking for.

Ok, I can handle the coding, I just have to figure out what services to shutdown on backup NethServer while copying the files.
If I was to do a full backup, using the internal backup, it’s great there’s a backup in the web administration, but how would I do a restore, is there documentation for that? I think obviously you would need to shutdown services while doing the restore. That would be able to help me figure out how to do this.
Also, for addons like WebTop and NextCloud, are they part of the backup? What about the database for WebTop/NextCloud, is it part of the backup? How to restore?

Here is the documentation of internal backup and restore. But no documentation what services are stopped.

Of course :slight_smile:

For restore, follow the documentation pointed out by Michael.

The data restore works without shutting down running services, while configuration restore takes care to restart all needed services.
Each service knows what’s needed, you can see all code inside post-restore-config, post-restore-data, pre-restore-config and pre-restore-data events.

You can also take a look to this script which uses rsync to do something like a backup (please note that the code is not still merged):

So, what happens when restoring data, the database is restored on a running NS?
If it works like that, could I just copy any or all data (I would restore differrent parts of NS at different times), as well as any database data, from LVM snapshot of live NS, to running backup NS?

Then, for configuration data, once a day, or a few times per day, could I do the configuration backup on the live NS, and then copy the configuration data backup files to the backup NS, and then run a restore on backup NS?

Yes.

It should be ok, but never tried :slight_smile:

Thanks. I will give it a shot, I’ll update my progress here, although I probably can’t get to it until the end of next week.

2 Likes