#156 Issue closed: Error in diskrestore.sh script

Labels: bug

bleyers opened issue at 2012-09-06 08:26:

Hi,

Weird problem. I have an Oracle Enterprise Linux 6 with 2 disks.
Per disk I have a volume group. Depending on the names of the volume groups the disk restore
script fails.

Here is a working scenario:
The default volume group is named vg_wlspro01 and the one i create is called app_vg.
Using those names the restore succeeds.

The faulty scenario:
The default volume group is named vg_wlspro01 and the on I create is called vg_wlspro01_app
Using those names the diskrestores failed

This is the error:
mke2fs 1.41.12 (17-May-2010)
/dev/mapper/vg_wlspro01_app-lv_app is mounted; will not make a filesystem here!
2012-09-05 16:30:10 An error occured during layout recreation.

When I look at the layout files i don"t see anything wrong but in the diskrestore script i find this.

if create_component "/dev/vg_wlspro01_app" "lvmgrp" ; then
#Create /dev/vg_wlspro01_app (lvmgrp)
LogPrint "Restoring LVM VG vg_wlspro01_app"
if [ -e /dev/vg_wlspro01_app ] ; then
    rm -rf /dev/vg_wlspro01_app
fi
lvm vgcfgrestore -f /var/lib/rear/layout/lvm/vg_wlspro01_app.cfg vg_wlspro01_app >&2
lvm vgchange --available y vg_wlspro01_app >&2
component_created "/dev/vg_wlspro01_app" "lvmgrp"
else
    LogPrint "Skipping /dev/vg_wlspro01_app (lvmgrp) as it has already been created."
fi

if create_component "/dev/vg_wlspro01" "lvmgrp" ; then
#Create /dev/vg_wlspro01 (lvmgrp)
LogPrint "Restoring LVM VG vg_wlspro01_app"
if [ -e /dev/vg_wlspro01_app ] ; then
    rm -rf /dev/vg_wlspro01_app
fi
lvm vgcfgrestore -f /var/lib/rear/layout/lvm/vg_wlspro01_app.cfg vg_wlspro01_app >&2
lvm vgchange --available y vg_wlspro01_app >&2
component_created "/dev/vg_wlspro01" "lvmgrp"
else
    LogPrint "Skipping /dev/vg_wlspro01 (lvmgrp) as it has already been created."
fi

As you can see in the second part of the script the references used in vgcfgrestore and vgchange are wrong
and point to another volume group, one that already has been created.

I tried finding a solution but my knowledge is limited so i failed.
Maybe you guys have better luck ( i'm pretty sure of that)

Regards

Bart

jhoekx commented at 2012-09-06 09:30:

Which version are you using?

We'll try to reproduce it.

jhoekx commented at 2012-09-06 09:41:

Can you try to change line 77 in usr/share/rear/layout/prepare/GNU/Linux/11_include_lvm_code.sh from

    read lvmgrp vgrp extentsize junk < <(grep "^lvmgrp $1" $LAYOUT_FILE)

into

    read lvmgrp vgrp extentsize junk < <(grep "^lvmgrp $1 " $LAYOUT_FILE)

(Note the extra space after $1)

You can do this in your rescue image.

bleyers commented at 2012-09-06 10:14:

I will test that this afternoon. Thx for the quick response.

jhoekx commented at 2012-09-06 10:39:

I the commit above didn't fix the issue completely, please reopen and we'll investigate further. Thanks.

bleyers commented at 2012-09-06 11:56:

The fix worked ...
Thanks for the fix.


[Export of Github issue for rear/rear.]