diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qcow2_handling | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/qcow2_handling b/scripts/qcow2_handling index c81d4b2..bf9acb5 100644 --- a/scripts/qcow2_handling +++ b/scripts/qcow2_handling @@ -263,7 +263,8 @@ function resize_qcow2() { PARTED_OUT=`parted -s -m "$NBD_DEV" unit B print` #PART_NO=`echo "$PARTED_OUT" | grep ext[24] | awk -F: ' { print $1 } '` #PART_START=`echo "$PARTED_OUT" | grep ext[24] | awk -F: ' { print substr($2,1,length($2)-1) } '` - PART_START=`echo "$PARTED_OUT" | grep "^2:" | awk -F: ' { print substr($2,1,length($2)-1) } '` + PART_NO=2 + PART_START=`echo "$PARTED_OUT" | grep "^${PART_NO}:" | awk -F: ' { print substr($2,1,length($2)-1) } '` e2fsck -y -f $MAP_ROOT_DEV || true @@ -276,7 +277,7 @@ function resize_qcow2() { let PART_NEW_SIZE=$DATA_SIZE*$BLOCK_SIZE let PART_NEW_END=$PART_START+$PART_NEW_SIZE - ACT1=`parted -s "$NBD_DEV" rm 2` + ACT1=`parted -s "$NBD_DEV" rm ${PART_NO}` ACT2=`parted -s "$NBD_DEV" unit B mkpart primary $PART_START $PART_NEW_END` NEW_IMG_SIZE=`parted -s -m "$NBD_DEV" unit B print free | tail -1 | awk -F: ' { print substr($2,1,length($2)-1) } '` ROOT_PART_START=$PART_START |