on AWS, you may see some instance types have instance storage
attr with it. E.g.:
g4dn.xlarge 1 4 16 1 x 125 NVMe SSD --> Instance Storage in GB
This means, when you boot a instance with this type, you will have 2 volumes attached:
- boot volume, default 8G, system installed on it
- instance storage volume, 125G, or 116.4Gi, spare, not in use by default.
You can check with:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
...
nvme0n1 259:0 0 8G 0 disk
├─nvme0n1p1 259:1 0 7.9G 0 part /
├─nvme0n1p14 259:2 0 4M 0 part
└─nvme0n1p15 259:3 0 106M 0 part /boot/efi
nvme1n1 259:4 0 116.4G 0 disk ---> this is the spare instance storage volume
other checks you can do to ensure you get the correct volume target:
sudo bash
ls -al /dev/* # check which device/disk/partion you have
df -hT # T: show fs type
fdisk -l
lsblk -o NAME,FSTYPE,LABEL,SIZE,MOUNTPOINT
To auto mount it on boot:
sudo bash
# create a folder to mount volume to, here I follow ubuntu convention:
mkdir /mnt/ephemeral0 # EC2 instance storage is ephemeral, be careful!
mkfs.ext4 /dev/nvme1n1
# it may took a while for uuid to show up
blkid # find correct UUID
vim /etc/fstab
# add line like this, use UUID other than device name so it never change:
UUID=e67211c6-df01-433d-ab5b-da912fca874a /mnt/ephemeral0 ext4 defaults,nofail 0 2
mount /mnt/ephemeral0 # mount it manually now, it will check /etc/fstab
Because the line in /etc/fstab, this disk will mount automatically on boot.
nofail
: if you remove this volume later, it will ignore and move on. otherwise you will fail to boot.- the last
2
: disk check order on boot, 1 is for boot disk, use 2 for others.