Skip to content

Instantly share code, notes, and snippets.

@dawn360
Created November 28, 2018 19:31
Show Gist options
  • Save dawn360/84ac56a9edd29052f7e69597de8d48cf to your computer and use it in GitHub Desktop.
Save dawn360/84ac56a9edd29052f7e69597de8d48cf to your computer and use it in GitHub Desktop.
Mount EBS to EC2
#list the disk you attached to your instance.
lsblk
#Check if the volume has any data using the following command.
sudo file -s /dev/xvdf
#Format the volume to ext4 filesystem using the following command.
sudo mkfs -t ext4 /dev/xvdf
#Create a directory of your choice to mount our new ext4 volume. I am using the name “newvolume”
sudo mkdir /newvolume
#Mount the volume to “newvolume” directory using the following command.
sudo mount /dev/xvdf /newvolume/
#cd into newvolume directory and check the disk space for confirming the volume mount.
cd /newvolume
df -h .
#To unmount the volume, you have to use the following command.
umount /dev/xvdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment