- Create & attach volume in AWS console (must be in same availability zone).
- From your ec2 instance, list attached volumes:
sudo fdisk -l
- Find the disk in the list and copy it's identifier to your clipboard, e.g.
/dev/nvme1n1
. - If it's a brand new volume, you probably need to format it:
Don't do this to a volume with data on it, or else it won't have data on it anymore. You can skip this step and come back to it if you get an error aboutwrong fs type
when trying tomount
the disk.
For other available filesystem types, typesudo mkfs.ext4 /dev/nvme1n1
mkfs.
then tab-tab for autocomplete. See also Making an EBS Volume Available for use on Linux for more details, warnings, etc. - Create an empty directory where you want to mount the volume, if it doesn't already exist:
mkdir ~/extrastorage
- Mount the disk to that directory:
sudo mount /dev/nvme1n1 ~/extrastorage
- You probably need to give yourself permission to read & write from the mounted directory via some combination of the following:
In other words,sudo chmod 775 ~/extrastorage sudo chown ubuntu ~/extrastorage sudo chgrp ubuntu ~/extrastorage
ls -g ~
and then change the permissions to match the stuff you can access. - You should now be able to access data on that volume as normal file structures nested under
~/extrastorage
Last active
February 17, 2023 19:36
-
-
Save colllin/5e311ec948f38ecf697dfe19303056f3 to your computer and use it in GitHub Desktop.
Mount an EC2 volume
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment