High Performance Starts Here — AMD Dedicated Servers

English

Home

Blog

How To Create Linux LVM Partition – Step...

How To Create Linux LVM Partition – Step-by-step Guide

How To Create Linux LVM Partition – Step-by-step Guide

NetShop ISP

NetShop ISP · Blog Author

Oct 27, 2021 · Technical Tutorials

In today’s article we will demonstrate how you can easily create an LVM partition on your Linux Server. Why LVM? Simply because it allows you to dynamically extend or shrink partitions in real-time!

In an era when Cloud servers and virtualization is greatly used by system admins, the LVM (Logical Volume Manager) allows you to resize Volume Groups (VG) by adding new physical volumes (PV) or deleting existing PVs attached to VGs.

In the end of this article you can find useful LVM commands. Let’s proceed with the steps to create a Linux LVM partition. For the sake of this article tutorial, we assume that you have inserted a new Hard Disk on your server.

Step-by-Step Guide to Create a Linux LVM Partition

  1. Connect on your server with root user (or other sudo privileged account)
  2. Type fdisk -l to identify your new hard disk device name. We assume that ours is named /dev/xvdb
  3. Type fdisk /dev/xvdb
  4. You are now into the fdisk command prompt, type the following commands in the order specified below:
    1. type n to create a new disk partition
    2. type p to create a primary partition
    3. type 1 to declare it as the first partition of your new Disk
    4. hit ENTER twice to accept the default start / end cylinders
    5. type t to change the default Linux partition to LVM partition type
    6. type L to list all partition types and search for the id for Linux LVM
    7. type 8e (as per list results from previous step) to change your partition into 8e, i.e. Linux LVM
    8. type w to write the partition table (basically to apply the changes from all previous steps) and exit fdisk upon completion
  5. Now it’s time to create a Physical Volume (PV) on our new hard disk: pvcreate /dev/xvdb1
  6. Create LVM Volume Group (VG) named vg0 with a physical extend size (PE) of 16MB: vgcreate -s 16M vg0 /dev/xvdb1
  7. To create a Logical Volume (LV) named lvol0 on VG vg0, type: lvcreate -L 400M -n lvol0 vg0
  8. Let’s format the Logical Volum lvol0 in a RHEL supported file system, e.g. EXT3: mkfs -t ext3 -m 1 -v /dev/mapper/vg0-lvol0
  9. Create a mount location for our new ext3 file system: mkdir /mnt/vfs
  10. Last step is to mount the new EXT3 file system to our newly created mount point: mount -t ext4 /dev/mapper/vg0-lvol0 /mnt/vfs
  11. You can confirm everything has been created correctly, by typing: df -h. An output as follows should appear:

/dev/mapper/vg0-lvol0 385M 12M 373M 3% /mnt/vfs

You are all set! Here is a list of some useful LVM commands to have in hand:

  • To display volume group settings (in our case of the VG named vg0) such as physical size (PE size), Volume group name (VG name), maximum logical volumes (Max LV), etc.
vgdisplay vg0
  • To list all physical volumes (PV) created for the volume group
pvscan
  • To add new physical volumes (PV) to an existing volume group, either through new hard disk or new disk partitions.
vgextend

how to
linux
storage
tutorials
Press Releases
97

Free VPS Trial

No Credit Card Required.

Start Your VPS Hosting Free Trial

Recent Posts

What Can You Do With a Hermes Agent VPS? - NetShop ISP Blog

What Can You Do With a Hermes Agent VPS?

30 July 2026

Hermes AI Agent VPS - Deploy in 1 Click

Introducing Hermes Agent VPS: Your Own AI Agent, Live in One Click

22 July 2026

How To Protect Your Website from DDoS Attacks in 2026

How To Protect Your Website from DDoS Attacks in 2026

14 July 2026

Why Your Stream Keeps Buffering (And How to Fix It)

Why Your Stream Keeps Buffering (And How to Fix It)

08 July 2026

How to Secure Your WordPress Website in 2026

How to Secure Your WordPress Website in 2026

30 June 2026