Operating System - Linux
1752801 Members
5517 Online
108789 Solutions
New Discussion

Re: ReaR configuration and recover

 
Narendra1979
Occasional Contributor

ReaR configuration and recover

Hi,
I have installed the rear and trying to configure the same for OS backup. We have OS - SUSE Linux Enterprise Server 11 SP4.

I was not able to find the sample conf file for SLES 11.4 but there was SLE11-ext3-example.conf and SLE12-btrfs-example.conf and we are using btrfs for ROOT filesystem.

I have modified the local.conf file accordingly but please confirm which one is correct or need any correction our main objective is just in case OS gets crashed/corrupt and need to recover the OS from backup.

cat local.conf based on sample SLE11-ext3-example.conf
OUTPUT=ISO
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=3,nolock"
BACKUP_URL=nfs://10.10.9.13/rear/backup
NETFS_KEEP_OLD_BACKUP_COPY=yes

cat local.conf based on sample SLE12-btrfs-example.conf
OUTPUT=ISO
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=3,nolock"
BACKUP_URL=nfs://10.10.9.13/rear/backup
NETFS_KEEP_OLD_BACKUP_COPY=yes
BACKUP_PROG_INCLUDE=( '/home/*' '/var/tmp/*' '/var/spool/*' '/var/opt/*' '/var/log/*' '/var/lib/pgsql/*' '/var/lib/mailman/*' '/var/lib/named/*' '/usr/local/*' '/tmp/*' '/srv/*' '/boot/grub2/x86_64-efi/*' '/opt/*' '/boot/grub2/i386-pc/*' )

And also how we can access this image without burning this ISO image to a DVD or CD . How we can use a network boot via PXE as this is VM system and if needed how we can boot this VM to recover the system using ReaR backup? Or any other alternate solution?

Thanks,
Narendra

3 REPLIES 3
Matti_Kurkela
Honored Contributor

Re: ReaR configuration and recover

Since it's a VM system (which virtualization platform, by the way? VMware? SuSE virtualization with KVM? Something else?), it should be possible to present/unpresent additional virtual disks to the VMs as needed.

So, do you even need PXE netboot functionality for recovery? Just present an additional virtual disk to some VM, run "rear format /dev/<whatever>" to it, and that will be your recovery virtual disk. Verify that it contains all the tools needed to check, recover, recreate and mount btrfs filesystems. Unpresent it from the VM but don't destroy it. Think of it as a virtual USB stick with the recovery software installed.

When you need to recover a VM system disk, present this recovery virtual disk to that VM and set the VM to boot from it rather than its original system disk, but make sure the system still sees the original system disk too. Then boot the VM, run the recovery to the original system disk, then unpresent the recovery virtual disk and revert the VM configuration to what it was (i.e. boot from the restored system disk). That's it, your VM system disk (and optionally any other disks at the same time) is recovered.

Obviously, you should test this procedure to verify that it's possible for your virtualization platform, and possibly even script it so that the necessary VM configuration changes can be done automatically.

Note that Linux can use a command like "mount -o loop,ro /some/where/image.iso /mnt" to directly mount any files that contain a filesystem image. It's not limited to ISO images - any non-network filesystem type should work. ReaR probably handles all this automatically for you, but it's good to know in case you need to recover just one specific file from ReaR backups manually. (By the way, if you need to mount a disk image that includes a partition table and several partitions, you should learn about commands "losetup" and "kpartx" - with them, it's really easy to access partitioned disk images.)

Your local.conf examples are identical, except that the second one has a BACKUP_PROG_INCLUDE setting and the first one hasn't. The value of BACKUP_PROG_INCLUDE should be set to match how the filesystems are configured in your VMs; you should probably create your own BACKUP_PROG_INCLUDE value using a command line like the one described in https://github.com/rear/rear/issues/1330 :

findmnt -n -r -t btrfs | cut -d ' ' -f 1 | grep -v '^/$' | egrep -v 'snapshots|crash' | sed -e "s/$/\/*'/" -e "s/^/'/" | tr '\n' ' '

Run this command in your VM, and it should display a suggested BACKUP_PROG_INCLUDE value for you. Consider it as a starting point: for example, if you have PostgreSQL databases which are already backed up using a backup method that is more appropriate for them, it might not be necessary to back up all of /var/lib/pgsql/* using ReaR. (Filesystem-level backups from databases taken when the database is active are not likely to be useable, as the state of the database can change while the backup is being created, causing the backup of the database to be internally inconsistent.)

MK
simplylinuxfaq
Frequent Advisor

Re: ReaR configuration and recover

Yes, good information provided by Matti. You really don't need "BACKUP_OPTIONS" unless there is a nfs version change between rear server (backup) and client end systems. You may consider adding "BACKUP_PROG_EXCLUDE" to exclude un-wanted data such as /var/crash, /media which may not be required which otherwise endup in creating a huge backup image dump. 

The command "rear -d -v mkbackup" when run after configuring rear backup file "/etc/rear/local.conf" with correct parameters would generate necessary files and copy files over NFS to the destination rear backup server.  There would be a directory created with hostname on the remote rear backup server which would show up a file with .iso extenstion, this is usually in the format of "rear-<hostname>.iso" which can be used as a bootable image file to recover system or even could be used to create a new system.  This would fetch necessary backup files from the rear backup server.

By default these backup files would gets created under "/var/lib/rear/output/" and then would be moved over to nfs server.

After booting the iso file you could just select "automatic recovery" or select "recovery <hostname> option. I've made a small writeup on this in my blog: http://simplylinuxfaq.blogspot.in/2016/11/rear-linux-disaster-recovery-solution.html review it. This may help. 

All the best!

 

Thanks,
SimplyLinuxFAQ
Narendra1979
Occasional Contributor

Re: ReaR configuration and recover

Hi Matt,

Yes good option but unfortunately we don't have enough space to add another virtual disk for backup. We are going to upgrade the storage but it will happen in next year. So in mean time I am looking for some network solution so that we can boot the VM and can restore the ReaR backup from network location.

And we are using VMware 6.0 for virtualization platform.

And also I have run the command as below on our SLES 11.4,

test193:~ # findmnt -n -r -t btrfs | cut -d ' ' -f 1 | grep -v '^/$' | egrep -v 'snapshots|crash' | sed -e "s/$/\/*'/" -e "s/^/'/" | tr '\n' ' ' '/srv/*' '/opt/*' '/tmp/*' '/var/spool/*' '/var/run/*' '/var/log/*' '/var/tmp/*'

We need just only OS backup if system is not booting and need to restore then we can use that backup to restore from network location.

 

Thanks,

Narendra