Browse Source

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
Marek Marczykowski-Górecki 5 years ago
parent
commit
9792438b3f
1 changed files with 2 additions and 7 deletions
  1. 2 7
      misc/resize-rootfs

+ 2 - 7
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