[rear-users] Migrating from ReiserFS to a differen Filesystem

Johannes Meixner jsmeix at suse.de
Wed Apr 4 11:50:45 CEST 2018


Hello Dominik,

On Apr 4 01:37 Bessler, Dominik (FIT) wrote (excerpt):
> I just found ReaR and after reading some of the Documentation
> I'm wondering if it is possible to use it for migrating away
> from ReiserFS to XFS by creating a backup and then changing
> the Filesystem so it will create the new Machine with XFS
> instead of ReiserFS.

First and foremost:

When you are not yet a somewhat experienced ReaR user
you should do you first steps as described in the
"First steps with Relax-and-Recover" section in
https://en.opensuse.org/SDB:Disaster_Recovery


A few weeks ago I did a similar test migration
with a SLES12 test system (a virtual machine)
from its default btrfs structure to XFS.

I used latest ReaR upstream GitHub master code for that
because I need the new additional stop in migration mode
after the backup was restored just before the bootloader
will be installed because at that stage one needs to manually
adapt the outdated restored etc/fstab from the backup, cf.
https://github.com/rear/rear/pull/1758


Some details about my SLES12 btrfs to XFS migration
(excerpts from some mails that I had sent to someone
  plus a few more useful addons here):

#####################################################################

On Feb 16 08:54 ... wrote (excerpt):
> ... SLES12 ...
> They start with BTRFS but they are not really convinced
> and would like to migrate to more conventional XFS.

I did a quick test on virtual machines (with DHCP networking)
and things look promising for me but there might be some
unexpected subtle but possibly severe issues that come up later.

So far SLES12 migration from btrfs to XFS "just works" for me.

I use the current latest ReaR upstream GitHub master code.

On my original system I created an additional (virtual) sbd disk
where I formatted a partition with the 'mkfs.xfs' defaults
and mounted that to see what a normal 'fs xfs' entry
in disklayout.conf looks like.

On my original system "rear mkbackup" created this disklayout.conf
(excerpts - long lines may show wrapped here):
---------------------------------------------------------------------
# Disk /dev/sda
# Format: disk <devname> <size(bytes)> <partition label type>
disk /dev/sda 21474836480 msdos
# Partitions on /dev/sda
# Format: part <device> <partition size(bytes)> <partition start(bytes)> 
<partition type|name> <flags> /dev/<partition>
part /dev/sda 1561329664 1048576 primary none /dev/sda1
part /dev/sda 19912458240 1562378240 primary boot /dev/sda2
# Disk /dev/sdb
# Format: disk <devname> <size(bytes)> <partition label type>
disk /dev/sdb 2147483648 gpt
...
# Filesystems (only ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs are supported).
# Format: fs <device> <mountpoint> <fstype> [uuid=<uuid>] [label=<label>] 
[<attributes>]
fs /dev/sda2 / btrfs uuid=020abe70-76fd-4b92-b131-19ec050c492c label= 
options=rw,relatime,space_cache,subvolid=259,subvol=/@/.snapshots/1/snapshot
fs /dev/sdb3 /sdb3 xfs uuid=9e9bea32-0687-4982-8c81-bc0eb870452f label= 
options=rw,relatime,attr2,inode64,noquota
...
[tons of btrfs* stuff]
...
# Swap partitions or swap files
# Format: swap <filename> uuid=<uuid> label=<label>
swap /dev/sda1 uuid=ced43af1-b606-4a27-a74c-447f9a69c7f9 label=
---------------------------------------------------------------------

In the ReaR recovery system before running "rear -D recover"
I edited that disklayout.conf as follows
(long lines may show wrapped here):
---------------------------------------------------------------------
RESCUE e86:~ # diff -u 
/root/rear.master/var/lib/rear/layout/disklayout.conf.btrfs.original 
/root/rear.master/var/lib/rear/layout/disklayout.conf
--- /root/rear.master/var/lib/rear/layout/disklayout.conf.btrfs.original 
2018-03-07 16:02:09.085738064 +0100
+++ /root/rear.master/var/lib/rear/layout/disklayout.conf       2018-03-07 
16:04:37.861738064 +0100
@@ -17,7 +17,8 @@
  part /dev/sdb 104857600 1887436800 5.th%20GPT%20partition none /dev/sdb5
  # Filesystems (only ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs are supported).
  # Format: fs <device> <mountpoint> <fstype> [uuid=<uuid>] [label=<label>] 
[<attributes>]
-fs /dev/sda2 / btrfs uuid=020abe70-76fd-4b92-b131-19ec050c492c label= 
options=rw,relatime,space_cache,subvolid=259,subvol=/@/.snapshots/1/snapshot
+#fs /dev/sda2 / btrfs uuid=020abe70-76fd-4b92-b131-19ec050c492c label= 
options=rw,relatime,space_cache,subvolid=259,subvol=/@/.snapshots/1/snapshot
+fs /dev/sda2 / xfs uuid=020abe70-76fd-4b92-b131-19ec050c492c label= 
options=rw,relatime,attr2,inode64,noquota
  fs /dev/sdb3 /sdb3 xfs uuid=9e9bea32-0687-4982-8c81-bc0eb870452f label= 
options=rw,relatime,attr2,inode64,noquota
  # Btrfs default subvolume for /dev/sda2 at /
  # Format: btrfsdefaultsubvol <device> <mountpoint> <btrfs_subvolume_ID> 
<btrfs_subvolume_path>
---------------------------------------------------------------------
I.e. I only commented/disabled the 'fs /dev/sda2 / btrfs ...' entry
and added a new 'fs /dev/sda2 / xfs ...' entry where I kept the uuid
of the 'fs btrfs' entry but used the options from the other xfs entry.

I simply kept in particular all the other btrfs* stuff because
without a 'fs btrfs' entry all the other btrfs* stuff
is just skipped.

Before running "rear -D recover" I did
---------------------------------------------------------------------
RESCUE e86:~ # export MIGRATION_MODE=yes
---------------------------------------------------------------------
to enforce MIGRATION_MODE during "rear -D recover".

I just run "rear -D recover" and blindly accepted all the user
confirmation dialogs except the one after the backup resture.

In that "Confirm restored config files or edit them" confirmation dialog
I selected "Use Relax-and-Recover shell and return back to here"
and in that Relax-and-Recover shell
(which runs still inside the running "rear recover")
I adapted mnt/local/etc/fstab to only this content:
---------------------------------------------------------------------
UUID=ced43af1-b606-4a27-a74c-447f9a69c7f9 swap swap defaults 0 0
UUID=020abe70-76fd-4b92-b131-19ec050c492c / xfs defaults 0 0
---------------------------------------------------------------------
where you can see that same UUID as in disklayout.conf is sused.

Alternatively ony can select in the
"Confirm restored config files or edit them" confirmation dialog
the "Edit restored etc/fstab ..." directly but personally
I perfer the Relax-and-Recover shell because there
I can do anything what I want.

After that I let "rear recover" continue
to recreate the initrd and to reinstall the bootloader.

After "rear recover" finished I only needed to reboot.

After my SLES12 migration from btrfs to xfs
I have in my recreated SLES12 xfs-only system:
--------------------------------------------------------------
# systemctl list-unit-files | grep -i btrfs
btrfsmaintenance-refresh.service        enabled
--------------------------------------------------------------

Regarding this kind of services cf. the mail thread about
"Systemd-presets-common-SUSE and Btrfs Services"
on the opensuse-factory at opensuse.org mailing list
which started with this mail

Perhaps a good summary is that mail

https://lists.opensuse.org/opensuse-factory/2018-03/msg00295.html

but at least for some users such services run longer
even when there is no btrfs in use, cf.

https://lists.opensuse.org/opensuse-factory/2018-03/msg00315.html

so that on a system without btrfs this kind of services
should be better disabled or even completely uninstalled.

#####################################################################


A crucial point to make this "just work" with ReaR is to have
already some (tiny) mounted XFS partition on the system when
"rear mkbackup" runs because that mounted XFS partition triggers
the automatisms in ReaR to get all what is needed for XFS setup
included in the ReaR recovery system (without that things
like 'mkfs.xfs' would "just fail" during "rear recover").


How to use the latest ReaR upstream GitHub master code:

Basically "git clone" it into a separated directory and then
configure and run ReaR from within that directory like:
----------------------------------------------------------------
# git clone https://github.com/rear/rear.git

# mv rear rear.github.master

# cd rear.github.master

# vi etc/rear/local.conf

# usr/sbin/rear -D mkbackup
----------------------------------------------------------------
Note the relative paths "etc/rear/" and "usr/sbin/".


For general information about ReaR see

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

and

https://en.opensuse.org/SDB:Disaster_Recovery

in the latter see in particular the sections
"First steps with Relax-and-Recover"
and
"Debugging issues with Relax-and-Recover"
and
"How to contribute to Relax-and-Recover"


Kind Regards
Johannes Meixner
-- 
SUSE LINUX GmbH - GF: Felix Imendoerffer, Jane Smithard,
Graham Norton - HRB 21284 (AG Nuernberg)



More information about the rear-users mailing list