Merge pull request #39164 from ngortheone/master

Fix root volume resizing on EC2 KVM instances (M5, C5, etc)

authored by Daniel Peebles and committed by GitHub ec569fc4 0e09510b

+9 -2
+9 -2
nixos/modules/system/boot/grow-partition.nix
··· 32 32 rootDevice="${config.fileSystems."/".device}" 33 33 if [ -e "$rootDevice" ]; then 34 34 rootDevice="$(readlink -f "$rootDevice")" 35 - parentDevice="$(lsblk -npo PKNAME "$rootDevice")" 36 - TMPDIR=/run sh $(type -P growpart) "$parentDevice" "''${rootDevice#$parentDevice}" 35 + parentDevice="$rootDevice" 36 + while [ "''${parentDevice%[0-9]}" != "''${parentDevice}" ]; do 37 + parentDevice="''${parentDevice%[0-9]}"; 38 + done 39 + partNum="''${rootDevice#''${parentDevice}}" 40 + if [ "''${parentDevice%[0-9]p}" != "''${parentDevice}" ] && [ -b "''${parentDevice%p}" ]; then 41 + parentDevice="''${parentDevice%p}" 42 + fi 43 + TMPDIR=/run sh $(type -P growpart) "$parentDevice" "$partNum" 37 44 udevadm settle 38 45 fi 39 46 '';