Opened 13 years ago

Closed 12 years ago

#621 closed defect (fixed)

mondoarchive crashes when fstab contains bind mounts

Reported by: victor gattegno Owned by: Bruno Cornec
Priority: high Milestone: 3.0.3
Component: mindi Version: 3.0.1
Severity: major Keywords:
Cc:

Description

If there are some bind mounts in /etc/fstab, example :

/ora/2/saptrace/usertrace  /home/ora/user     none    bind

Then mondoarchive fails with :

FATAL ERROR. Cannot find /ora/2/saptrace/usertrace's size - is your /etc/fstab sane?

I found where is the problem : mondoarchive crashes because mindi doesn't manage bind mounts in fstab.

At line #2215 /usr/sbin/mindi 2.1.1 checks only "/dev/", as the /etc/fstab mount bind lines don't contain any "/dev", then mindi dies with that fatal error message (mindi 2.1.1 Line #2216).

Attachments (1)

mindi-20120706-patch_bind (119.2 KB ) - added by victor gattegno 12 years ago.
mindi 2.1.2 patched with Bruno solution

Download all attachments as: .zip

Change History (10)

comment:1 by Bruno Cornec, 13 years ago

I'm unable to reproduce that problem by adding this line in my /etc/fstab, with the latest rev [3014]:

$ grep bind /etc/fstab
/users/bruno  /home/bruno     none    bind

I get:

Your mountlist will look like this:
Analyzing LVM...
lvmdiskscan not found. Won't handle LVM.
        DEVICE          MOUNTPOINT      FORMAT          SIZE (MB)     LABEL/UUID
        /dev/md1        /               ext4                  0
        /dev/sda1       /boot           ext4               2925 854a6501-b60b-4c46-813d-b3edf900cd86
        /dev/sdb1       /boot1          ext4                196 13e6ddb3-ac03-4c77-8511-19fb81a89ce4
        /dev/md4        /users          ext4                  0
        /dev/md3        /tmp            ext4                  0
        /dev/md0        /usr            ext4                  0
        /dev/md2        /var            ext4                  0
        /dev/sdb7       swap            swap               3992 473be340-978c-42ec-9759-b44d8028cd8f
        /dev/sdb10      raid            raid             922702
        /dev/sda10      raid            raid                  0
        /dev/sdb9       raid            raid                996
        /dev/sda9       raid            raid                  0
        /dev/sdb8       raid            raid               5992
        /dev/sda8       raid            raid                  0
        /dev/sda5       raid            raid                  0
        /dev/sdb5       raid            raid              11993
        /dev/sdb6       raid            raid               7993
        /dev/sda6       raid            raid                  0

So I'm unsure what to do. Worth testing again once 3.0.2 is out.

comment:2 by Bruno Cornec, 13 years ago

Milestone: 3.0.23.0.3

Now that 3.0.2 is out, please check again adn report back.

comment:3 by victor gattegno, 12 years ago

I tested with the new version of mondo (3.0.2) and mindi (2.1.2) rev 3018 on our SLES 11 test server, the problem is still present.

I emailed the logs directly to Bruno.

comment:4 by victor gattegno, 12 years ago

I emailed mindi debug informations directly to Bruno.

comment:5 by Bruno Cornec, 12 years ago

Status: newassigned

Could you test if the following patch solves the issue:

=== mindi/mindi
==================================================================
--- mindi/mindi (revision 4935)
+++ mindi/mindi (local)
@@ -1069,7 +1069,7 @@
        done
        [ "$IMAGE_DEVS" != "" ] && all_partitions="`echo "$all_partitions $IMAGE_DEVS" | tr ' ' '\n' | sort -u | tr '\n ' ' '`"
        printf "        %-15s %-15s %-15s %-13s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE (MB)" LABEL/UUID | tee -a $LOGFILE
-       useless_dev="/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw /dev/scd /dev/ram :/ /dev/sr0 /dev/sr1 /dev/cdrom1 tmpfs devpts sysfs proc debugfs"
+       useless_dev="/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw /dev/scd /dev/ram :/ /dev/sr0 /dev/sr1 /dev/cdrom1 tmpfs devpts sysfs proc debugfs iso9660"
        for c_p in $all_partitions ; do
                # Skip fd/cd devices, network FS, cifs
                [ "`echo "$useless_dev" | grep -F "$c_p"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] || [ "`echo "$c_p" | grep -E "^//"`" != "" ]&& continue

comment:6 by Bruno Cornec, 12 years ago

This patch should cover better the case, in fact by also checking the bind option in fstab:

=== mindi/mindi
==================================================================
--- mindi/mindi (revision 4935)
+++ mindi/mindi (local)
@@ -1069,7 +1069,7 @@
        done
        [ "$IMAGE_DEVS" != "" ] && all_partitions="`echo "$all_partitions $IMAGE_DEVS" | tr ' ' '\n' | sort -u | tr '\n ' ' '`"
        printf "        %-15s %-15s %-15s %-13s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE (MB)" LABEL/UUID | tee -a $LOGFILE
-       useless_dev="/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw /dev/scd /dev/ram :/ /dev/sr0 /dev/sr1 /dev/cdrom1 tmpfs devpts sysfs proc debugfs"
+       useless_dev="/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw /dev/scd /dev/ram :/ /dev/sr0 /dev/sr1 /dev/cdrom1 tmpfs devpts sysfs proc debugfs iso9660"
        for c_p in $all_partitions ; do
                # Skip fd/cd devices, network FS, cifs
                [ "`echo "$useless_dev" | grep -F "$c_p"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] || [ "`echo "$c_p" | grep -E "^//"`" != "" ]&& continue
@@ -1091,8 +1091,14 @@
                # Detects noauto partitions not mounted and exclude them
                partition_option=`tr -s '\t' ' ' < $MY_FSTAB | grep -w "$current_partition" | grep -vx " *#.*" | $AWK '{print $4}' | head -n1`
                if [ "`echo "$partition_option" | grep -i noauto`" != "" ] && [ "`mount | grep -w "$partition_mountpt"`" =  "" ] ; then
+                       LogFile "INFO: Excluding $current_partition from mountlist (due to noauto option in fstab)"
                        continue
                fi
+               # Detects bind partitions and exclude them
+               if [ "`echo "$partition_option" | grep -iw bind`" != "" ]; then
+                       LogFile "INFO: Excluding $current_partition from mountlist (due to bind option in fstab)"
+                       continue
+               fi
 
                # set default in case we dont't find it
                str_to_find_fmt_with=$current_partition

If you can check and report back, that would be great Victor !

comment:7 by victor gattegno, 12 years ago

Thanks Bruno !

I checked it on an Ubuntu 12.04 and it works well, mindi doesn't stop anymore because of bind mount lines in fstab.

With, in fstab :

/home/test1		/home/mounts/t1		none		bind
/home/test2		/home/mounts/t2		none		bind

I get in mindi.log :

Your mountlist will look like this:
-----------------------------------
        DEVICE          MOUNTPOINT      FORMAT          SIZE (MB)     LABEL/UUID     
...
INFO: Excluding /home/test1 from mountlist (due to bind option in fstab)
INFO: Excluding /home/test2 from mountlist (due to bind option in fstab)

But, should these bind mount lines be excluded ?

I was thinking that these bind mounts should be created again automatically at restore time...

Note : I got some problems to patch /usr/sbin/mindi with your patch. I adapted it, please check if the attached mindi is ok (rev number maybe false but I think that the rest is ok).

by victor gattegno, 12 years ago

Attachment: mindi-20120706-patch_bind added

mindi 2.1.2 patched with Bruno solution

comment:8 by Bruno Cornec, 12 years ago

Can you test whether the last mindi 2.1.3 fixes it correctly (after restore we expect to be able to have the bind mount work correctly).

comment:9 by Bruno Cornec, 12 years ago

Resolution: fixed
Status: assignedclosed

From mail you sent to me, this specific issue seems to be now solved.

We are excluding bind mounts from the restore period, but as they are still in the original fstab, they should be mounted back, once the restored system is rebooted.

Note: See TracTickets for help on using tickets.