Restoring whole yunohost from borg backups

How many Gigabytes did you have before the crash?
How much space do you have on the new one?
What is the upload rate on your backup server, and the download rate on your new server?

How to proceed depends on the answers to these questions…

In the easiest case, I would say that what you propose is not so bad:

  1. Install yunohost (you can install a yunohost 4.0.x (buster) version even if you was in stretch before, but only if your backuped apps was up to date)
  2. You need to do the postinstall to setup borg app
  3. After the setup of borg, you should go in the backup server to replace the ssh key in /home/USER/.ssh/authorized_keys
  4. On the new server identify which archive you want to restore:
BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -oStrictHostKeyChecking=yes " borg list ssh://BORG_USER@DOMAIN_OF_BACKUP_SERVER:PORT/~/backup
  1. Then recreate tar.gz archives:
BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -oStrictHostKeyChecking=yes " borg export-tar ssh://BORG_USER@DOMAIN_OF_BACKUP_SERVER:PORT/~/backup::ARCHIVE /home/yunohost.backup/archives/ARCHIVE.tar.gz
  1. Finally you can restore in the order you give (conf, data and finally apps per apps)
yunohost backup restore conf --system
yunohost backup restore data --system
yunohost backup restore nextcloud --apps
yunohost backup restore concrete5 --apps

If you have a lot of data in your nextcloud, you can use borg extract command to extract directly all nextcloud data into /home/yunohost.app/nextcloud/data/ . And next you can create a nextcloud archive without data with:

BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -oStrictHostKeyChecking=yes " borg export-tar -e apps/nextcloud/backup/home/yunohost.app  ssh://BORG_USER@DOMAIN_OF_BACKUP_SERVER:PORT/~/backup::ARCHIVE /home/yunohost.backup/archives/ARCHIVE.tar.gz

You can do the same process for /var/mail in data archive.

I know it’s quite difficult to do all of that, and some devlopement should appear to ease this process.

Note: it could be more difficult if you have not enough bandwidth or space, or if you use a noho.st, nohost.me or ynh.fr domain…

1 Like