DEV Community

loading...

Convert Multiple AWS Instance Store Volumes into Single Volume using LVM

Hemanth Kumar Vadupu
Originally published at dev.to ・2 min read

Step 1: Launch EC2 Instance with Instance type “d2.xlarge”.
● “D2.xlarge” comes with 3 instance store Volumes, Each volume having “2TB” Volume.
image

● We can check volumes in the servers with command lsblk
image

Step 2: Initialize devices to use with the LVM in order to do this, we need to use the pvcreate command.

● pvcreate is used to initialize disk or partitions that will be used by LVM
● It can either initialize a complete physical disk or a partition on physical disks.
image

Step 3: Display device attributes for this, we need to use the pvdisplay command to display information about physical disks. # pvdisplay
image

Step 4: Create the LVM volume group. Once the devices are initialized, we can create the LVM volume group.

● A group of physical volumes or disks are combined together into a single storage file which is referred to as the LVM volume group.
● For this, we used the vgcreate command to create a volume group by providing the name of the volume group and the path of actual physical volumes.
image

● Command “vgscan”, which scan all disks for LVM volume groups.
image

Step 5: Create logical volume from the logical volume Group.
image

● Once the logical volumes are created, we can view their status using the “lvdisplay” command.
image

Step 6: Format your logical volumes. Once the logical volumes are created, we can format them using any filesystem like ext4, XFS, and more.
image

Step 7: Mount newly created logical volume to /opt
image

Discussion (0)