core-agent-linux/patches.debian/0001-Revert-Use-sfdisk-instead-of-parted-to-resize-root-p.patch
Marek Marczykowski-Górecki 2dbdb1e66f
Fix misleading error message on rootfs resize
The partition being extended is in use and sfdisk can't reload such
partition table. Tell it to not even try, it will be done by partprobe
call below.
2019-09-30 04:03:06 +02:00

42 lines
1.7 KiB
Diff

From f372cd46df94d5a67286aee923b9908d1326e040 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
<marmarek@invisiblethingslab.com>
Date: Sun, 24 Feb 2019 03:58:11 +0100
Subject: [PATCH] Revert "Use sfdisk instead of parted to resize root partition
table"
Organization: Invisible Things Lab
Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
util-linux in Debian is too old for this, because the bug
karelzak/util-linux#532, which is fixed only in util-linux 2.31.1+
(Debian stretch has 2.29.2).
This reverts commit 9792438b3f02161e03d89dfd527ca2459092b478.
---
misc/resize-rootfs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/misc/resize-rootfs b/misc/resize-rootfs
index 1c2fca3c..bebf1011 100755
--- a/misc/resize-rootfs
+++ b/misc/resize-rootfs
@@ -8,8 +8,13 @@ case "$(stat -Lc %t:%T /dev/mapper/dmroot)" in
# nothing needed, xvda used directly
;;
ca:3)
- # resize partition table itself and xda3 partition
- echo ',+' | sfdisk --no-reread --no-tell-kernel -q -N 3 /dev/xvda
+ # resize partition table itself
+ # use undocumented ---pretend-input-tty (yes, three '-') to
+ # force unattended operation, otherwise it aborts on first
+ # prompt, even with '-s' option
+ echo fix | parted ---pretend-input-tty /dev/xvda print >/dev/null
+ # then resize 3rd partition, even though it is mounted
+ echo yes 100% | parted ---pretend-input-tty /dev/xvda resizepart 3
# and reload partition table; prefer partprobe over blockdev
# --rereadpt, as it works on mounted partitions
partprobe /dev/xvda
--
2.17.2