#3346 Issue closed: On SLES: /.snapshots should be excluded from the backup by default

Labels: enhancement, fixed / solved / done

jsmeix opened issue at 2024-11-26 08:48:

  • ReaR version ("/usr/sbin/rear -V"):
    current GitHub master code

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

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

# grep -v '^#' etc/rear/local.conf

OUTPUT=ISO
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=3,nolock"
BACKUP_URL=nfs://192.168.178.66/nfs
REQUIRED_PROGS+=( snapper chattr lsattr )
COPY_AS_IS+=( /usr/lib/snapper/installation-helper /etc/snapper/config-templates/default )
POST_RECOVERY_SCRIPT=( 'if snapper --no-dbus -r $TARGET_FS_ROOT get-config | grep -q "^QGROUP.*[0-9]/[0-9]" ; then snapper --no-dbus -r $TARGET_FS_ROOT set-config QGROUP= ; snapper --no-dbus -r $TARGET_FS_ROOT setup-quota && echo snapper setup-quota done || echo snapper setup-quota failed ; else echo snapper setup-quota not used ; fi' )
SSH_ROOT_PASSWORD="rear"
USE_DHCLIENT="yes"
FIRMWARE_FILES=( 'no' )
MODULES=( 'loaded_modules' )
PROGRESS_MODE="plain"
PROGRESS_WAIT_SECONDS="5"
  • Hardware vendor/product (PC or PowerNV BareMetal or ARM) or VM (KVM guest or PowerVM LPAR):
    KVM guest

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

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

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

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

# lsblk -ipo NAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINTS

NAME        TRAN   TYPE FSTYPE   SIZE MOUNTPOINTS
/dev/sr0    sata   rom  iso9660 15.3G 
/dev/vda    virtio disk           15G 
|-/dev/vda1 virtio part            8M 
|-/dev/vda2 virtio part btrfs     13G /var
|                                     /usr/local
|                                     /tmp
|                                     /srv
|                                     /root
|                                     /opt
|                                     /home
|                                     /boot/grub2/x86_64-efi
|                                     /boot/grub2/i386-pc
|                                     /.snapshots
|                                     /
`-/dev/vda3 virtio part swap       2G [SWAP]
  • Description of the issue (ideally so that others can reproduce it):

/.snapshots gets included in the backup by default
so its many snapshot mountpoint directories
with grub-snapshot.cfg and info.xml files

/.snapshots/NNN/snapshot
/.snapshots/NNN/grub-snapshot.cfg
/.snapshots/NNN/info.xml

and its /.snapshots/grub-snapshot.cfg
get restored during "rear recover"
so after "rear recover" one has /.snapshots
messed up with old files - in particular the new created
and only correct one .snapshots/1 would get overwritten
with old files from the backup.

For details see
https://github.com/rear/rear/pull/3175#issuecomment-2112519793

  • Workaround, if any:
BACKUP_PROG_EXCLUDE+=( /.snapshots )

jsmeix commented at 2024-11-27 07:11:

With the BACKUP_PROG_EXCLUDE+=( /.snapshots ) workaround
one gets in the ReaR log file

# grep -v '^+' var/log/rear/rear-localhost.log | grep -A18 'Backup include list'
2024-11-26 09:43:41.975228275 Backup include list /var/tmp/rear.sJ73HCfxHZwNnoE/tmp/backup-include.txt
2024-11-26 09:43:41.978358324   /
2024-11-26 09:43:41.980551637   /.snapshots
2024-11-26 09:43:41.982864473   /boot/grub2/i386-pc
2024-11-26 09:43:41.985075359   /boot/grub2/x86_64-efi
2024-11-26 09:43:41.987471321   /home
2024-11-26 09:43:41.989633355   /opt
2024-11-26 09:43:41.991928809   /root
2024-11-26 09:43:41.994070064   /srv
2024-11-26 09:43:41.996350089   /tmp
2024-11-26 09:43:41.998580431   /usr/local
2024-11-26 09:43:42.000772090   /var
2024-11-26 09:43:42.003076150 Backup exclude list /var/tmp/rear.sJ73HCfxHZwNnoE/tmp/backup-exclude.txt
2024-11-26 09:43:42.005306482   /tmp/*
2024-11-26 09:43:42.007590094   /dev/shm/*
2024-11-26 09:43:42.009741257   /root/rear.github.master/var/lib/rear/output/*
2024-11-26 09:43:42.012059454   /var/tmp/rear.sJ73HCfxHZwNnoE
2024-11-26 09:43:42.014276982   /.snapshots
2024-11-26 09:43:42.016722627 Creating tar archive '/var/tmp/rear.sJ73HCfxHZwNnoE/outputfs/localhost/backup.tar.gz'

which shows why BACKUP_PROG_EXCLUDE+=( /.snapshots )
is not a solution but only a workaround
because it does not make sense to
first add /.snapshots by default (i.e. by automatism)
to the backup include list and then also add /.snapshots
to the backup exclude list (by specification in local.conf)
so the solution is to not add /.snapshots
by default to the backup include list
(at least not for the SUSE default btrfs structure).

jsmeix commented at 2024-11-28 11:27:

With https://github.com/rear/rear/pull/3347 merged
this issue is fixed.


[Export of Github issue for rear/rear.]