#894 PR merged: fall back to old way when 'mkfs -U' fails (issue 890 and issue 851)

Labels: enhancement, bug, fixed / solved / done

jsmeix opened issue at 2016-06-27 10:29:

try to create the filesystem with initially correct UUID (https://github.com/rear/rear/issues/851)
but when 'mkfs -U' fails (e.g. on RHEL 5, https://github.com/rear/rear/issues/890)
assume it failed because of missing support for '-U'
and then fall back to the old way before issue 851
i.e. using mkfs without '-U' plus 'tunefs -U'

jsmeix commented at 2016-06-27 10:52:

I need to test if that works for me
on SLE11 and SLE12 with ext4 ...

jsmeix commented at 2016-06-27 11:43:

Works well for me on SLE12 with ext4.

Some details FYI:

After "rear -d -D recover" in the recovery system
diskrestore.sh contains

# Try 'mkfs -U' to create the filesystem with initially correct UUID
# but if that fails assume it failed because of missing support for '-U'
# (e.g. in RHEL 5 it fails, see https://github.com/rear/rear/issues/890)
# then fall back to using mkfs without '-U' plus 'tune2fs/tune4fs -U'
if ! mkfs -t ext4 -b 4096 -i 16370 -U 6a661d11-b4cf-4892-8d64-5735eef68309 /dev/sda2 >&2 ; then
    mkfs -t ext4 -b 4096 -i 16370 /dev/sda2 >&2
    tune2fs -U 6a661d11-b4cf-4892-8d64-5735eef68309 /dev/sda2 >&2
fi

and var/log/rear/rear-e229.log contains

+++ mkfs -t ext4 -b 4096 -i 16370 -U 6a661d11-b4cf-4892-8d64-5735eef68309 /dev/sda2
mke2fs 1.42.11 (09-Jul-2014)
Discarding device blocks: done                            
Creating filesystem with 4859392 4k blocks and 1218224 inodes
Filesystem UUID: 6a661d11-b4cf-4892-8d64-5735eef68309
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

jsmeix commented at 2016-06-27 12:19:

Works also well for me on SLE11 with ext3.

Some details (basically the same as for SLE12 with ext4):

After "rear -d -D recover" in the recovery system
diskrestore.sh contains

# Try 'mkfs -U' to create the filesystem with initially correct UUID
# but if that fails assume it failed because of missing support for '-U'
# (e.g. in RHEL 5 it fails, see https://github.com/rear/rear/issues/890)
# then fall back to using mkfs without '-U' plus 'tune2fs/tune4fs -U'
if ! mkfs -t ext3 -b 4096 -i 16370 -U de51dda4-8a5d-4206-b5ee-6eaa9e88bec3 /dev/sda2 >&2 ; then
    mkfs -t ext3 -b 4096 -i 16370 /dev/sda2 >&2
    tune2fs -U de51dda4-8a5d-4206-b5ee-6eaa9e88bec3 /dev/sda2 >&2
fi

and var/log/rear/rear-f96.log contains

+++ mkfs -t ext3 -b 4096 -i 16370 -U de51dda4-8a5d-4206-b5ee-6eaa9e88bec3 /dev/sda2
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1218224 inodes, 4859392 blocks
242969 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
149 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

jsmeix commented at 2016-06-27 12:21:

Because it seems there are no regressions (at least not for me)
I merge it so that also others test it when using rear master.


[Export of Github issue for rear/rear.]