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
Tento commit je obsažen v:
Marek Marczykowski-Górecki 2019-02-23 18:17:23 +01:00
rodič 45d3b8d159
revize 9792438b3f
V databázi nebyl nalezen žádný známý klíč pro tento podpis
ID GPG klíče: 063938BA42CFA724

Zobrazit soubor

@ -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