summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorDaniel Peebles <copumpkin@users.noreply.github.com>2018-04-20 09:04:38 -0400
committerGitHub <noreply@github.com>2018-04-20 09:04:38 -0400
commitec569fc482a445b262386000aef52a9b3ce078a7 (patch)
treecd7a751d93e2a5cf2005c40a904121b65fc5ea49 /nixos
parent0e09510b0b098639fda254e528125e653f74bdcb (diff)
parent3a47c7e8f67c6ece266f570d6db9598856512ede (diff)
downloadnixpkgs-ec569fc482a445b262386000aef52a9b3ce078a7.tar
nixpkgs-ec569fc482a445b262386000aef52a9b3ce078a7.tar.gz
nixpkgs-ec569fc482a445b262386000aef52a9b3ce078a7.tar.bz2
nixpkgs-ec569fc482a445b262386000aef52a9b3ce078a7.tar.lz
nixpkgs-ec569fc482a445b262386000aef52a9b3ce078a7.tar.xz
nixpkgs-ec569fc482a445b262386000aef52a9b3ce078a7.tar.zst
nixpkgs-ec569fc482a445b262386000aef52a9b3ce078a7.zip
Merge pull request #39164 from ngortheone/master
Fix root volume resizing on EC2 KVM instances (M5, C5, etc) 
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/grow-partition.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/grow-partition.nix b/nixos/modules/system/boot/grow-partition.nix
index c4c6d82dc5c..1e6f9e442b6 100644
--- a/nixos/modules/system/boot/grow-partition.nix
+++ b/nixos/modules/system/boot/grow-partition.nix
@@ -32,8 +32,15 @@ with lib;
       rootDevice="${config.fileSystems."/".device}"
       if [ -e "$rootDevice" ]; then
         rootDevice="$(readlink -f "$rootDevice")"
-        parentDevice="$(lsblk -npo PKNAME "$rootDevice")"
-        TMPDIR=/run sh $(type -P growpart) "$parentDevice" "''${rootDevice#$parentDevice}"
+        parentDevice="$rootDevice"
+        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
       fi
     '';