fix the lvm issue

This commit is contained in:
longpanda 2022-04-29 00:51:56 +08:00
parent 60588c8442
commit 3ebc610e7d
5 changed files with 21 additions and 33 deletions

View File

@ -31,16 +31,6 @@ if is_inotify_ventoy_part $3; then
vtlog "find ventoy partition $3 ..." vtlog "find ventoy partition $3 ..."
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 noreplace $BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 noreplace
# blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
# vtDM=$(ventoy_find_dm_id ${blkdev_num})
#
# if [ "$vtDM" = "dm-0" ]; then
# vtlog "This is dm-0, OK ..."
# else
# vtlog "####### This is $vtDM ####### this is abnormal ..."
# ventoy_swap_device /dev/dm-0 /dev/$vtDM
# fi
set_ventoy_hook_finish set_ventoy_hook_finish
else else
vtlog "##### INOTIFYD: $2/$3 is created (NO)..." vtlog "##### INOTIFYD: $2/$3 is created (NO)..."

View File

@ -28,19 +28,19 @@ else
for vtParam in $($CAT /proc/cmdline); do for vtParam in $($CAT /proc/cmdline); do
if echo $vtParam | $GREP -q 'inst.ks=hd:LABEL='; then if echo $vtParam | $GREP -q 'inst.ks=hd:LABEL='; then
vtRawKs=$(echo $vtParam | $AWK -F: '{print $NF}') vtRawKs=$(echo $vtParam | $AWK -F: '{print $NF}')
VTKS="inst.ks=hd:/dev/dm-0:$vtRawKs" VTKS="inst.ks=hd:/dev/ventoy:$vtRawKs"
break break
fi fi
if echo $vtParam | $GREP -q '^ks=.*:/'; then if echo $vtParam | $GREP -q '^ks=.*:/'; then
vtRawKs=$(echo $vtParam | $AWK -F: '{print $NF}') vtRawKs=$(echo $vtParam | $AWK -F: '{print $NF}')
VTKS="ks=hd:/dev/dm-0:$vtRawKs" VTKS="ks=hd:/dev/ventoy:$vtRawKs"
break break
fi fi
if echo $vtParam | $GREP -q '^inst.ks=.*:/'; then if echo $vtParam | $GREP -q '^inst.ks=.*:/'; then
vtRawKs=$(echo $vtParam | $AWK -F: '{print $NF}') vtRawKs=$(echo $vtParam | $AWK -F: '{print $NF}')
VTKS="inst.ks=hd:/dev/dm-0:$vtRawKs" VTKS="inst.ks=hd:/dev/ventoy:$vtRawKs"
break break
fi fi
done done
@ -75,9 +75,9 @@ fi
echo "vtInstDD=$vtInstDD" >> $VTLOG echo "vtInstDD=$vtInstDD" >> $VTLOG
if $GREP -q 'root=live' /proc/cmdline; then if $GREP -q 'root=live' /proc/cmdline; then
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/dm-0 $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh $SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/ventoy $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh
else else
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh $SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/ventoy $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh
fi fi
ventoy_set_inotify_script rhel7/ventoy-inotifyd-hook.sh ventoy_set_inotify_script rhel7/ventoy-inotifyd-hook.sh

View File

@ -43,14 +43,9 @@ if is_inotify_ventoy_part $3; then
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/') blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
vtDM=$(ventoy_find_dm_id ${blkdev_num}) vtDM=$(ventoy_find_dm_id ${blkdev_num})
if [ "$vtDM" = "dm-0" ]; then cp -a /dev/$vtDM /dev/ventoy
vtlog "This is dm-0, OK ..." $BUSYBOX_PATH/modprobe isofs >/dev/null 2>&1
else
vtlog "####### This is $vtDM ####### this is abnormal ..."
ventoy_swap_device /dev/dm-0 /dev/$vtDM
fi
vtGenRulFile='/etc/udev/rules.d/99-live-squash.rules' vtGenRulFile='/etc/udev/rules.d/99-live-squash.rules'
if [ -e $vtGenRulFile ] && $GREP -q dmsquash $vtGenRulFile; then if [ -e $vtGenRulFile ] && $GREP -q dmsquash $vtGenRulFile; then
vtScript=$($GREP -m1 'RUN.=' $vtGenRulFile | $AWK -F'RUN.=' '{print $2}' | $SED 's/"\(.*\)".*/\1/') vtScript=$($GREP -m1 'RUN.=' $vtGenRulFile | $AWK -F'RUN.=' '{print $2}' | $SED 's/"\(.*\)".*/\1/')
@ -60,10 +55,9 @@ if is_inotify_ventoy_part $3; then
vtlog "$vtGenRulFile not exist..." vtlog "$vtGenRulFile not exist..."
fi fi
if [ -e /sbin/anaconda-diskroot ]; then if [ -e /sbin/anaconda-diskroot ]; then
vtlog "set anaconda-diskroot ..." vtlog "set anaconda-diskroot ..."
/sbin/anaconda-diskroot /dev/dm-0 /sbin/anaconda-diskroot /dev/ventoy
fi fi
set_ventoy_hook_finish set_ventoy_hook_finish

View File

@ -23,17 +23,20 @@ if [ ! -e /dev/dm-0 ]; then
exit 0 exit 0
fi fi
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
vtDM=$(ventoy_find_dm_id ${blkdev_num})
if ! [ -e /dev/mapper/ventoy ]; then if ! [ -e /dev/mapper/ventoy ]; then
vtlog "link to /dev/mapper/ventoy" vtlog "link /dev/$vtDM to /dev/mapper/ventoy"
ln -s /dev/dm-0 /dev/mapper/ventoy ln -s /dev/$vtDM /dev/mapper/ventoy
fi fi
VTLABEL=$($BUSYBOX_PATH/blkid /dev/dm-0 | $SED 's/.*LABEL="\([^"]*\)".*/\1/') VTLABEL=$($BUSYBOX_PATH/blkid /dev/$vtDM | $SED 's/.*LABEL="\([^"]*\)".*/\1/')
vtlog "VTLABEL=$VTLABEL" vtlog "VTLABEL=$VTLABEL"
if [ -n "$VTLABEL" ]; then if [ -n "$VTLABEL" ]; then
if ! [ -e "/dev/disk/by-label/$VTLABEL" ]; then if ! [ -e "/dev/disk/by-label/$VTLABEL" ]; then
vtlog "link to /dev/disk/by-label/$VTLABEL" vtlog "link /dev/$vtDM to /dev/disk/by-label/$VTLABEL"
ln -s /dev/dm-0 "/dev/disk/by-label/$VTLABEL" ln -s /dev/$vtDM "/dev/disk/by-label/$VTLABEL"
fi fi
fi fi

View File

@ -25,10 +25,11 @@ VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
blkdev_num=$(dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/') blkdev_num=$(dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
vtDM=$(ventoy_find_dm_id ${blkdev_num}) vtDM=$(ventoy_find_dm_id ${blkdev_num})
[ -e /dev/ventoy ] || cp -a /dev/$vtDM /dev/ventoy
if [ -e /sbin/anaconda-diskroot ]; then if [ -e /sbin/anaconda-diskroot ]; then
vtlog "set anaconda-diskroot ..." vtlog "set anaconda-diskroot /dev/ventoy ..."
/sbin/anaconda-diskroot /dev/dm-0 /sbin/anaconda-diskroot /dev/ventoy
fi fi
PATH=$VTPATH_OLD PATH=$VTPATH_OLD