shntnu
1/6/2017 - 5:07 PM

Create an EBS volume using AWS console and attach it to an EC2 instance

Create an EBS volume using AWS console and attach it to an EC2 instance

# Create an EBS volume using AWS console and attach it to the ec2 instance 

# Do the following on the instance

# create mount point
mkdir ~/ebs_tmp

# check the name of the disk 
lsblk

#> NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
#> xvda    202:0    0     8G  0 disk
#> └─xvda1 202:1    0     8G  0 part /
#> xvdf    202:80   0   100G  0 disk

# check if it has a file system
sudo file -s /dev/xvdf
# ...likely not, in which case you get:
#> /dev/xvdf: data

# if no file system, then create it
sudo mkfs -t ext4 /dev/xvdf

# mount it
sudo mount /dev/xvdf /home/ubuntu/ebs_tmp/

# change perm
sudo chmod 777 ~/ebs_tmp/
 
# to unmount
sudo umount /home/ubuntu/ebs_tmp

# More here:
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html