In this tutorial, we’re going to mount an NVMe EBS volume to an EC2 instance and add it to /etc/fstab
so it automatically mounts the volume after reboots.
First list block devices using lsblk
:
sudo lsblk
You will see a result similar to this:
The NVMe volumes names follow the pattern below:
/dev/nvme0n1
/dev/nvme1n1
/dev/nvme2n1
.
.
.
/dev/nvme\[0-26\]n1
Then build a Linux file system of your choice, I picked ext4
here:
sudo mkfs -t ext4 /dev/nvme1n1
Verify the build using the file command and copy the UUID value:
sudo file -s /dev/nvme1n1
Now edit /etc/fstab
with the editor of your choice (I prefer nano xD) and add the following line to it:
UUID="<copied-uuid-value>" <mount-directory-path> ext4 defaults 0 0
Now we use the mount utility to verify and mount the volume.
sudo mount -a
You can checkout your mounted volumes using:
Getting a report of mounted file systems and disk space usage
I hope you enjoyed it, feel free to drop a comment if you have any questions.
Happy Engineering!
Originally published at https://mmoallemi99.com on April 28, 2021.
Top comments (0)