growPartition: fix volume resizing on EC2 NVME instances
The previous code for this accidentally picked up a "p" when computing the partition number. This logic should be more robust
This commit is contained in:
parent
b5ca7fefc4
commit
3a47c7e8f6
@ -32,8 +32,15 @@ with lib;
|
|||||||
rootDevice="${config.fileSystems."/".device}"
|
rootDevice="${config.fileSystems."/".device}"
|
||||||
if [ -e "$rootDevice" ]; then
|
if [ -e "$rootDevice" ]; then
|
||||||
rootDevice="$(readlink -f "$rootDevice")"
|
rootDevice="$(readlink -f "$rootDevice")"
|
||||||
parentDevice="$(lsblk -npo PKNAME "$rootDevice")"
|
parentDevice="$rootDevice"
|
||||||
TMPDIR=/run sh $(type -P growpart) "$parentDevice" "''${rootDevice#$parentDevice}"
|
while [ "''${parentDevice%[0-9]}" != "''${parentDevice}" ]; do
|
||||||
|
parentDevice="''${parentDevice%[0-9]}";
|
||||||
|
done
|
||||||
|
partNum="''${rootDevice#''${parentDevice}}"
|
||||||
|
if [ "''${parentDevice%[0-9]p}" != "''${parentDevice}" ] && [ -b "''${parentDevice%p}" ]; then
|
||||||
|
parentDevice="''${parentDevice%p}"
|
||||||
|
fi
|
||||||
|
TMPDIR=/run sh $(type -P growpart) "$parentDevice" "$partNum"
|
||||||
udevadm settle
|
udevadm settle
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user