7 Backing up an RMT server #
This chapter explains how to create a backup of your RMT server and how to restore it.
7.1 Creating a backup #
   This procedure details how to create a full backup of your RMT
   server. It is assumed that you have an external disk or network share
   mounted in /mnt/backup which serves as a target
   for the backup.
  
- Change to the backup directory. - #- cd /mnt/backup
- Create a file containing a dump of your SQL database. You need to provide the password you set for the - rmtdatabase user during the installation.- #- mysqldump -u rmt -p rmt > rmt_backup.sql
- Optionally, create a copy of your mirrored data. - #- mkdir repos- #- rmt-cli export repos ./repos/
7.2 Restoring a backup #
   This procedure details how to restore your RMT server from a backup
   created in Section 7.1, “Creating a backup”. It is assumed that
   the backup is mounted in /mnt/backup. It is also
   assumed that you are restoring the server on a newly installed
   SLES.
  
- Install and configure the RMT server as described in Chapter 2, RMT installation and configuration. 
- Go to the backup directory. - #- cd /mnt/backup/
- Use - mysqlto remove the newly created database and import the data.- #- mysql -u rmt -pEnter password: Welcome to the MariaDB monitor. Commands end with ; or \g. [...]- MariaDB [(none)]>- DROP DATABASE rmt;Query OK, 14 rows affected (0.84 sec)- MariaDB [(none)]>- CREATE DATABASE rmt;Query OK, 1 row affected (0.00 sec)- MariaDB [(none)]>- use rmt;Database changed- MariaDB [rmt]>- source rmt_backup.sql;[...]- MariaDB [rmt]>- quit
- Optionally, import the exported repositories. - #- rmt-cli import repos ./repos/
- Synchronize your data and update your repositories. - #- rmt-cli sync- #- rmt-cli mirror