aws

Create new volume in EC2 instances availability zone, or clone via snapshot

Attach to /dev/sdf of instance

Connect to instance

# Run to verify:
lsblk

# Example lsblk output:
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0          7:0    0 25.2M  1 loop /snap/amazon-ssm-agent/7993
loop1          7:1    0 55.7M  1 loop /snap/core18/2829
loop2          7:2    0 38.8M  1 loop /snap/snapd/21759
nvme0n1      259:0    0   60G  0 disk
├─nvme0n1p1  259:1    0   59G  0 part /
├─nvme0n1p14 259:2    0    4M  0 part
├─nvme0n1p15 259:3    0  106M  0 part /boot/efi
└─nvme0n1p16 259:4    0  913M  0 part /boot
nvme1n1      259:5    0   60G  0 disk    # Instead of these, you might see xvdf if
└─nvme1n1p1  259:6    0   60G  0 part    # you were using an older EC2 instance

# Make dir for volume:
sudo mkdir -p /mnt/volume_name

## Warning: Do this only if volume is new: ##
# Delete data and format volume:
sudo mkfs -t ext4 /dev/nvme1n1p1

# Mount it:
sudo mount /dev/nvme1n1p1 /mnt/volume_name

# Set up fstab to auto-mount on start:
nano /etc/fstab


Add this to the end of fstab:

/dev/nvme1n1p1 /mnt/volume_nameext4 defaults,nofail 0 2