Mount NVMe EBS volume on EC2 and persist on reboot
AWS new instance type which are full HVM, utilizes NVMe interface for accessing the EBS volume, instead of paravirtual driver on HVM AMI.
With the following instances, EBS volumes are exposed as NVMe block devices: C5, C5d, i3.metal
, M5, and M5d. The device names are /dev/nvme0n1
, /dev/nvme1n1
, and so on. The device names that you specify in a block device mapping are renamed using NVMe device names (/dev/nvme[0-26]n1
).
Please type sudo lsblk to get the device listing e.g. when I have created another volume and attached as /dev/sdb, it is being shown as nvme1n1.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:1 0 30G 0 disk
nvme0n1p1 259:2 0 1M 0 part
nvme0n1p2 259:3 0 30G 0 part /
nvme1n1 259:0 0 30G 0 disk
Now create a filesystem on it e.g. to create xfs filesytem
sudo mkfs -t xfs /dev/nvme1n1
You can install xfs, if not found via the command below for RedHat family -
yum install xfsprogs
To verify the file system created, use command
sudo file -s /dev/nvme1n1
/dev/nvme1n1: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
Now get the UUID for the above device using command — sudo blkid. e.g