BackupPC restore to another hardware

Hi all,

With BackupPC, if I restore to the same hardware, all is working properly.

I would like to restore to another new hardware for testing.

In BackypPC → BackupFilesExclude,
I exclude:
/boot to keep the new hardware original boot
/etc/fstab to keep the new hardware original disks and mounts
/etc/sysconfig/network-scripts to keep the new hardware original network configuration

After a reboot of the new hardware, the files in /etc/sysconfig/network-scripts are the SOURCE ones.

Before restoration, I tried
cp -a /etc/sysconfig/network-scripts /temp
Then after restoration:
cp -a /temp/network-scripts/* /etc/sysconfig/network-scripts/
The SOURCE network config still show up in Cockpit → Nethwork.

QUESTION:
How to keep the new hardware original files in /etc/sysconfig/network-scripts ?

All suggestions appreciated,

Michel-André

Hi all,

Maybe I found a clue: nethserver-backup-config
According to https://docs.nethserver.org/projects/nethserver-devel/en/latest/nethserver-backup-config.html

The restore-config options:

--no-reinstall : disable package reinstall during restore
--mask-unit=<name> : use systemd to mask the specified unit (example: disable httpd-admin restart during restore)
--skip-network: do not restore the network configuration

The option –skip-network is the answer, but the question is how to implement that ?

After the backup, BackupPC execute the post command $Conf{DumpPostUserCmd}/var/lib/BackupPC/script/post-sauvegarde.sh $host

# post-sauvegarde.sh
/usr/bin/ssh -l root $1 "/sbin/e-smith/signal-event post-backup-config"
/bin/sleep 15
/usr/bin/ssh -l root $1 "/sbin/e-smith/signal-event post-backup-data"
/bin/sleep 15

QUESTION:
Do I have to modify only: /usr/bin/ssh -l root $1 "/sbin/e-smith/signal-event post-backup-config --skip-network",
or do I have to modify a parameter somewhere in the configuration db
or in a file also somewhere,
or something else ?

Michel-André

@michelandre

Salut Michel-André

Maybe I’m reading this wrong, but it seems to me you’re mixing up two things:

BackupPC (A modul for NethServer by Stephdl)
and
Nethserver-backup-config (A standard option of NethServer to restore a certain config)

These two are not related to each other…

Or am I reading your post wrongly?

This is interesting, seen on their current (new) Github home page:

Tested on Linux, Freenix and Solaris hosts, and Linux, Windows 95, 98, 2000 and XP clients.

Does that mean that Win8, win81 and Win10 do not work, or haven’t been tested?
No tests on a major platform for 8 years or more?

Seen here:

Andy

Slut Andy,

BackupPC send a command to the SOURCE before taking the backup.
That way, the LDAP and other dump from sql are ready to be picked up by the backup of BackupPC.

The only way they are related.

Michel-André

1 Like

hum ???

[root@NS7 ~]# cat /var/lib/BackupPC/script/post-sauvegarde.sh
cat: /var/lib/BackupPC/script/post-sauvegarde.sh: No such file or directory
[root@NS7 ~]# ll /var/lib/BackupPC/script/
ls: cannot access /var/lib/BackupPC/script/: No such file or directory

Is it a customization ?

Salut Stéphane,

Not realy cuslomize, they are the same commands used by a régular NethServer backup after it is finished.

By default, there is a directory to store scripts for BackupPC /var/lib/BackupPC/script.

Since after a regular backup, the dumps are still there, those commands will take care of them and all other things related to “after the backup”.

Michel-André

fun like you can see it is not default on my server

Hi all,

My problem is not with the backup, it is with the restore.

I create a restore TAR file from the backup of BackupPC.
Then I resore ther TAR file with:

sh-4.2$  ssh -p 3333 root@10.10.10.66 "cd / && /bin/tar -xv" < source-782003.tar

This command will restore all the files from the backup to the DESTINATION server 10.10.10.66

It is only after this command is finished that I should send the restore-config command with the option of --skip-network.

Michel-André

Hi téphane,

It is not in your server because you do not send post-backup commands.

Michel-André

1 Like

/sbin/e-smith/restore-config --skip-network

1 Like

Hi Stéphane,

Looks OK for the restore-config.
I will use:

/sbin/e-smith/restore-config --skip-network --no-reinstall

Will that be all or there is something else ?

Michel-André

honestly I never designed backuppc to backup a nethserver, however it is something really interesting but I have no experience on it…

IIRC the backuppc should reproduce all the post backup-{config,data} that we could find

when I look to the restore event I saw

pre-restore-config
post-restore-config
pre-restore-data
post-restore-data

I suppose that all should be triggered

Hi Stéphane,

I use BackupPC only for my main NS server in case of a disaster which happened a month ago and I was able to restore to a new hardware.

Easier as there is no need to reinstall something. It is like restoring a snapshot…

The only problem I had was with the network and that is why I am trying to resolve it.

Michel-André

agreed, this should be implemented in nethserver-backuppc

Hi Stéphane,

What should be the best sequence:

  1. pre-restore-config

  2. pre-restore-data

  3. sh-4.2$ ssh -p 3333 root@10.10.10.66 “cd / && /bin/tar -xv” < source-782003.tar

  4. restore-config --skip-network --no-reinstall

  5. post-restore-config

  6. post-restore-data

Reboot and voilà!
SOURCE is running on a new hardware…

Michel-André

no tested like this but I suppose that BackupPC can do all of this with the RestorePostUserCmd that is triggered after the restore of all files

not tested also but there is an action that reconfigure all services : https://wiki.nethserver.org/doku.php?id=howto:useful_commands#reconfigure_the_server

Ok this just expand all templates and restart services, if the service is not installed by the restoration we have an issue.

Hi Stéphane,

I restore from the CLI and not from BackupPC itself. (I will have to look at restoring to another host).
I am sure that all files from the backup are all restored.

I guess it will be better to send a script with those commands to DESTINATION and then run it from DESTINATION itself.

I just have to adjust the ssh to be run from DESTINATION instead of from BackupPC…

Michel-André

2 Likes

It never finished even after 2 hours.

Michel-André