From 69b490f329f93796cd183770f02eab5081d5f655 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Mon, 16 Apr 2018 17:18:51 -0300 Subject: [PATCH] resize-helper: allow resizing rootfs even if already mounted Parted fails to resize the rootfs if it is already mounted by the system, so replicate the parted command with an additional syntax to force resize if the first call failed (two commands are required as the syntax are not compatible with each other). Signed-off-by: Ricardo Salveti --- resize-helper | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resize-helper b/resize-helper index 76348eb..766ae38 100755 --- a/resize-helper +++ b/resize-helper @@ -55,6 +55,8 @@ if [ "$PART_TABLE_TYPE" = "gpt" ]; then ${PARTPROBE} fi -${PARTED} ${DEVICE} resizepart ${PART_ENTRY_NUMBER} 100% +# 'Yes' is required when partition is already mounted +${PARTED} -s ${DEVICE} resizepart ${PART_ENTRY_NUMBER} 100% || \ + ${PARTED} ---pretend-input-tty ${DEVICE} resizepart ${PART_ENTRY_NUMBER} Yes 100% ${PARTPROBE} ${RESIZE2FS} "${ROOT_DEVICE}"