#2563 Issue closed: Trying to restore ZFS pool

Labels: support / question, fixed / solved / done, external tool

jagauthier opened issue at 2021-02-04 14:30:

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"):
    2.4

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

  • Rear local.conf
    OUTPUT=iso
    BACKUP=netfs
    BACKUP_URL=usb://dev/disk/by-lavel/REAR-000
    MODULES=( {$MODULES[@]} 'zfs')

I didn't fill out the rest of the support template, but if I missed something important, I apologize.
I have a ZFS pool (not root partition) mounted on /project along with several ZFS filesystems.

rear backs these up seemingly fine, considering it's just doing a system wide tar archive.
But, I am having trouble restoring.

I am following these steps:

  1. Boot recovery media
  2. export MIGRATION_MODE='true'
  3. rear -D recover
  4. confirm and accept disk map
  5. conform and accept disk layout
  6. pop into shell
  7. recreate pool, filesystems.
  8. leave shell, and confirm/run disk scripts.
  9. pop into a shell again.
  10. I can confirm ZFS is mounted on /project and my target disks are located on /mnt/local
    ZFS pools can't be mounted anywhere. They have to be mounted where they are going to go, and stay there.
    So I create a symbolic link /project /mnt/local/project
  11. exit shell, and continue recovery.

When the recovery is complete I see the synbolic link I created is gone and /mnt/local/project is a directory with my files in it.

I'm so close. Can anyone offer an alternative restore process that might work?

jagauthier commented at 2021-03-08 14:32:

Just wanted to hit this again and see if there are any suggestions to rear overwriting a symbolic link on recovery.

jagauthier commented at 2021-03-08 18:43:

Okay, I've figured out how to accomplish this during a recovery.

After the disk confirm script, everything will be mounted on /mnt/local

Get into a rear shell and create the ZFS pools and filesystems.
Then set the ZFS mount point like so:
zfs set mountpoint=/mnt/local/zpool/fs zpool/fs

When you restore, they will go to the correct place.
When done, set the mountpoint back to the default:
zfs set mountpoint=/zpool/fs zpool/fs

jsmeix commented at 2021-03-09 12:52:

@jagauthier
thank you for your report how one could restore a ZFS pool
with some manual intervention.

I don't use ZFS and I know nothing about ZFS pool
so I cannot make any actually helpful comment here.
As far as I see there is currently no support for ZFS in ReaR because

user:~/rear.github.master # find usr/share/rear/ -type f | xargs grep -i 'zfs'

outputs nothing.

lexzz commented at 2021-03-11 09:36:

@jsmeix Do you know if there will be ZFS support later on?
Or an alternative way to implement it?

jsmeix commented at 2021-03-11 12:49:

I cannot speak for other ReaR developers.
Personally I have no plans to implement ZFS support in ReaR
because I never used ZFS and I have no plans to use it and
ZFS is not part of openSUSE or SUSE Linux Enterprise products.

The normal way how something gets implemented for free software is
that users who need a particular additional functionality implement it
and contribute their code to the free software project.
Usually a particular additional functionality is first implemented only
in a basic and specific way how those users need it for their use case.
Because it is free software other users with other use cases can then
further enhance that functionality step by step as needed.

See
http://relax-and-recover.org/development/
and the sections
"How to adapt and enhance Relax-and-Recover" and
"How to contribute to Relax-and-Recover" in
https://en.opensuse.org/SDB:Disaster_Recovery

In general how to start with adding support for another filesystem in ReaR:

To get an idea what scripts in ReaR contain code that belongs to filesystem support
search the ReaR scripts for existing filesystems like

~/rear.github.master # find usr/share/rear/ -type f -name '*.sh' | xargs grep -li 'ext[234]'
usr/share/rear/build/default/990_verify_rootfs.sh
usr/share/rear/format/USB/default/200_check_usb_layout.sh
usr/share/rear/layout/prepare/GNU/Linux/131_include_filesystem_code.sh
usr/share/rear/layout/prepare/GNU/Linux/133_include_mount_filesystem_code.sh
usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh
usr/share/rear/restore/YUM/default/940_generate_fstab.sh
usr/share/rear/restore/ZYPPER/default/940_generate_fstab.sh
usr/share/rear/lib/format-workflow.sh
usr/share/rear/lib/bootloader-functions.sh
usr/share/rear/lib/layout-functions.sh
usr/share/rear/lib/linux-functions.sh
usr/share/rear/lib/columns-functions.sh
usr/share/rear/prep/USB/default/380_copy_usb_fs_module.sh

~/rear.github.master # find usr/share/rear/ -type f -name '*.sh' | xargs grep -li 'xfs'
usr/share/rear/layout/prepare/default/010_prepare_files.sh
usr/share/rear/layout/prepare/default/319_rename_xfs_configs.sh
usr/share/rear/layout/prepare/GNU/Linux/131_include_filesystem_code.sh
usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
usr/share/rear/layout/save/GNU/Linux/100_create_layout_file.sh
usr/share/rear/lib/filesystems-functions.sh

~/rear.github.master # find usr/share/rear/ -type f -name '*.sh' | xargs grep -li 'btrfs'
usr/share/rear/output/default/940_grub2_rescue.sh
usr/share/rear/build/OPALPBA/Linux-i386/095_exclude_non_essential_files.sh
usr/share/rear/format/USB/default/200_check_usb_layout.sh
usr/share/rear/format/USB/default/350_label_usb_disk.sh
usr/share/rear/layout/prepare/default/320_apply_mappings.sh
usr/share/rear/layout/prepare/GNU/Linux/131_include_filesystem_code.sh
usr/share/rear/layout/prepare/GNU/Linux/136_include_btrfs_subvolumes_SLES_code.sh
usr/share/rear/layout/prepare/GNU/Linux/135_include_btrfs_subvolumes_generic_code.sh
usr/share/rear/layout/prepare/GNU/Linux/133_include_mount_filesystem_code.sh
usr/share/rear/layout/compare/default/500_compare_layout.sh
usr/share/rear/layout/save/default/330_remove_exclusions.sh
usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
usr/share/rear/verify/TSM/default/400_verify_tsm.sh
usr/share/rear/lib/bootloader-functions.sh
usr/share/rear/lib/layout-functions.sh
usr/share/rear/lib/filesystems-functions.sh

Inspect the code in those scripts to get an overview
how filesystem support is usually implemented in ReaR.

The main scripts where filesystem support is implemented in ReaR are

usr/share/rear/layout/prepare/GNU/Linux/131_include_filesystem_code.sh
usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh

jsmeix commented at 2021-03-24 08:25:

See also https://github.com/rear/rear/issues/1932


[Export of Github issue for rear/rear.]