Changeset 3737


Ignore:
Timestamp:
Nov 18, 2019, 1:48:39 AM (8 months ago)
Author:
Bruno Cornec
Message:

prepare dir struct and prepare also to umount btrfs subvolumes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi/mindi

    r3730 r3737  
    14521452    # ID 260 gen 19927 top level 257 path @/home
    14531453    # ID 261 gen 19927 top level 257 path @/opt
    1454     touch $MINDI_TMP/create-btrfs-subvol $MINDI_TMP/mount-btrfs-subvol
     1454    touch $MINDI_TMP/create-btrfs-subvol $MINDI_TMP/mount-btrfs-subvol $MINDI_TMP/umount-btrfs-subvol
    14551455    btrfs subvolume list -a / 2>/dev/null > $MINDI_TMP/btrfssubvol.txt
    14561456    LogFile "btrfs subvolumes layout is:"
     
    14631463    cat $MINDI_TMP/btrfs-extract >> $LOGFILE
    14641464    LogFile "-------------------------------------"
     1465    # We suppose there is only one FS
     1466    sep=`btrfs subvolume list -a / | grep FS_TREE | sed 's/.*<FS_TREE>\\(.*\)/$1/'`
     1467    echo "btrfs subvolume create /mnt/RESTORING/$sep" >> $MINDI_TMP/create-btrfs-subvol
    14651468    while read dev mp type opt dum dum; do
    14661469        echo $dev | grep -qE 'UUID|LABEL'
     
    14711474            device=$dev
    14721475        fi
    1473         subvol=`echo $opt | cut -d@ -f2 | cut -d, -f1`
    1474         top=`grep -E "@$subvol$" $MINDI_TMP/btrfssubvol.txt | awk '{ print $7 }'`
    1475         btrfs=`grep -E "^ID $top " $MINDI_TMP/btrfssubvol.txt | awk '{ print $9 }' | sed 's/<FS_TREE>//' | sed 's/@$//'`
    1476         mountpoint="$btrfs$subvol"
    1477         echo "btrfs subvolume create $btrfs$subvol" >> $MINDI_TMP/create-btrfs-subvol
    1478         echo "mount -t btrfs -o subvol=$subvol $device $mountpoint" >> $MINDI_TMP/mount-btrfs-subvol
     1476        subvol=`echo $opt | awk -F$sep '{ print $2 }' | cut -d, -f1`
     1477        #top=`grep -E "@$subvol$" $MINDI_TMP/btrfssubvol.txt | awk '{ print $7 }'`
     1478        #btrfs=`grep -E "^ID $top " $MINDI_TMP/btrfssubvol.txt | awk '{ print $9 }' | sed 's/<FS_TREE>//' | sed 's/@$//'`
     1479        mountpoint="/mnt/RESTORING/$sep$subvol"
     1480        # If the intermediate dirs of subvol are not a subvolume, we need to create them as dir
     1481        parent=`dirname $subvol`
     1482        while [ $parent != "/" ]; do
     1483            grep -qE "$sep$parent$" $MINDI_TMP/btrfssubvol.txt
     1484            if [ $? -ne 0 ];
     1485                echo "mkdir -p /mnt/RESTORING/$sep$parent" >> $MINDI_TMP/create-btrfs-subvol
     1486            fi
     1487            parent=`dirname $parent`
     1488        done
     1489        echo "btrfs subvolume create $mountpoint" >> $MINDI_TMP/create-btrfs-subvol
     1490        echo "mount -t btrfs -o subvol=$sep$subvol $device $mountpoint" >> $MINDI_TMP/mount-btrfs-subvol
     1491        echo "umount $mountpoint" >> $MINDI_TMP/umount-btrfs-subvol
    14791492    done <  $MINDI_TMP/btrfs-extract
    14801493    rm -f  $MINDI_TMP/btrfs-extract
    1481     chmod 755 $MINDI_TMP/create-btrfs-subvol $MINDI_TMP/mount-btrfs-subvol
     1494    chmod 755 $MINDI_TMP/create-btrfs-subvol $MINDI_TMP/mount-btrfs-subvol $MINDI_TMP/umount-btrfs-subvol
    14821495    LogFile "Your create-btrfs-subvol file content is:"
    14831496    LogFile "-----------------------------------------"
     
    14871500    LogFile "-----------------------------------------"
    14881501    cat $MINDI_TMP/mount-btrfs-subvol  >> $LOGFILE
     1502    LogFile "-----------------------------------------"
     1503    LogFile "Your umount-btrfs-subvol file content is:"
     1504    LogFile "-----------------------------------------"
     1505    cat $MINDI_TMP/umount-btrfs-subvol  >> $LOGFILE
    14891506    LogFile "-----------------------------------------"
    14901507}
     
    23942411    mkdir -p $bigdir/tmp
    23952412    cp -f $MINDI_TMP/mountlist.txt $bigdir/tmp/mountlist.txt 2>> $LOGFILE || Die "Cannot copy mountlist.txt from $MINDI_TMP to data disk"
    2396     cp -f $MINDI_TMP/create-btrfs-subvol $MINDI_TMP/mount-btrfs-subvol $bigdir/tmp/ 2>> $LOGFILE || Die "Cannot copy subvol scripts from $MINDI_TMP to data disk"
     2413    cp -f $MINDI_TMP/create-btrfs-subvol $MINDI_TMP/mount-btrfs-subvol $MINDI_TMP/umount-btrfs-subvol $bigdir/tmp/ 2>> $LOGFILE || Die "Cannot copy subvol scripts from $MINDI_TMP to data disk"
    23972414    if [ _"$MONDO_SHARE" != _"" ]; then
    23982415        cp -f $bigdir/tmp/mountlist.txt $MINDI_TMP/. 2>> $LOGFILE
Note: See TracChangeset for help on using the changeset viewer.