Attaching Volume to EC2 Instance

Attaching Volume to EC2 Instance 
To list the partitions 
$ cat /proc/partitions

major minor  #blocks  name

 202        1   52428800 xvda1
Create a Volume in EC2 Instance and attach it to the instance.
$ cat /proc/partitions

major minor  #blocks  name

 202        1   52428800 xvda1
 202       80   52428800 xvdf
Format the partition
 $sudo mke2fs -F -t ext4 /dev/xvdf

Create a directory for the and mount the volume

 $sudo mkdir /data
 $sudo mount /dev/xvdf /data
Command to display disk usage
 $df -h
If we restart, this change would disappear. To make this change permanent , we need to edit this file and add the configs.

$sudo vi /etc/fstab
#
LABEL=/     /           ext4    defaults,noatime  1   1
tmpfs       /dev/shm    tmpfs   defaults        0   0
devpts      /dev/pts    devpts  gid=5,mode=620  0   0
sysfs       /sys        sysfs   defaults        0   0
proc        /proc       proc    defaults        0   0
/dev/xvdf   /data       ext4    defaults        0   0
 
Good you tube video on attaching the volume

You may also like...