From 7e41869ce16425aaf503b45f15d22c1113fe6665 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 9 Oct 2009 16:10:26 +0000 Subject: do not extend / to the end of the disk, it overlaps with swap partition (from Paulo Ricardo Zanoni) --- rescue/restore-image.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'rescue/restore-image.sh') diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh index 3750c8215..99de39a27 100755 --- a/rescue/restore-image.sh +++ b/rescue/restore-image.sh @@ -340,9 +340,9 @@ function expand_fs() main_part=/dev/${root} # FIXME: absurdly dirty hack - num=${root##sda} - let num++ - swap_part=/dev/${root%[0-9]}${num} + main_part_num=${root:3} + swap_part_num=$((main_part_num+1)) + swap_part=${disk}${swap_part_num} main_part_sectors= if [ -n "$SWAP_BLOCKS" ]; then @@ -359,7 +359,20 @@ function expand_fs() mkswap -L swap $swap_part fi if [ -n "$EXPAND_FS" ]; then - sfdisk -d $disk | sed -e "\|$main_part| s/size=.*,/size= ,/" | sfdisk -f $disk + e2fsck -fy $main_part + fdisk $disk << EOF +d +$main_part_num +n +p +$main_part_num + + +a +$main_part_num +w +EOF + sfdisk -R $disk e2fsck -fy $main_part resize2fs $main_part fi -- cgit v1.2.1