Changeset 2546 in MondoRescue for branches/2.2.10/mindi


Ignore:
Timestamp:
Jan 21, 2010, 8:50:00 PM (15 years ago)
Author:
Bruno Cornec
Message:

svn merge -r 2523:2545 /mondorescue/branches/2.2.9

  • Adds the --rescue flag to ntfsclone (Andree Leidenfrost andree_at_debian.org)
  • Fix 2 typos in the HOWTO (reported by Bram Mertens bram-mertens_at_linux.be)
  • Patch from Rogério Brito rbrito_at_ime.usp.br which fixes errors in man pages format
  • Fix syntax issue in analyze-my-lvm
  • Better doc for pre and post
  • Finally the function ListLvmDrivesAndPartitions is used, as it creates info parsed by mindi !! So reverting back to filter excluded devices in it
  • Better exclusion of the LVs from the mountlist at restore time if excludedevs used
  • Exclude LVs whose VGs are excluded now in analyze-my-lvm
  • First attempt to support device exclusion at restore time through a new boot param excludedevs
  • Fix a bug preventing execution of the pre script in init
  • LVM exclusion based on devices was flawed as the function targeted was not really useful. That script shold be fully rewritten to have a data structure contaiing what is needed. Anyway the current patch should allow to have some improvements
  • Do not report Duplicate mount point when lvm is used
  • each device of the EXCLUDE_DEVS list is now used correctly and partitions found on this device are excluded
  • Fix the way the dsf is declared in the linked list to have it work
  • Fix #383 by using pvdisplay instead of relying on 8e as partition type
  • Try to fix #384 by always excluding the dfs per users wish
  • Also use the exclude dev feature in case of multipath and exclude resulting /dev/mapper/mpath type of files
  • Fix #381 by postfixing spaces at the end of the strings to be cheked in strstr
Location:
branches/2.2.10/mindi
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/README.bootparam

    r2484 r2546  
    2626donteject
    2727    mondorestore will not eject the CD; this is useful if, for instance, your PC's case has a concealed CD-ROM drive
     28
     29excludedevs="dev1 dev2"
     30    Exclude those evices from retoration process (no LVM action done suc has pvcreate, and no partitioning. Those devices are removed from /tmp/mountlist.txt and /tmp/i-want-my-lvm)
    2831
    2932forcemods="mod1 mod2"
     
    5861
    5962pre=/path/to/script
    60     Execute a pre-configuration script before calling mondorestore. Could be an NFS shared script e.g., or a script located in the initrd.
     63    Execute a pre-configuration script before calling mondorestore. Could be an NFS shared script e.g., or a script located in the initrd. Eg: pre=/tmp/isodir/my-pre.sh. Note that the script should be executable.
    6164
    6265post=/path/to/script
    63     Execute a final script before rebooting the machine at the end of the restoration. Could be an NFS shared script e.g., or a script located on the restored disk or in the initrd.
     66    Execute a final script before rebooting the machine at the end of the restoration. Could be an NFS shared script e.g., or a script located on the restored disk or in the initrd. Eg: post=/tmp/isodir/my-post.sh. Note that the script should be executable.
    6467
    6568serial=/dev/ttySx
  • branches/2.2.10/mindi/analyze-my-lvm

    r2428 r2546  
    5151        fi
    5252    fi
    53     echo "# $LVMCMD lvcreate$params -n $logical_volume $volume_group"
     53    # Do not process LV whose VG are excluded
     54    if [ -f $MINDI_TMP/excludedvgs ]; then
     55        if [ "`grep $volume_group $MINDI_TMP/excludedvgs`" = "" ]; then
     56            echo "# $LVMCMD lvcreate$params -n $logical_volume $volume_group"
     57        fi
     58    fi
     59    rm -f $MINDI_TMP/excludedvgs
    5460}
    5561
     
    131137    fi
    132138
     139    rm -f $MINDI_TMP/excludedvgs
     140    if [ "$EXCLUDE_DEVS" ] ; then
     141        for ed in $EXCLUDE_DEVS ; do
     142            if  [ "`echo " $list_of_devices" | grep " $ed"`" != "" ]; then
     143                echo $current_VG >> $MINDI_TMP/excludedvgs
     144                return
     145            fi
     146        done
     147    fi
    133148    echo "# $LVMCMD vgcreate $current_VG$VG_params $list_of_devices"
    134149    echo "# $LVMCMD vgchange -a y $current_VG"
     
    143158        pvscan 2> /dev/null | grep '"' | cut -d'"' -f2  >  $MINDI_TMP/pv.tmp
    144159    fi
     160
     161    rm -f $MINDI_TMP/pv.tmp2
     162    for d in `cat $MINDI_TMP/pv.tmp`; do
     163        # Skip devices excluded, coming from mondoarchive
     164        skip=0
     165        if [ "$EXCLUDE_DEVS" ] ; then
     166            for ed in $EXCLUDE_DEVS ; do
     167                if  [ "`echo " $d " | grep " $ed"`" != "" ]; then
     168                    skip=1
     169                    continue
     170                fi
     171            done
     172        fi
     173        if [ $skip -eq 1 ]; then
     174            continue
     175        fi
     176        echo $d >> $MINDI_TMP/pv.tmp2
     177    done
     178
    145179    if [ -f /etc/multipath.conf ]; then
    146180        # If multipath check which type of devidec are given, mpath prefered
    147         for d in `cat  $MINDI_TMP/pv.tmp`; do
     181        for d in `cat $MINDI_TMP/pv.tmp2`; do
     182            skip=0
     183            if [ "$EXCLUDE_DEVS" ] ; then
     184                for ed in $EXCLUDE_DEVS ; do
     185                    if  [ "`echo " $d " | grep " $ed"`" != "" ]; then
     186                        skip=1
     187                        continue
     188                    fi
     189                done
     190            fi
     191            if [ $skip -eq 1 ]; then
     192                continue
     193            fi
    148194            GiveMapperOfdm $d
    149195        done
    150196    else
    151         cat $MINDI_TMP/pv.tmp
    152     fi
    153     rm -f $MINDI_TMP/pv.tmp
     197        cat $MINDI_TMP/pv.tmp2
     198    fi
     199    rm -f $MINDI_TMP/pv.tmp $MINDI_TMP/pv.tmp2
    154200}
    155201
     
    177223
    178224ListLvmDrivesAndPartitions() {
     225    # We get partitions in this loop not devices
    179226    for d in `$LVMCMD vgdisplay -v 2> /dev/null | grep "PV Name" | sed 's/(#)//' | awk '{print $3}'`; do
    180         # Skip devices excluded, coming from mondoarchive
    181         if [ "$EXCLUDE_DEVS" ] && [ "`echo " $EXCLUDE_DEVS " | grep " $d "`" ]; then
    182             continue
    183         fi
    184         # If multipath check which type of devides are given, mpath prefered
     227        # If multipath check which type of devices are given, mpath prefered
    185228        if [ -f /etc/multipath.conf ]; then
    186             GiveMapperOfdm $d
     229            i=`GiveMapperOfdm $d`
     230            rep=$i
    187231        else
    188             echo $d
    189         fi
     232            rep=$d
     233        fi
     234        skip=0
     235        if [ "$EXCLUDE_DEVS" ] ; then
     236            for ed in $EXCLUDE_DEVS ; do
     237                if  [ "`echo " $rep " | grep " $ed"`" != "" ]; then
     238                    skip=1
     239                    continue
     240                fi
     241            done
     242        fi
     243        if [ $skip -eq 1 ]; then
     244            continue
     245        fi
     246        echo $rep
    190247    done
    191248}
  • branches/2.2.10/mindi/mindi

    r2514 r2546  
    959959            LVM="false"
    960960        fi
     961        # Excluded LVs and GVs are not reported here
    961962        all_partitions=`cat $MINDI_TMP/lvm.res | grep -F ">>>" | cut -d' ' -f2-`
    962963    fi
    963964    all_partitions="$all_partitions `ListAllPartitions 2> /dev/null`"
    964 #    echo "all partitions = $all_partitions" > /dev/stderr
    965965    for i in $IMAGE_DEVS ; do
    966966        mount | grep -F "$i " > /dev/null 2> /dev/null && Die "Sorry, $i is already mounted! CANNOT DO IMAGEDEV on it if it's mounted."
     
    12341234            fi
    12351235        fi
    1236         if [ "$EXCLUDE_DEVS" ] && [ "`echo " $EXCLUDE_DEVS " | grep -F " $current_partition "`" ] || [ "`echo " $EXCLUDE_DEVS " | grep " $current_partition "`" ] ; then
    1237             LogFile "Excluding $current_partition from mountlist"
    1238             continue
     1236        skip=0
     1237        if [ "$EXCLUDE_DEVS" ] ; then
     1238            for d in $EXCLUDE_DEVS ; do
     1239                if  [ "`echo " $current_partition " | grep " $d"`" != "" ]; then
     1240                    LogFile "Excluding $current_partition from mountlist (due to excluded device $d)"
     1241                    skip=1
     1242                    continue
     1243                fi
     1244            done
     1245        fi
     1246        if [ $skip -eq 1 ]; then
     1247            continue
    12391248        fi
    12401249        if [ ! "$partition_mountpt" ] ; then
     
    12921301    local file=$1
    12931302    # Coherency verification
    1294     ML0=`cat $file | wc -l`
     1303    ML01=`cat $file | wc -l`
     1304    ML02=`cat $file | grep -v ' lvm ' | wc -l`
    12951305    ML1=`$AWK '{print $1}' $file | sort -u | wc -l`
    1296     ML2=`$AWK '{print $2}' $file | sort -u | wc -l`
    1297     if [ "$ML0" -ne "$ML1" ]; then
     1306    ML2=`$AWK '{print $2}' $file | grep -v ' lvm ' | sort -u | wc -l`
     1307    if [ "$ML01" -ne "$ML1" ]; then
    12981308        LogFile "--------------------------------------------"
    12991309        echo "WARNING: Duplicate device entry in mountlist" | tee -a $LOGFILE
    13001310        LogFile "--------------------------------------------"
    13011311    fi
    1302     if [ "$ML0" -ne "$ML2" ]; then
     1312    if [ "$ML02" -ne "$ML2" ]; then
    13031313        LogFile "--------------------------------------------"
    13041314        echo "WARNING: Duplicate mountpoint entry in mountlist" | tee -a $LOGFILE
  • branches/2.2.10/mindi/rootfs/sbin/init

    r2508 r2546  
    391391            vgscan
    392392        fi
     393
     394        # Exclude devices we may not want
     395        rm -f /tmp/restorevgs
     396        for d in $EXCLUDE_DEVS ; do
     397            echo " == $d"
     398            EXCLUDE_VGS=`grep " $d" /tmp/i-want-my-lvm | grep vgcreate | awk '{print $4}'`
     399            vg=`echo $EXCLUDE_VGS | sed "s/ /|/g"`
     400            if [ "$vg" != "" ]; then
     401                re=" $d|$vg"
     402            else
     403                re=" $d"
     404            fi
     405            # Remove VGs from i-want-my-lvm
     406            grep -Ev "$re" /tmp/i-want-my-lvm > /tmp/i-want-my-lvm.new
     407            mv /tmp/i-want-my-lvm.new /tmp/i-want-my-lvm
     408            # Prepare  script to restore the VG exluded here if needed
     409            for v in $EXCLUDE_VGS; do
     410                echo "vgcfgrestore $v" >> /tmp/restorevgs
     411                # Remove LVs from mountlist
     412                EXCLUDE_LVS=`grep " $v" /tmp/i-want-my-lvm | grep lvcreate | sed "s/^.*-n \([^ ][^ ]*\) .*$/$1/"`
     413                for l in $EXCLUDE_LVS; do
     414                    # FIXME: Should search for all possible device names here
     415                    grep -Ev "/dev/$v/$l" /tmp/mountlist.txt > /tmp/mountlist.txt.new
     416                    grep -Ev "/dev/mapper/${v}-v$l" /tmp/mountlist.txt.new > /tmp/mountlist.txt
     417                done
     418            done
     419        done
     420
    393421        grep -E "^#.*vgchange" /tmp/i-want-my-lvm | sed "s/^#[ ]*//" > /tmp/start-lvm
    394422        chmod +x /tmp/start-lvm
     
    685713    export FORCE_MODS=" "
    686714fi
     715if [ "`grep -i excludedevs /proc/cmdline`" ]; then
     716    export EXCLUDE_DEVS="`cat /proc/cmdline | sed 's~.*excludedevs=\"\(.*\)\".*~\1~'` mondonone"
     717else
     718    export EXCLUDE_DEVS=" "
     719fi
    687720
    688721echo "Activating a potential USB keyboard/mouse"
     
    831864    # start-netfs moved it under /tmp as the NFS share is already unmounted
    832865    if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
    833         post=`echo $pre | sed 's|^/tmp/isodir|/tmp|'`
     866        pre=`echo $pre | sed 's|^/tmp/isodir|/tmp|'`
    834867    fi
    835868    if [ -x $pre ]; then
Note: See TracChangeset for help on using the changeset viewer.