Go to EC2 console to create the volume and attach it to the instance, and then we’ll mount the volume to make it available.
– under Elastic Block Store, click Volumes.
– Click on Create Volume – Select the General Purpose (SSD) volume type.
– Wait for your Volume to be available.
– Right click on it and select Attach Volume, Select the instance and specify an unused device name say /dev/xvdk
For making it available follow these steps:
[ec2-user ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvdk 202:80 0 22G 0 disk
xvda1 202:1 0 8G 0 disk /
here xvdk device is not mounted.
To Mount it – mkfs -t ext4 /dev/xvdk
# mkdir /mnt/space
# mount /dev/xvdf /mnt/space
Voila, You just added the volume to the system.
To check it, df -h
[ec2-user ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.9G 1.1G 6.8G 14% /
tmpfs 298M 0 298M 0% /dev/shm
/dev/xvdk 22G 0 22G 0% /mnt/space