代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/rear 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
diff --git a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
index e43ff896..a9730435 100644
--- a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
+++ b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
@@ -53,6 +53,7 @@ Log "Saving LVM layout."
done
header_printed=0
+ already_processed_lvs=""
## Get all logical volumes
# format: lvmvol <volume_group> <name> <size(bytes)> <layout> [key:value ...]
@@ -61,7 +62,7 @@ Log "Saving LVM layout."
if lvm lvs -o lv_layout >/dev/null 2>&1; then
- lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,lv_layout,pool_lv,chunk_size,stripes,stripe_size | while read line ; do
+ lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,lv_layout,pool_lv,chunk_size,stripes,stripe_size,seg_size | while read line ; do
if [ $header_printed -eq 0 ] ; then
echo "# Format for LVM LVs"
@@ -72,7 +73,7 @@ Log "Saving LVM layout."
origin="$(echo "$line" | awk -F ':' '{ print $1 }')"
# Skip snapshots (useless) or caches (dont know how to handle that)
if [ -n "$origin" ] ; then
- echo "# Skipped snapshot of cache information '$line'"
+ echo "# Skipped snapshot or cache information '$line'"
continue
fi
@@ -84,25 +85,45 @@ Log "Saving LVM layout."
chunksize="$(echo "$line" | awk -F ':' '{ print $7 }')"
stripes="$(echo "$line" | awk -F ':' '{ print $8 }')"
stripesize="$(echo "$line" | awk -F ':' '{ print $9 }')"
+ segmentsize="$(echo "$line" | awk -F ':' '{ print $10 }')"
kval=""
+ infokval=""
[ -z "$thinpool" ] || kval="${kval:+$kval }thinpool:$thinpool"
[ $chunksize -eq 0 ] || kval="${kval:+$kval }chunksize:${chunksize}b"
[ $stripesize -eq 0 ] || kval="${kval:+$kval }stripesize:${stripesize}b"
+ [ $segmentsize -eq $size ] || infokval="${infokval:+$infokval }segmentsize:${segmentsize}b"
if [[ ,$layout, == *,mirror,* ]] ; then
kval="${kval:+$kval }mirrors:$(($stripes - 1))"
elif [[ ,$layout, == *,striped,* ]] ; then
kval="${kval:+$kval }stripes:$stripes"
fi
- echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [[ " $already_processed_lvs " == *\ $vg/$lv\ * ]] ; then
+ # The LV has multiple segments; the create_lvmvol() function in
+ # 110_include_lvm_code.sh is not able to recreate this, but
+ # keep the information for the administrator anyway.
+ echo "#lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ else
+ if [ $segmentsize -ne $size ] ; then
+ echo "# WARNING: Volume $vg/$lv has multiple segments. Restoring it in Migration Mode using 'lvcreate' won't preserve segments and properties of the other segments as well!"
+ fi
+ echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ already_processed_lvs="${already_processed_lvs:+$already_processed_lvs }$vg/$lv"
+ fi
done
else
# Compatibility with older LVM versions (e.g. <= 2.02.98)
# No support for 'lv_layout', too bad, do our best!
- lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,modules,pool_lv,chunk_size,stripes,stripe_size | while read line ; do
+ lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,modules,pool_lv,chunk_size,stripes,stripe_size,seg_size | while read line ; do
if [ $header_printed -eq 0 ] ; then
echo "# Format for LVM LVs"
@@ -125,11 +146,14 @@ Log "Saving LVM layout."
chunksize="$(echo "$line" | awk -F ':' '{ print $7 }')"
stripes="$(echo "$line" | awk -F ':' '{ print $8 }')"
stripesize="$(echo "$line" | awk -F ':' '{ print $9 }')"
+ segmentsize="$(echo "$line" | awk -F ':' '{ print $10 }')"
kval=""
+ infokval=""
[ -z "$thinpool" ] || kval="${kval:+$kval }thinpool:$thinpool"
[ $chunksize -eq 0 ] || kval="${kval:+$kval }chunksize:${chunksize}b"
[ $stripesize -eq 0 ] || kval="${kval:+$kval }stripesize:${stripesize}b"
+ [ $segmentsize -eq $size ] || infokval="${infokval:+$infokval }segmentsize:${segmentsize}b"
if [[ "$modules" == "" ]] ; then
layout="linear"
[ $stripes -eq 0 ] || kval="${kval:+$kval }stripes:$stripes"
@@ -148,7 +172,24 @@ Log "Saving LVM layout."
kval="${kval:+$kval }stripes:$stripes"
fi
- echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [[ " $already_processed_lvs " == *\ $vg/$lv\ * ]]; then
+ # The LV has multiple segments; the create_lvmvol() function in
+ # 110_include_lvm_code.sh is not able to recreate this, but
+ # keep the information for the administrator anyway.
+ echo "#lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ else
+ if [ $segmentsize -ne $size ] ; then
+ echo "# WARNING: Volume $vg/$lv has multiple segments. Restoring it in Migration Mode using 'lvcreate' won't preserve segments and properties of the other segments as well!"
+ fi
+ echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ already_processed_lvs="${already_processed_lvs:+$already_processed_lvs }$vg/$lv"
+ fi
done
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。