core: 更精确地找出系统盘
This commit is contained in:
parent
f180fd5be8
commit
9be306830e
@ -21,9 +21,8 @@ update_part() {
|
|||||||
# ubuntu grownpart
|
# ubuntu grownpart
|
||||||
|
|
||||||
# 找出主硬盘
|
# 找出主硬盘
|
||||||
# xda=$(lsblk -dn -o NAME | grep -E 'nvme0n1|.da')
|
|
||||||
# shellcheck disable=SC2010
|
# shellcheck disable=SC2010
|
||||||
xda=$(ls /dev/ | grep -Ex 'sda|hda|xda|vda|xvda|nvme0n1')
|
xda=$(mount | awk '$3=="/" {print $1}' | grep -Eo 'sda|hda|xda|vda|xvda|nvme0n1')
|
||||||
|
|
||||||
# 删除 installer 分区
|
# 删除 installer 分区
|
||||||
installer_num=$(readlink -f /dev/disk/by-label/installer | grep -o '[0-9]*$')
|
installer_num=$(readlink -f /dev/disk/by-label/installer | grep -o '[0-9]*$')
|
||||||
@ -55,6 +54,7 @@ update_part /dev/$xda
|
|||||||
case $part_fstype in
|
case $part_fstype in
|
||||||
xfs) xfs_growfs / ;;
|
xfs) xfs_growfs / ;;
|
||||||
ext*) resize2fs /dev/$xda$part_num ;;
|
ext*) resize2fs /dev/$xda$part_num ;;
|
||||||
|
btrfs) btrfs filesystem resize max / ;;
|
||||||
esac
|
esac
|
||||||
update_part /dev/$xda
|
update_part /dev/$xda
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user