#2598 Issue closed: Restore a single file from a REAR backup

Labels: support / question, fixed / solved / done

IT-Guy-1973 opened issue at 2021-04-08 00:06:

Relax-and-Recover (ReaR) Issue Template

Fill in the following items before submitting a new issue
(quick response is not guaranteed with free support):

  • ReaR version ("/usr/sbin/rear -V"):

Relax-and-Recover 2.4 / Git

  • OS version ("cat /etc/os-release" or "lsb_release -a" or "cat /etc/rear/os.conf"):

cat /etc/os-release

NAME="SLES"
VERSION="15-SP2"
VERSION_ID="15.2"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP2"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp2"

  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):

cat /etc/rear/site.conf

site.conf

another config file that is sourced BEFORE local.conf

could be used to set site-wide settings

you could then distribute the site.conf from a central location while you keep

the machine-local settings in local.conf

BACKUP=NETFS
OUTPUT=ISO
BACKUP_URL=nfs://10.98.48.106/backup/NonProd/SUSE15/
MODULES_LOAD=(vmxnet)
#BACKUP_PROG_EXCLUDE=( '/tmp/' '/dev/shm/' /output/* )
BACKUP_PROG_INCLUDE=( '/boot' '/' 'swap' '/dev')

Do NOT use MANUAL_INCLUDE mode. In MANUAL_INCLUDE mode, only the filesystems explicitly specified

in BACKUP_PROG_INCLUDE will be saved. MANUAL_INCLUDE (=YES) is only useful, if your systems do always have the

same basic mountpoints you want to save (either flat partitions or LVM or even mixed) and want to ignore

additional filesystems, that might have been included into the system (via SAN) to not blow up the

recovery system

Be sure to test your recovery when you want to use this mode! Default is NO

MANUAL_INCLUDE=YES

  • Hardware (PC or PowerNV BareMetal or ARM) or virtual machine (KVM guest or PoverVM LPAR):

VMWARE virtual machine

  • System architecture (x86 compatible or PPC64/PPC64LE or what exact ARM device):
    x86 compatible

  • Firmware (BIOS or UEFI or Open Firmware) and bootloader (GRUB or ELILO or Petitboot):

N/A

  • Storage (local disk or SSD) and/or SAN (FC or iSCSI or FCoE) and/or multipath (DM or NVMe):

VMDK

  • Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINT" or "lsblk" as makeshift):

lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 80G 0 disk
└─vg_test-test_lv 254:2 0 79G 0 lvm
sdb 8:16 0 80G 0 disk
├─sdb1 8:17 0 501M 0 part /boot
└─sdb2 8:18 0 79.5G 0 part
├─vg_00-lv_root 254:0 0 23.5G 0 lvm /
└─vg_00-lv_swap 254:1 0 16G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom

  • Description of the issue (ideally so that others can reproduce it):

I need to know whether there is an option to install just one file using the REAR backup that is stored on the NFS server.

NFS server output:

ls -l

total 4411140
-rw------- 1 root root 202 Apr 7 00:38 README
-rw------- 1 root root 265 Apr 7 00:38 VERSION
-rw------- 1 root root 13975071 Apr 7 00:48 backup.log
-rw------- 1 root root 4185885271 Apr 7 00:48 backup.tar.gz
-rw------- 1 root root 311480320 Apr 7 00:38 rear-sg6w3100.iso
-rw------- 1 root root 5641172 Apr 7 00:38 rear-sg6w3100.log

Is there an option with REAR that I could only restore the /etc/passwd file on the running system without restoring the entire system?

  • Workaround, if any:

  • Attachments, as applicable ("rear -D mkrescue/mkbackup/recover" debug log files):

To paste verbatim text like command output or file content,
include it between a leading and a closing line of three backticks like

```
verbatim content
```

jsmeix commented at 2021-04-08 08:41:

There is no method implemented in ReaR to restore
on the running system something from the backup.

To restore on the running system something from the backup
you need to do it manually:
You have to manually mount the NFS share at a local mountpoint
so that you can access the backup.tar.gz locally on the running system
and then manually restore what you need from the backup.

FYI:

When your system does no longer boot or no longer works normally
e.g. because of deleted or corrupted essential files
you can restore such essential files "from outside" by booting
the ReaR recovery system and restore the files from there, cf.
https://github.com/rear/rear/issues/2553#issuecomment-785069808

But also in the ReaR recovery system there is no method implemented
to restore only some specific files from the backup.
You also have to manually mount the NFS share at a local mountpoint
so that you can access the backup.tar.gz locally in the ReaR recovery system
then mount your target system filesystems manually or via rear -D mountonly
and finally manually restore what you need from the backup into /mnt/local
i.e. into the mounted target system's filesystems.

Note that currently the 'mountonly' workflow may fail with certain
complicated filesystem structures like LVM on top of LUKS cf.
https://github.com/rear/rear/issues/2542
regardless that according to
https://github.com/rear/rear/pull/2269
it was tested with "LVM Logical Volumes and a LUKS-encrypted filesystem"
but perhaps not with LVM on top of LUKS and
also the complicated SUSE btrfs structure often causes special issues.


[Export of Github issue for rear/rear.]