SYS: Create and remove physical volumes, assign physical volumes to volume groups, and create and delete logical volumes.

Share this link

Note: This is an RHCSA 7 exam objective.


Before dealing with physical volumes, volume groups and logical volumes, you need to know how to create partitions on disk.

LVM Presentation

LVM stands for Logical Volume Manager. It’s the system component that is able to deal with partitions in a modern way.

Traditionally, Unix disks were divided into slices called partitions. It was possible to decide the size of each partition but, once done, you couln’t change it without destroying all data on it.

With LVM, you can allocate disk space in a flexible manner.

LVM relies on three main concepts:

  • physical volume or pv: a pv is a whole disk or a partition of a disk,
  • volume group or vg: a vg contains one or more pv; a pv can only belong to one vg,
  • logical volume or lv: a lv represents a portion of a vg; a lv can only belong to one vg; it’s on a lv that you can create a file system.

LVM brings flexibility compared to the previous system only based on partitions:

  • you can easily increase the size of a logical volume if you’ve got some space available in the associated volume group,
  • if you don’t have any available space anymore, you can add a new disk as a physical volume, add it to the volume group and increase the size of your logical volume: the logical volume will span two or more disks without any additional operations,
  • creating or extending logical volumes don’t require any downtime.

Configuration Report

Before starting any operation, you need to know the current configuration. Type:

# lsblk -a
vda           252:0    0    6G  0 disk 
├─vda1        252:1    0  390M  0 part /boot
└─vda2        252:2    0  5.5G  0 part 
  ├─rhel-swap 253:0    0  552M  0 lvm  [SWAP]
  └─rhel-root 253:1    0    3G  0 lvm  /

With the lsblk command, you get quickly the following information:

  • it is a virtual machine (vda, sda would indicate a physical server),
  • there is only one disk /dev/vda of 6GB,
  • the disk is divided into two partitions (vda1 and vda2) respectively with a size of 390MB and 5.5GB,
  • the vda1 partition is mounted under /boot,
  • the vda2 partition consists in two logical volumes (lvm) swap and root in a volume group called rhel,
  • the swap logical volume is used by the system as a swapping area ([SWAP]) of 552MB,
  • the root logical volume is mounted under / with a size of 3GB,
  • there is around 2GB of free available space (5.5GB552MB3GB=2GB) in the vda2 partition,
  • none of the partitions are in Read-Only mode (RO=0) or ReMovable (RM=0).

Note1: lsblk should be the first command to type when dealing with partitions.
Note2: By default, the lsblk command doesn’t display empty devices. The -a option corrects this problem.

Physical Volume Management

To create a physical volume (here /dev/vda), type:

# pvcreate /dev/vda

To remove a physical volume not belonging to any volume group (here /dev/vda), type:

# pvremove /dev/vda

To get the list of the physical volumes, type:

# pvs

Volume Group Management

To create a volume group (here called vg using a physical volume /dev/vda) with a physical extent size of 8MB, type:

# vgcreate -s 8m vg /dev/vda

To add a physical volume (here /dev/vdb) to an existing volume group (here vg), type:

# vgextend vg /dev/vdb

To remove a physical volume (here /dev/vdb) from an existing volume group (here vg), type:

# vgreduce vg /dev/vdb

To remove an existing volume group (here called vg), type:

# vgremove vg

To get the list of the volume groups, type:

# vgs

Logical Volume Management

To create a logical volume (here called lv_vol with a size of 1GB in the vg volume group), type:

# lvcreate --size 1G --name lv_vol vg

To remove a logical volume (here called lv_vol in the vg volume group), type:

# lvremove /dev/vg/lv_vol

To get the list of the logical volumes, type:

# lvs

Additional Resources

You can also watch Ralph Nyberg‘s video about LVM (18min/2015) or Red Hat Training‘s Resizing a volume group (5min/2015).
Beyond the RHCSA objectives, you can read this tutorial about Creating a Thinly Provisioned Logical Volume.

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.00 out of 5)
22 comments on “SYS: Create and remove physical volumes, assign physical volumes to volume groups, and create and delete logical volumes.
  1. algorisms says:

    On my LFCS exam, they had asked us to do some work with LVM – I won’t discuss what they actually asked because that would be a cheating… But I will say that users should know what packages are needed… Sometimes, even though they are default packages, they aren’t installed… If you know what I mean…

  2. hunter86_bg says:

    You should add the lvresize command,which is quite useful.
    Ex: If you have a logical volume with name “lvol” in volume group “vg_new” and you wish to resize it:
    lvresize -L 10G -r /dev/vg_new/lvol0
    The command changes the size of the volume to 10 GB, resizes the file system automatically.Works in both up and down directions ( -L option specifies the amount of space you want for your lvol and it skips the usage of “lvextend” and “lvreduce”)
    *”lvresize” must be used only when the volume is “umount”ed!
    * “-r” option resizes ext2,ext3,ext4 in both directions,”xfs” file system supports only growing!

  3. Ahmad says:


    Can you please help on the below two queries:

    1-Is shrinking LVM is an RHCSA objective?
    2-Is creating a LUKS encrypted partitions an RHCSA objective?
    3-If yes, how we can do both for the RHCSA perspective?

    • CertDepot says:

      1- You are supposed to know how to do it.
      2- LUKS encrypted partitions were an RHCSA 6 objective.
      3- You only need to be prepared for the point 1.

  4. ntorga says:

    Just a tip: If pvcreate and similars doesn’t work, you have to check with rpm -q lvm2 to see if lvm is installed.

  5. reaz_mahmood says:

    Hi, I have read somewhere that in the exam they ask to create lv in terms of PE unit. It is normally 1PE = 4 Mib. Is there any exception of this conversion or it will always be 4 Mib ?

  6. ercole1977 says:

    Hi guys probably a stupid question. I have 2 LVs configured and only one mounted. My scope is to check available space on them. If I do lvdisplay I see lv size, and with df -h I see free space of the mounted one. My question is….how can I see the free space of LV not mounted?

Leave a Reply

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 5 minutes.
Create a user account named "tony" with password “redhat” and belonging to a secondary group called “team”.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a default secure MariaDB database called maria with a user named muser with all privileges.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...