Changeset 3330


Ignore:
Timestamp:
Dec 23, 2014, 7:49:06 AM (4 years ago)
Author:
bruno
Message:
  • mindi now generates UUIDs in mountlist.txt if no LABEL nor UUID exist
  • Fix label-partitions-as-necessary to put back the original UUIDs to the partitions even if no LABEL or UUID line was used in fstab
  • Improve btrfs support
Location:
branches/3.2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi/mindi

    r3326 r3330  
    13661366            label="$uuid"
    13671367        fi
     1368
     1369        # On RHEL 7 they use UUID concretely, even when not mentioned in fstab
     1370        # in order to mount the root part e.g. in grub.
     1371        # One way to solve this is to add the UUID now, if there wasn't one so it's
     1372        # restored correctly
     1373        if [ _"$label" = _"" ]; then
     1374            label=`blkid $current_partition | perl -p -e 's/.* UUID="([A-z0-9-]+)" .*/$1/'`
     1375        fi
     1376
    13681377        partition_format="`echo "$partition_format" | cut -d',' -f1`"; # in case user has ext3,ext2 or something dumb like that
    13691378        [ "$partition_format" = "auto" ] && partition_format="`mount | grep -w $current_partition | $AWK '{print$5;}'`"; # in case user uses 'auto' (dumb!)
  • branches/3.2/mindi/parted2fdisk.pl

    r3143 r3330  
    152152        "ext4" => "83",
    153153        "xfs" => "83",
     154        "btrfs" => "83",
    154155        "reiserfs" => "83",
    155156        "linux-swap" => "82",
  • branches/3.2/mondo/src/mondorestore/mondo-prep.c

    r3301 r3330  
    18371837             || strcmp(format, "xfs") == 0
    18381838             || strcmp(format, "jfs") == 0
    1839                  || strcmp(format, "btrfs") == 0) {
     1839             || strcmp(format, "btrfs") == 0) {
    18401840    mr_asprintf(partcode, "83");
    18411841} else if (strcmp(format, "minix") == 0) {
  • branches/3.2/mondo/src/restore-scripts/mondo/label-partitions-as-necessary

    r3328 r3330  
    77
    88read_partition_line() {
    9     local label mountpt command format
     9    local label mountpt command format device d m
    1010
    11     label=`echo "$1" | awk '{print $1}' | cut -d'=' -f2`
     11    device=`echo "$1" | awk '{print $1}'`
     12    d=`echo "$device" | cut -c1`
    1213    format=`echo "$1" | awk '{print $3}'`
     14    label=`echo "$device" | cut -s -d'=' -f2`
     15    if [ "$d" = "/" ] && [ "$label" = "" ]; then
     16        m=`echo "$1" | awk '{print $2}'`
     17        # We force UUID even if nothing in fstab as some new distro like RHEL7 rely on it
     18        [ "$format" = "reiserfs" ] && opttun="-u" || opttun="-U"
     19        label=`awk '{print $2,$5}' $mountlist | grep -E "^$m " | awk '{print $2}'`
     20    else
     21        if [ "`echo "$1" | grep -E 'LABEL='`" != "" ] ; then
     22            [ "$format" = "reiserfs" ] && opttun="-l" || opttun="-L"
     23        elif [ "`echo "$1" | grep -E 'UUID='`" != "" ] ; then
     24            [ "$format" = "reiserfs" ] && opttun="-u" || opttun="-U"
     25        else
     26            LogIt "Nothing to do on $1"
     27            return
     28        fi
     29    fi
    1330    mountpt=`awk '{print $1,$5}' $mountlist | grep " $label$" | awk '{print $1}'`
    14 
    15     if [ "`echo "$1" | grep -E 'LABEL='`" != "" ] ; then
    16         [ "$format" = "reiserfs" ] && opttun="-l" || opttun="-L"
    17     elif [ "`echo "$1" | grep -E 'UUID='`" != "" ] ; then
    18         [ "$format" = "reiserfs" ] && opttun="-u" || opttun="-U"
    19     else
    20         LogIt "Nothing to do on $1"
    21         return
    22     fi
    2331
    2432    if [ ! "$mountpt" ] ; then
    2533        LogIt "Not labeling anything as ($label) because ($mountpt) is not a mountpoint"
    2634    elif [ ! "$label" ] ; then
    27         LogIt "Not labeling ($mountpt) as anything because ($label) is not a label"
     35        LogIt "Not labeling ($mountpt) as anything because ($label) is not a label/uuid"
    2836    else
    2937        if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] || [ "$format" = "ext4" ]; then
     
    3745        elif [ "$format" = "reiserfs" ]; then
    3846            command="reiserfstune $opttun $label $mountpt"
     47            LogIt "Running $command"
     48            $command
     49        elif [ "$format" = "btrfs" ]; then
     50            # Also see https://btrfs.wiki.kernel.org/index.php/Project_ideas#Filesystem_UUID_change_-_off-line
     51            command="btrfs filesystem label $mountpt $label"
    3952            LogIt "Running $command"
    4053            $command
Note: See TracChangeset for help on using the changeset viewer.