Follow these steps to mount a disk on an EC2 instance (tested on Amazon Linux 2):
# show disks
lsblk
# get disk's device name, e.g. sdf
sudo /sbin/ebsnvme-id /dev/nvme1n1
# check if there is already a filesystem on the disk
# (if symlink, replace sdf with its destination, e.g. nvme1n1)
sudo file -s /dev/sdf
# partition with xfs
sudo mkfs -t xfs /dev/sdf
# recheck that the disk now is properly formatted
sudo file -s /dev/sdf
# create mount point
sudo mkdir -p /mnt/data
# create backup copy of fstab just in case
sudo cp /etc/fstab /etc/fstab.orig
# list partitions with UUIDs, e.g.:
# /dev/nvme1n1: UUID="f47571fe-803d-42df-83b7-904ed5f3333e" TYPE="xfs"
sudo blkid
# edit fstab to add our partition, e.g.
# UUID=f47571fe-803d-42df-83b7-904ed5f3333e /mnt/data xfs defaults,nofail 0 2
sudo vim /etc/fstab
# mount the partition we just added
sudo mount -a
Reference:
PREVIOUSCheat Sheet - MongoDB