summaryrefslogtreecommitdiffstats
path: root/rescue/restore-image.sh
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2009-10-09 16:10:26 +0000
committerOlivier Blin <oblin@mandriva.com>2009-10-09 16:10:26 +0000
commit7e41869ce16425aaf503b45f15d22c1113fe6665 (patch)
tree90c6f86bbd064baef72a3cd1dc8799d13836bcaf /rescue/restore-image.sh
parent1246d7e3515329a5fcb2ba7a9a59b074e89fa697 (diff)
downloaddrakx-7e41869ce16425aaf503b45f15d22c1113fe6665.tar
drakx-7e41869ce16425aaf503b45f15d22c1113fe6665.tar.gz
drakx-7e41869ce16425aaf503b45f15d22c1113fe6665.tar.bz2
drakx-7e41869ce16425aaf503b45f15d22c1113fe6665.tar.xz
drakx-7e41869ce16425aaf503b45f15d22c1113fe6665.zip
do not extend / to the end of the disk, it overlaps with swap
partition (from Paulo Ricardo Zanoni)
Diffstat (limited to 'rescue/restore-image.sh')
-rwxr-xr-xrescue/restore-image.sh21
1 files changed, 17 insertions, 4 deletions
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