Bobcares Logo
Search Call 1-800-383-5193 Emergency Contact
Bobcares Logo
Search Call 1-800-383-5193 Emergency Contact
Emergency Contact

How to create an LVM logical volume on an EBS volume: AWS EC2

by Jiji Jose | Aug 16, 2021 | Amazon Web Services (AWS), Latest | 0 comments

Are you looking for how to create an LVM logical volume on an entire EBS volume? We will help you!

As a part of our AWS Support Services, here, at Bobcares, we often receive similar AWS queries from our customers.

Today, let’s see the steps followed by our Support Techs to create an LVM logical volume on an EBS volume.
 

Create an LVM logical volume on an EBS volume

 
LVM is a tool for logical volume management that includes allocating disks, striping, mirroring, and resizing logical volumes. If we are using logical volumes on the Amazon EBS volume, we must use LVM to extend the logical volume.

Let’s see the steps followed by our Support Techs to use LVM on an EBS volume and extend the partitions.

  1. Firstly, we need to create physical volumes (PV) on the partition of the EBS volume.
  2. Create a volume group (VG) and then add the physical volume that we created into the volume group.
  3. Then create a logical volume (LV) and mount the directory on the LVM.
  4. Then we need to create and mount a file system.
  5. Finally, resize the logical volume.

 

Creating physical volumes on the partition of the EBS volume

 

  1. At first, log in to the AWS Management console and then open the Amazon EC2 console.

2. Create the EBS volume and then attach it to the instance.

3. To create a partition we can use gdisk command.

$ sudo gdisk /dev/xvdh
Command (? for help): n
Partition number (1-1218, default 1): 1
First sector (34-20971486, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-20971486, default = 20971486) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8e00
Changed type of partition to 'Linux LVM'
...
OK; writing new GUID partition table (GPT) to /dev/xvdh.
The operation has completed successfully.

Here, in the example, we create the partition /dev/xvdh1 on /dev/xvdh.

For the variables Hex code or GUID, enter 8e00.

4. To confirm the creation of the partition we can use lsblk command.

$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 8G 0 disk
└─xvda1 202:1 0 8G 0 part /
xvdh 202:80 0 10G 0 disk
└─xvdh1 202:81 0 10G 0 part

5. To create a physical volume from the partion, run the pvcreate command.

$ sudo pvcreate /dev/xvdh1
Physical volume "/dev/xvdh1" successfully created.

Also note that if we are using Nitro-based instance, the block device name are like /dev/nvme1n1, /dev/nvme2n1, etc. So we need to replace the device names in the following steps with the correct device name.
 

Creating volume groups and adding the physical volumes into the volume group

 
The following example uses one physical volume to create volume group samplegroupA.

  1. To create a volume group to add the new physical volume we can use the vgcreate command.

Syntax: $ sudo vgcreate <volume-name> <device-name>

$ sudo vgcreate samplegroupA /dev/xvdh1
Volume group "samplegroupA" successfully created

Here in the following example uses one physical volume to create the volume group ‘samplegroupA‘

2. To see the new volume group’s details, we can use the vgs or vgdisplay command.

$ sudo vgs
VG #PV #LV #SN Attr VSize VFree
samplegroupA 1 0 0 wz--n- <10.00g <10.00g

 

Creating a logical volume and mounting the directory on LVM

 

  1. To create a logical volume (partition) from the volume group, we can use the lvcreate command.

Syntax: sudo lvcreate -n <logical-volume-name> -L <size-of-volume> <lvm-volume-name>

$ sudo lvcreate -n LVsampleA -L 9G samplegroupA
Logical volume "LVsampleA" created

2. To view the logical volume’s details, we can use the lvs or lvdisplay command.

$ sudo lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
LVsampleA samplegroupA -wi-a----- 9.00g

3. Then using the mkdir command we can create a mount directory. The following example creates the directory /mnt1.

$ sudo mkdir /mnt1

 

Creating and mounting the file system

 

  1. To create a file system and mount the partitions, use the following commands.

We can use the mkfs -t command to create the file system.

$ sudo mkfs -t xfs /dev/samplegroupA/LVsampleA

Replace xfs with the correct file system type.

2. Then use the lsblk -f command to verify the creation of the new file system.

$ lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
xvda
├─xvda1
└─xvda2 xfs 66e5e079-770e-4359-a9da-5205c3d8d5af /
xvdh
└─xvdh1 LVM2_member 0UnOic-e2ng-XxH5-z0UW-7aTh-RxQK-KMrDqo
└─samplegroupA-LVsampleA xfs 5db36052-81d5-4762-8502-6986ff3964e7

3. Then run the mount command to mount the file system on the mount directory.

$ sudo mount /dev/samplegroupA/LVsampleA /mnt1

4. Then edit the mount options in the /etc/fstab file so that the new mount persists after reboot.

/dev/samplegroupA/LVsampleA /mnt1 xfs defaults,nofail 0 0

 

Resize the logical volume

 
There are two options for extending logical volumes:

  1. By increasing the size of the existing EBS volume.
  2. Adding additional EBS volumes to the volume group.

 

By increasing the size of the existing EBS volume:

 
1. Change the size of the existing EBS volume.

2. Then we need to install the growpart:

$ sudo yum install cloud-utils-growpart

For Debian or Ubuntu systems:

$ sudo apt install -y cloud-guest-utils

3. Then to extend the partition, use the growpart command.

$ sudo growpart /dev/xvdh 1
CHANGED: disk=/dev/xvdh partition=1: start=2048 old: size=20971519,end=16777182 new: size=41940958,end=41943006

4. Then run the pvresize command to resize the physical volume.

$ sudo pvresize /dev/xvdh1
Physical volume "/dev/xvdh1" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized

Here, the partition /dev/xvdh1 is extended.

5. We can use the pvs or pvdisplay to view the physical volume details.

$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/xvdh1 samplegroupA lvm2 a-- <20.00g <13.00g

6. To view the volume group’s details, use the vgs or vgdisplay command.

$ sudo vgs
VG #PV #LV #SN Attr VSize VFree
samplegroupA 1 1 0 wz--n- <20.00g <13.00g

7. Then to extend the logical volume, use the lvextend command.

$ sudo lvextend -L 19G /dev/samplegroupA/LVsampleA

8. To view the logical volume’s details, use the lvs or lvdisplay command.

$ sudo lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
LVsampleA samplegroupA -wi-a----- 19.00g

9. Then extend the file system:

For XFS file systems:

$ sudo yum install xfsprogs
$ sudo xfs_growfs /dev/samplegroupA/LVsampleA

For Ext4 file systems:

$ sudo resize2fs /dev/samplegroupA/LVsampleA

Note that when increasing the size of the volume, size changes usually take effect within a few seconds when the volume enters the optimizing state. The volume’s performance is affected while in the optimizing state but doesn’t fall below the source configuration specification. Performance changes may take from a few minutes to a few hours depending on the volume type.
 

Adding additional EBS volume to the volume group

 

  1. First, we need to create another EBS volume of 10 GB and then attach the volume to the instance.
$ sudo pvcreate /dev/xvdi1
Physical volume "/dev/xvdi1" successfully created.

2. To extend the volume group, use the vgextend command and then add the new volume.

$ sudo vgextend samplegroupA /dev/xvdi1
Volume group "samplegroup2" successfully extended

3. To view this, run the vgs or vgdisplay command.

$ sudo vgs
VG #PV #LV #SN Attr VSize VFree
samplegroupA 2 1 0 wz--n- 29.99g 20.99g

This shows that there are now two PV in the samplegroupA volume group.

4. We can use the lvextend command to extend the logical volume:

$ sudo lvextend -L 29G /dev/samplegroupA/LVsampleA

5. Then resize the file system.

For XFS file systems:

$ sudo xfs_growfs /dev/samplegroupA/LVsampleA

For Ext4 file systems:

$ sudo resize2fs /dev/samplegroupA/LVsampleA

Note: If we have already created LVM on the volume and mounted it, then we need to follow the steps at Extend the logical volume.

 

[Need help with more AWS queries? We’d be happy to assist]
 

Conclusion

 
To conclude, today we discussed the steps followed by our Support Engineers to help our customers to create an LVM logical volume on an EBS volume.

Submit a Comment Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • What Is Proactive Monitoring? A Complete Guide
  • AI Use Cases: How Artificial Intelligence Is Used Across Industries
  • Turn Manual Business Processes into Automation-Driven Growth
  • Digitalization of Business to Speed Up Operations and Support Faster Scaling
  • Cloud Cost Optimization Best Practices: Everything You Need to Know in 2026

Categories

  • Advanced Vulnerability
  • AI Services
  • AI Support
  • AIOps
  • Amazon Web Services (AWS)
  • Apache
  • API Integration
  • Application Development
  • Azure
  • Cloud Cost Optimization
  • Cloud Management
  • Cloud-Native Application
  • Cloudflare
  • cPanel
  • cPanel migration
  • Cyberpanel
  • DDoS
  • Development Service
  • DevOps
  • DevOps Consulting
  • DevSecOps
  • Digital Transformation
  • DigitalOcean
  • DirectAdmin
  • Docker
  • Drupal
  • Ecommerce
  • Filezilla
  • FTP
  • Google cloud platform
  • HAProxy
  • Headless CMS Integration
  • Hosting Support
  • IIS
  • Infrastructure Management & Optimization
  • Kubernetes
  • KVM
  • Laravel
  • Latest
  • Linode
  • Litespeed
  • LXC/LXD
  • Magento
  • Mobile App Development
  • MongoDB
  • Moodle
  • MySQL
  • NFS
  • Nginx
  • OnApp
  • Outsourced Support
  • OVH
  • ovirt
  • pfsense
  • Plesk
  • PostgreSQL
  • PowerDNS
  • Product Engineering
  • Proxmox
  • RedHat
  • Redis
  • Sendmail
  • Server Administration
  • Server Management
  • Software Development
  • Software Testing
  • SQLServer
  • Technical Support
  • UI/UX
  • Virtualizor
  • VMware
  • VPN
  • Vulnerability Scanning
  • Vultr
  • Web Development
  • Windows
  • WordPress
  • WordPress Hosting
  • WordPressHA

Subscribe to our newsletter

Footer newsletter

Email sales@bobcares.com | Phone 1-800-383-5193

Product Engineering

  • MVP Build
  • MVP to Scale
  • Product Maintenance

Digital Transformation

  • Process Digitization & Automation
  • Systems Integration & Workflow Orchestration
  • Data Enablement & Decision Support
  • Application & Platform Modernization
  • Transformation Execution & Delivery Enablement

AI Services

  • AI Readiness & Use-Case Discovery
  • AI Integration & Application Enablement
  • Intelligent Automation & AI Workflows

Infrastructure Management

  • Always-On Infrastructure Management
  • Proactive Monitoring & Incident Prevention
  • Cloud Cost Control & Optimization (FinOps)
  • Outsourced IT & End-User Support
  • Managed Infrastructure Execution Support

DevOps & Automation Services

  • CI/CD & Release Automation
  • Infrastructure as Code & Platform Standardization
  • Reliability Engineering & Observability
  • DevSecOps Enablement
Product Engineering +
Web Development MVP to Scale Builds Microservices Architecture Agile & Dev Team Augmentation Mobile Apps Ecommerce UI/UX Design QA & Test Automation
Digital Transformation +
Legacy Modernization Workflow Automation Data-Driven Dashboards CRM / ERP Integration Business Process Re-engineering
AI Services +
AI & Machine Learning AIOps Intelligent Automation Business Intelligence & Analytics AI Installation & Compute
Infrastructure Management +
Cloud Setup Cloud Migration Managed Cloud Services Server & Hosting Cost Optimization Performance Optimization Outsourced Support
DevOps & Automation Services +
CI/CD Setup Kubernetes & Docker Infrastructure as Code Cloud-Native Migration DevSecOps
Cybersecurity & Compliance Services +
Security Hardening VAPT Incident Response Backup & DR

© 2026 Bobcares. All Rights Reserved.

  • Careers
  • |
  • Cookie Policy
  • |
  • GDPR
  • |
  • Privacy Policy
  • |
  • Terms and Service
  • LinkedIn
  • YouTube
  • Instagram
  • Facebook

Preview of the new Bobcares experience
NEW UPDATE
See What’s New
at Bobcares

Discover a faster, clearer view of our services and expertise.


Explore the New Experience
Arrow Right