From 9792438b3f02161e03d89dfd527ca2459092b478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 23 Feb 2019 18:17:23 +0100 Subject: [PATCH] Use sfdisk instead of parted to resize root partition table parted tries to load random data for possible partiont table UUID generation, even though there is no need to generate new UUID. In case of early VM startup, this is very undesirable as random entropy pool may not be initialized yet, which will cause parted to block. Use sfdisk instead, which doesn't try to do that. And also can relocate backup GPT and resize partition in one go. Fixes QubesOS/qubes-issues#4419 --- misc/resize-rootfs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/misc/resize-rootfs b/misc/resize-rootfs index bebf101..1c2fca3 100755 --- a/misc/resize-rootfs +++ b/misc/resize-rootfs @@ -8,13 +8,8 @@ case "$(stat -Lc %t:%T /dev/mapper/dmroot)" in # nothing needed, xvda used directly ;; ca:3) - # 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 + # resize partition table itself and xda3 partition + echo ',+' | sfdisk --no-reread -q -N 3 /dev/xvda # and reload partition table; prefer partprobe over blockdev # --rereadpt, as it works on mounted partitions partprobe /dev/xvda