mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-18 20:39:14 +08:00
core: 更精确地找出系统盘
This commit is contained in:
parent
f180fd5be8
commit
9be306830e
@ -21,9 +21,8 @@ update_part() {
|
||||
# ubuntu grownpart
|
||||
|
||||
# 找出主硬盘
|
||||
# xda=$(lsblk -dn -o NAME | grep -E 'nvme0n1|.da')
|
||||
# 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_num=$(readlink -f /dev/disk/by-label/installer | grep -o '[0-9]*$')
|
||||
@ -55,6 +54,7 @@ update_part /dev/$xda
|
||||
case $part_fstype in
|
||||
xfs) xfs_growfs / ;;
|
||||
ext*) resize2fs /dev/$xda$part_num ;;
|
||||
btrfs) btrfs filesystem resize max / ;;
|
||||
esac
|
||||
update_part /dev/$xda
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user