Changeset 3730 in MondoRescue
- Timestamp:
- Nov 16, 2019, 3:10:39 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi/mindi
r3725 r3730 1446 1446 done 1447 1447 LogAll "-----------------------------------" 1448 1449 # Manages btrfs subvol partitions so they can be restored 1450 # List looks like this 1451 # ID 257 gen 20074 top level 5 path <FS_TREE>/@ 1452 # ID 260 gen 19927 top level 257 path @/home 1453 # ID 261 gen 19927 top level 257 path @/opt 1454 touch $MINDI_TMP/create-btrfs-subvol $MINDI_TMP/mount-btrfs-subvol 1455 btrfs subvolume list -a / 2>/dev/null > $MINDI_TMP/btrfssubvol.txt 1456 LogFile "btrfs subvolumes layout is:" 1457 LogFile "---------------------------" 1458 cat $MINDI_TMP/btrfssubvol.txt >> $LOGFILE 1459 LogFile "---------------------------" 1460 grep -E 'btrfs[ ]+subvol=' /etc/fstab > $MINDI_TMP/btrfs-extract 1461 LogFile "btrfs subvolumes referenced in fstab:" 1462 LogFile "-------------------------------------" 1463 cat $MINDI_TMP/btrfs-extract >> $LOGFILE 1464 LogFile "-------------------------------------" 1465 while read dev mp type opt dum dum; do 1466 echo $dev | grep -qE 'UUID|LABEL' 1467 if [ $? -eq 0 ]; then 1468 label=`echo $dev | cut -d= -f2` 1469 device=`grep $label $mountlist | awk '{print $1}'` 1470 else 1471 device=$dev 1472 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 1479 done < $MINDI_TMP/btrfs-extract 1480 rm -f $MINDI_TMP/btrfs-extract 1481 chmod 755 $MINDI_TMP/create-btrfs-subvol $MINDI_TMP/mount-btrfs-subvol 1482 LogFile "Your create-btrfs-subvol file content is:" 1483 LogFile "-----------------------------------------" 1484 cat $MINDI_TMP/create-btrfs-subvol >> $LOGFILE 1485 LogFile "-----------------------------------------" 1486 LogFile "Your mount-btrfs-subvol file content is:" 1487 LogFile "-----------------------------------------" 1488 cat $MINDI_TMP/mount-btrfs-subvol >> $LOGFILE 1489 LogFile "-----------------------------------------" 1448 1490 } 1449 1491 … … 2352 2394 mkdir -p $bigdir/tmp 2353 2395 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" 2354 2397 if [ _"$MONDO_SHARE" != _"" ]; then 2355 2398 cp -f $bigdir/tmp/mountlist.txt $MINDI_TMP/. 2>> $LOGFILE
Note:
See TracChangeset
for help on using the changeset viewer.