Command to make EBS volume available in EC2 Instance


#view available disk devices
[root@ip-172-31-21-110 lib]# lsblk
xvda 202:0 0 16G 0 disk
└─xvda1 202:1 0 16G 0 part /
xvdf 202:80 0 4G 0 disk

#Check for filesystem exist
[root@ip-172-31-21-110 lib]# file -s /dev/xvdf
/dev/xvdf: data

#Create file systems ext4
[root@ip-172-31-21-110 lib]# mkfs -t ext4 /dev/xvdf
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 1048576 4k blocks and 262144 inodes
Filesystem UUID: cc264756-e45e-4902-a570-bbd640927453
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

#Create mount point
[root@ip-172-31-21-110 lib]# mkdir /data

# mount the volume at the location /data
[root@ip-172-31-21-110 ~]# mount /dev/xvdf /data

[root@ip-172-31-21-110 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 16G 8.8G 6.8G 57% /
devtmpfs 993M 60K 992M 1% /dev
tmpfs 1001M 0 1001M 0% /dev/shm
/dev/xvdf 3.9G 8.0M 3.6G 1% /data


Viet Luu has written 318 articles

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

We are thankful for your never ending support.

Leave a Reply