From 85c1b249ea39d3f1238749a4fa450b67bfc4a25e Mon Sep 17 00:00:00 2001 From: beerwatch Date: Sat, 11 Mar 2017 14:07:41 +0100 Subject: [PATCH] Update loc-05-grow-rootfs##one In default LVM partitioning, there is msdos partition table and the PV is in the extended partition. When growing, you must resize the extended partition first and the PV partition second. This change detects the situation and grows both items in mdsos (MBR) partition table accordingly. --- src/etc/one-context.d/loc-05-grow-rootfs##one | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/etc/one-context.d/loc-05-grow-rootfs##one b/src/etc/one-context.d/loc-05-grow-rootfs##one index 3cb0f6a..d16b674 100755 --- a/src/etc/one-context.d/loc-05-grow-rootfs##one +++ b/src/etc/one-context.d/loc-05-grow-rootfs##one @@ -28,6 +28,10 @@ if [ "${LVM}" != "no" ]; then PARTITION=$(pvdisplay |grep "PV Name"|awk '{print $3}'| sed "s|^${DISK}||") PV=$(pvdisplay |grep "PV Name"|awk '{print $3}') LV=$(lvdisplay ${DEVICE} |grep "LV Path"|awk '{print $3}') + TABLE=$(parted ${DISK} print | grep 'Partition Table:' | awk '{print $3}' | grep 'msdos' | wc -l) + if [ ${TABLE} -ne 0 -a ${PARTITION} -gt 4 ]; then + PARTITION="$(parted ${DISK} print | grep 'extended' | awk '{print $1}') $PARTITION" + fi fi if [ -n "$DEBUG" ]; then @@ -37,7 +41,9 @@ if [ -n "$DEBUG" ]; then echo PARTITION: ${PARTITION} fi -${GROWPART} ${DISK} ${PARTITION} +for PART in ${PARTITION} ; do + ${GROWPART} ${DISK} ${PART} +done if [ "${LVM}" != "no" ]; then ${PVRESIZE} ${PV}