In the previous article, we have seen the introduction to AWS Elastic Block Store and also set up our EC2 instance. In this article, we are going to learn some interesting concepts. We will be covering the below topics.
- Understanding Hard Disks and their partitions naming convention.
- Understanding EBS Volume Types.
Let’s get started.
UNDERSTANDING HARD DISK AND THEIR PARTITION NAMING CONVENTION
In the previous article, we saw the root partition and the disk after setting up the EC2 instance.
Now, let’s understand how Linux kernel assigns a name to the hard-disks and their partitions.
Suppose we have a hard disk named as /dev/xvda then if we are going to add one more hard-disk then its name would be /dev/xvdb, so the naming convention goes like this :
- 1st Hard Disk : /dev/xvda
- 1st Partition: /dev/xvda1
- 2nd Partition: /dev/xvda2
- 3rd Partition: /dev/xvda3
- 2nd Hard Disk: /dev/xvdb
- 3rd Hard Disk: /dev/xvdc
So, by looking at the partition (/dev/xvda2) we can conclude that it is for the /dev/xvda hard disk and it’s the second partition.
Partitions are not directly accessible in Linux. We need to mount it to a directory and that directory will be the route to go into the partition.
For example, in Windows, C drive and D drive are basically the directories which are mounted on a partition which we generally don’t see. Now, if we want to see the directory on which the partition is mounted, we can use the below command.
df -h
And we can see that our 1st partition of the root volume is mounted on the root directory. This means everything in this Linux OS is in this partition.
Thus, the process of attaching the partition to a directory is called MOUNTING as we can’t directly access partition, so directory is the way.
UNDERSTANDING EBS VOLUME TYPES
Let’s first understand the different EBS volume types and then we will go with the practical implementation on how we can use volumes.
EBS Volume Types
There are three different types of EBS volumes, each with their own sets of performance characteristics and associated costs
Magnetic volumes
Magnetic volumes are backed by magnetic drives and are suited for workloads where data is accessed infrequently, and scenarios where low-cost storage for small volume sizes is important. These volumes deliver approximately 100 IOPS( input/output operations per second ) on average, with burst capability of up to hundreds of IOPS, and they can range in size from 1 GB to 1 TB.
- They are the cheapest volume and are very slow in speed.
- They are used to store long term data which we do not access so frequently. For example, backups or log archives can be stored here.
Provisioned IOPS volumes (SSD)
With Provisioned IOPS SSD (iol) volumes, you can provision a specific level of 1/0 performance. They support up to 20,000 IOPS and 320 MB/s of throughput. This allows you to predictably scale to tens of thousands of IOPS per EC2 instance.
- They are the fastest volume but very high in cost.
- They are used for the database where lots of I/O operations are going on very quickly. So, to prevent a user from lag we use this type of volume for the databases.
General purpose volumes (SSD)
This volume provides a base performance of 3 IOPS/GB, with the ability to burst to 3,000 IOPS for extended periods of time. Gp2 volumes are ideal for a broad range of use cases such as boot volumes, small and medium-size databases, and development and test environments. Gp2 volumes support up to 10,000 IOPS and 160 MB/s of throughput.
- They are in the middle of both in terms of speed and also reasonable in terms of cost.
- They are used for general use cases like hosting web service etc.
Cold HDD volumes
They are used for big data projects.
Throughput optimized HDD volumes
They are used for big data projects with even faster access as compared to Cold HDD and they are the most expensive volume.