Skip to content

Commit

Permalink
Amazon image: Add NVMe support to the initrd
Browse files Browse the repository at this point in the history
This is required by the new c5.* instance types.

Note that this changes disk names from /dev/xvd* to
/dev/nvme0n*. Amazon Linux has a udev rule that calls a Python script
named "ec2nvme-nsid" to create compatibility symlinks. We could use
that, but it would mean adding Python to the AMI closure...
  • Loading branch information
edolstra committed Nov 9, 2017
1 parent 67ba83a commit 54da9cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nixos/modules/virtualisation/amazon-image.nix
Expand Up @@ -33,7 +33,7 @@ let cfg = config.ec2; in
config.boot.kernelPackages.ena
];
boot.initrd.kernelModules = [ "xen-blkfront" "xen-netfront" ];
boot.initrd.availableKernelModules = [ "ixgbevf" "ena" ];
boot.initrd.availableKernelModules = [ "ixgbevf" "ena" "nvme" ];
boot.kernelParams = mkIf cfg.hvm [ "console=ttyS0" ];

# Prevent the nouveau kernel module from being loaded, as it
Expand Down

2 comments on commit 54da9cc

@greglearns
Copy link

@greglearns greglearns commented on 54da9cc Dec 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has a new AMI been created that includes NVMe? And, if so, given that I'm pinning my nixpkgs to a git commit, how do I ensure that NixOps launches the new AMI that has NVMe fixed? Thanks!

NixOps is deploying ami-d3956fab in my current setup. That AMI never boots correctly so that one never is able to SSH into the box.

Using ami-2bd87953 by explicitly setting deployment.ec2.ami = "ami-2bd87953" in my NixOps file works. Is there a better way to pin things so that I'm not explicitly defining the AMI to use?

@greglearns
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that ami-2bd87953 has a problem recognizing the true size of the attached EBS storage. It thinks it has only 2 GB (see /dev/disk/by-label/nixos below), but the attached storage is actually 30 GB (I verified this in the AWS console on the instance below).

[root@ip-172-31-1-61:~]# df -h
Filesystem                Size  Used Avail Use% Mounted on
devtmpfs                  385M     0  385M   0% /dev
tmpfs                     3.8G     0  3.8G   0% /dev/shm
tmpfs                     1.9G  3.4M  1.9G   1% /run
tmpfs                     3.8G  320K  3.8G   1% /run/wrappers
/dev/disk/by-label/nixos  2.0G  1.2G  675M  64% /
tmpfs                     3.8G     0  3.8G   0% /sys/fs/cgroup
tmpfs                     770M     0  770M   0% /run/user/0

I launched this with:

      deployment.ec2 = {
        region = region;
        ami = "ami-2bd87953"; # needed for NVMe instances, C5, M5.
        # default AMI was ami-d3956fab
        instanceType = "m5.large";
        ebsInitialRootDiskSize = 30;
        keyPair = resources.ec2KeyPairs.my-key-pair;
        securityGroups = [ "allow-only-good-stuff"];
      };

Please sign in to comment.