blog:rear_relax_recover

Rear (Relax-and-Recover)

mkisofs (or genisoimage)
mingetty (rear is depending on it in recovery mode)
syslinux (for i386 based systems)
nfs-utils (when using NFS to store the archives)
cifs-utils (when using SMB to store the archives)

http://download.opensuse.org/repositories/Archiving:/Backup:/Rear/Debian_10/amd64/rear_2.6-0_amd64.deb

apt-get install mkisofs mingetty syslinux cifs-utils nfs-utils sshfs
dpkg -i rear_2.6-0_amd64.deb
root@stkoner-pmox2:~# cat /etc/rear/local.conf
# Default is to create Relax-and-Recover rescue media as ISO image
# set OUTPUT to change that
# set BACKUP to activate an automated (backup and) restore of your data
# Possible configuration values can be found in /usr/share/rear/conf/default.conf
#
# This file (local.conf) is intended for manual configuration. For configuration
# through packages and other automated means we recommend creating a new
# file named site.conf next to this file and to leave the local.conf as it is.
# Our packages will never ship with a site.conf.

OUPUT=ISO
BACKUP=NETFS
BACKUP_URL="sshfs://ben@nas/ZP_nas/stkoner-pmox2-rear"
NETFS_KEEP_OLD_BACKUP_COPY=3
BACKUP_PROG_EXCLUDE=( '/tmp/*' '/dev/shm/*' "$VAR_DIR/output/*" "/ZP_vDisks/*" "/ZP_nas/*" "/ZP_ext/*" )

⇒ La variable BACKUP_URL ne supporte que le port ssh par défaut.

⇒ Pour spécifier un port différent, si on se connecte à la machine serveur1.domain.net :

root@stkoner-pmox:~/.ssh# cat ~/.ssh/config

Host serveur1.domain.net
    HostName serveur1.domain.net
    User root
    Port 2525

Il suffit ensuite de lancer ssh serveur1.domain.net, le port 2525 est implicitement utilisé.

⇒ Si vous utiliser un adressage IP fixe, créer les fichiers ci-dessous :

  • /etc/rear/mappings/ip_addresses
eth0 192.268.1.252/24
  • /etc/rear/mappings/routes
default 192.168.1.254 eth0

⇒ Penser à copier la clé SSH vers la machine distante

rear -v mkbackup
root@stkoner-pmox2:~# rear -v mkbackup
Relax-and-Recover 2.6 / 2020-06-17
Running rear mkbackup (PID 54505)
Using log file: /var/log/rear/rear-stkoner-pmox2.log
Running workflow mkbackup on the normal/original system
Using backup archive '/tmp/rear.BwoSapPOuUWGjNq/outputfs/stkoner-pmox2/backup.tar.gz'
Using autodetected kernel '/boot/vmlinuz-5.4.143-1-pve' as kernel in the recovery system
Creating disk layout
Overwriting existing disk layout file /var/lib/rear/layout/disklayout.conf
Using guessed bootloader 'GRUB' (found in first bytes on /dev/sda)
Verifying that the entries in /var/lib/rear/layout/disklayout.conf are correct ...
Creating recovery system root filesystem skeleton layout
Copying logfile /var/log/rear/rear-stkoner-pmox2.log into initramfs as '/tmp/rear-stkoner-pmox2-partial-2021-11-15T12:06:02+01:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/5.4.143-1-pve (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Symlink '/usr/share/misc/magic' -> '/usr/share/file/magic' refers to a non-existing directory on the recovery system.
It will not be copied by default. You can include '/usr/share/file/magic' via the 'COPY_AS_IS' configuration variable.
Testing that the recovery system in /tmp/rear.BwoSapPOuUWGjNq/rootfs contains a usable system
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (266267302 bytes) in 40 seconds
Making ISO image
Wrote ISO image: /var/lib/rear/output/rear-stkoner-pmox2.iso (267M)
Copying resulting files to sshfs location
Saving /var/log/rear/rear-stkoner-pmox2.log as rear-stkoner-pmox2.log to sshfs location
Copying result files '/var/lib/rear/output/rear-stkoner-pmox2.iso /tmp/rear.BwoSapPOuUWGjNq/tmp/VERSION /tmp/rear.BwoSapPOuUWGjNq/tmp/README /tmp/rear.BwoSapPOuUWGjNq/tmp/rear-stkoner-pmox2.log' to /tmp/rear.BwoSapPOuUWGjNq/outputfs/stkoner-pmox2 at sshfs location
Making backup (using backup method NETFS)
Creating tar archive '/tmp/rear.BwoSapPOuUWGjNq/outputfs/stkoner-pmox2/backup.tar.gz'
Archived 1873 MiB [avg 8127 KiB/sec] OK
WARNING: tar ended with return code 1 and below output:
  ---snip---
  tar: /var/lib/lxcfs: file changed as we read it
  tar: /var/agentx/master: socket ignored
  tar: pve: Warning: Cannot flistxattr: Operation not supported
  ----------
This means that files have been modified during the archiving
process. As a result the backup may not be completely consistent
or may not be a perfect copy of the system. Relax-and-Recover
will continue, however it is highly advisable to verify the
backup in order to be sure to safely recover this system.

Archived 1873 MiB in 237 seconds [avg 8093 KiB/sec]
Exiting rear mkbackup (PID 54505) and its descendant processes ...
Running exit tasks
root@stkoner-pmox2:~#

Plusieurs fichiers sont créés :

root@stkoner-pmox2:~# ssh nas ls -ltr /ZP_nas/stkoner-pmox2-rear/stkoner-pmox2/
total 2198723
-rw------- 1 ben ben  279052288 Nov 15 12:07 rear-stkoner-pmox2.iso
-rw------- 1 ben ben        277 Nov 15 12:07 VERSION
-rw------- 1 ben ben        202 Nov 15 12:07 README
-rw------- 1 ben ben      98085 Nov 15 12:07 rear-stkoner-pmox2.log
-rw------- 1 ben ben 1964661358 Nov 15 12:11 backup.tar.gz
-rw------- 1 ben ben    6004179 Nov 15 12:11 backup.log
  • rear-stkoner-pmox2.iso : ISO bootable pour la recovery
  • backup.tar.gz : contient la sauvegarde OS

FAQ : http://relax-and-recover.org/documentation/faq






  • blog/rear_relax_recover.txt
  • Dernière modification : 2022/01/20 12:20
  • de ben