ClickCease

In the previous post we had learned how to attach ebs volume to ec2 instance. Now in this post we will learn creating filesystem on ebs volume to store data.

For using ebs volume to actually store data, we need to create filesystem on the ebs volume. On a Linux server, the most recommended / used filesystems are ext4 and xfs. Though there might be number of use cases where companies might be using older filesystem like ext3.

It solely depends on the project / application and use case.

For creating filesystem on ebs volume to store data, I am using ext4 for this lab.

Like I have said it earlier. You MUST have basic Linux skills to move ahead in your career. You just cannot afford to ignore Linux and expect a job / career in IT. I have seen a lot of cases, where young graduate guys are straight away jumping on courses like AWS without any Linux skills. Just because their “some brother’s friend / known one” has told them to move to cloud and devops for career growth.

I will be talking on this learning curve in my next post. Not now.

Creating filesystem on ebs volume to store data.

Step #1 – After doing ssh to your ec2 instance. Get yourself “root” rights with “sudo su – “ and check with “fdisk -l” . The new block device / ebs volume must be shown in the output.

creating filesystem on ebs volume to store data
using “fdisk” to view new block device

Step #2 – I will use old and trusted “fdisk” utility to create partition. For this demo, I am creating a 500MiB block device, which I will use to show the rest of the lab.

Now, this is the reason, I always say “Basic Linux administratoin skills (RHCSA Training) is needed to do anything in IT (cloud included).

using fdisk to create partition
using fdisk to create partition

Step #3 – Once done with creating a partition, use “partprobe” to update the kernel for the new partition. Confirm the newly created parition by using “lsblk” command. “lsblk” will show all the partitions, no matter, they are formatted or not.

partprobe and lsblk commands
using partprobe and lsblk command to see new partition

Step #4 – Confirm that no filesytem is already present on the new parition (/dev/xvdf1), the name can be different in your case. As output of “blkid” is not showing our new partition (/dev/xvdf1), we can safely go ahead and format it.

using blkid command
using blkid command to verify filesystem

Step #5 – I will be using “ext4” filesytem on the new partition.

creating ext4 filesystem using mkfs.ext4 command
creating ext4 filesystem using mkfs.ext4 command

Step #6 – Once done, we can confirm the presence of filesystem on the new parition, by using the “blkid” command again. This time the output must show the presence of “ext4” filesytem against the device “/dev/xvdf1”

confirming the filesytem using blkid command
confirming the filesytem using blkid command

Step #7 – Now we only need to create folder to be used as mount point and mount it, using “mount” command.

We can also give “df -h” command to see the currently mounted filesystems, and we should not see the new “/dev/xvdf1” in the output.

using df -h command
using df -h command

Now use the mount command to mount it and use it.

mounting filesystem using mount command
mounting filesystem using mount command

Finally, we can move inside /mydata directory and use it to store our important data.

creating filesystem on ebs volume to store data
creating filesystem on ebs volume to store data