File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,20 @@ echo "SOURCE_IMAGE: $SOURCE_IMAGE"
1212echo " EXPAND: $EXPAND "
1313
1414# Determine the current size of the partition.
15- SIZE_BEFORE=$( parted -s " ${SOURCE_IMAGE} " unit MiB print | grep -e ' ^ 2' \
16- | xargs echo -n | cut -d" " -f 4 | tr -d MiB)
15+ PARTED_OUT=$( parted -s " ${SOURCE_IMAGE} " unit MiB print)
16+ SIZE_BEFORE=$( echo -e " ${PARTED_OUT} " | grep -e ' ^ 2' | xargs echo -n \
17+ | cut -d" " -f 4 | tr -d MiB)
1718
1819# Find the end of the root partition. This assumes there are two partitions.
19- ROOT_END=$( parted -s " ${SOURCE_IMAGE } " unit MiB print | grep -e ' ^ 2' \
20- | xargs echo -n | cut -d" " -f 3 | tr -d MiB)
20+ ROOT_END=$( echo -e " ${PARTED_OUT } " | grep -e ' ^ 2' | xargs echo -n \
21+ | cut -d" " -f 3 | tr -d MiB)
2122
2223ROOT_END_NEW=$(( $ROOT_END + $EXPAND ))
2324
2425parted -s " ${SOURCE_IMAGE} " unit MiB print free
2526
2627# Expand the image slightly more than required for the new partition.
27- dd bs=1M if=/dev/zero count= $(( $ EXPAND + 1 )) >> $SOURCE_IMAGE
28+ qemu-img resize -f raw $SOURCE_IMAGE " + $(( EXPAND + 1 )) M "
2829
2930parted -s " ${SOURCE_IMAGE} " unit MiB print free
3031
You can’t perform that action at this time.
0 commit comments