Changeset 674 for branches/2.0.8


Ignore:
Timestamp:
Jun 17, 2006, 11:57:05 AM (13 years ago)
Author:
andree
Message:

Handle the following format used by some distributions, e.g. Debian, for
LVM devices:

/dev/mapper/<VG>-<LV>

in addition to /dev/<VG>/<LV> where the latter is a link to the former.

This is a fix for Debian bug #362926.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0.8/mindi/mindi

    r632 r674  
    12911291partition_size partition_format outstring partition_number \
    12921292partition_mountpt c_p lwm_info psz lvm_dev unofficial_outstring \
    1293 absolute_partition old_partition_fmt
     1293absolute_partition old_partition_fmt current_lvolume
    12941294
    12951295    echo "Your raw fstab file looks like this:-" >> $LOGFILE
     
    13891389
    13901390    partition_format=`$AWK '$1 == "'"$str_to_find_fmt_with"'" {print $3}' $MY_FSTAB`
    1391     if [ -d "/proc/lvm" ] && [ "`lvdisplay $current_partition 2> /dev/null`" ]; then
     1391    # Some distributions such as Debian do not put /dev/<VG>/<LV> in fstab
     1392    # for LVM partitions but use /dev/mapper/<VG>-<LV> instead. Fortunately,
     1393    # the former is then a link to the latter, so we test whether
     1394    # $current_partition is actually such a link or not and set
     1395    # $current_lvolume accordingly. Note that $current_lvolume may well be an
     1396    # ordinary device. It is just to make sure that we feed the right value
     1397    # into any of the LVM tools if possible.
     1398    if [ -d "/dev/mapper" ] && [ -z "`lvm lvdisplay $current_partition 2> /dev/null`" ]; then
     1399        partition_stub="`echo "$current_partition" | sed "s|^/dev/mapper/|/dev/|" | cut -d"-" -f1`"
     1400        current_lvolume="`find /dev -lname "$current_partition" | grep "^$partition_stub"`"
     1401    fi
     1402    if [ -z "$current_lvolume" ]; then
     1403        current_lvolume="$current_partition"
     1404    fi
     1405    # End of LVM device style variation code (other than $current_lvolume).
     1406    if [ -d "/proc/lvm" ] && [ "`lvdisplay $current_lvolume 2> /dev/null`" ]; then
    13921407        partition_size="lvm"
    1393     elif [ -d "/dev/mapper" ] && [ "`lvm lvdisplay $current_partition 2> /dev/null`" ]; then
     1408    elif [ -d "/dev/mapper" ] && [ "`lvm lvdisplay $current_lvolume 2> /dev/null`" ]; then
    13941409        partition_size="lvm"
    13951410    else
     
    14171432    [ "$partition_format" = "swap" ] && partition_mountpt="swap"
    14181433    if [ "$partition_mountpt" = "" ] ; then
    1419         if [ "`pvdisplay $current_partition 2> /dev/null`" != "" ] || [ "`lvm pvdisplay $current_partition 2> /dev/null`" != "" ] ; then
     1434        if [ "`pvdisplay $current_lvolume 2> /dev/null`" != "" ] || [ "`lvm pvdisplay $current_lvolume 2> /dev/null`" != "" ] ; then
    14201435        if  [ "`fgrep device /etc/raidtab 2> /dev/null | grep -w $current_partition`" ] ; then
    14211436            partition_mountpt="raid"
    14221437            partition_format="raid"
    14231438        else
    1424 #           lvm_dev="`pvdisplay $current_partition | grep -i "VG N" | head -n1 | tr -s ' ' ' ' | cut -d' ' -f3`"
     1439#           lvm_dev="`pvdisplay $current_lvolume | grep -i "VG N" | head -n1 | tr -s ' ' ' ' | cut -d' ' -f3`"
    14251440            partition_mountpt="lvm"
    14261441            partition_format="lvm"
Note: See TracChangeset for help on using the changeset viewer.