How to add an extra second hard drive on Linux LVM and increase the size of storage

I have 250GB disk installed on my home Linux server. I just bought a brand new 250GB SATA disk and I want to add a new disk to my existing LVM volume to increase its size total size to 500GB. How do I add a disk to LVM and extend an LVM volume on Linux operating system?

Logical volume management (LVM) creates an easy to use layer over physical disks. You can combine multiple disks and create logical storage volumes. This provides specific benefits such as:
  1. No restriction on disk size
  2. Increased disk throughput
  3. Mirroring volumes for business critical data
  4. Volume snapshots
  5. Easy backups and restores using snapshots
  6. Easy data relocation
  7. Resizing storage pools (add or remove disks) without reformatting disks
Tutorial details
Difficulty Advanced (rss)
Root privileges Yes
Requirements Linux with LVM
Time 15m
This tutorial shows you how to make partitioning, formatting, and add a new disk to LVM volume on Linux. For demo purpose, I am using Ubuntu VM, but the commands remain same for bare metal or any other virtualization technology such as KVM, Xen, VMware and so on.

Warning: Be careful with lvm/mkfs.ext4 and other commands, and device names as wrong device name can wipe out all data. Proceed with caution and always keep full backups.

Step 1 – Find out information about existing LVM

LVM Storage Management divided into three parts:

  1. Physical Volumes (PV) – Actual disks (e.g. /dev/sda, /dev,sdb, /dev/vdb and so on)
  2. Volume Groups (VG) – Physical volumes are combined into volume groups. (e.g. my_vg = /dev/sda + /dev/sdb.)
  3. Logical Volumes (LV) – A volume group is divided up into logical volumes (e.g. my_vg divided into my_vg/data, my_vg/backups, my_vg/home, my_vg/mysqldb and so on)

Type the following commands to find out information about each part.

How to display physical volumes (pv)

Type the following pvs command to see info about physical volumes:
$ sudo pvs
Sample outputs:

Fig.01: How to display information about LVM physical volumes

So currently my LVM include a physical volume (actual disk) called /dev/vda5. To see detailed attributes information, type:
$ sudo pvdisplay
Sample outputs:

Fig.02: See attributes of a physical volume (PV)

From above output it is clear that our volume group named ubuntu-box-1-vg is made of a physical volume named /dev/vda5.

How to display information about LVM volume Groups (vg)

Type any one of the following vgs command/vgdisplay command to see information about volume groups and its attributes:
$ sudo vgs
$ sudo vgdisplay
Sample outputs:

Fig.03: How to see information about LVM volume groups (vg)

How to display information about LVM logical volume (lv)

Type any one of the following lvs command/lvdisplay command to see information about volume groups and its attributes:
$ sudo lvs
$ sudo lvdisplay
Sample outputs:

Fig.04: How to display information about logical volumes (lv)

My ubuntu-box-1-vg volume group divided into two logical volumes:
  1. /dev/ubuntu-box-1-vg/root – Root file system
  2. /dev/ubuntu-box-1-vg/swap_1 – Swap space

Based upon above commands, you can get a basic idea how LVM organizes storage device into Physical Volumes (PV), Volume Groups (VG), and Logical Volumes (LV):

Fig.05: How LVM organizes storage device into Physical Volumes (PV), Volume Groups (VG), & Logical Volumes (LV)

Step 2 – Find out information about new disk

You need to add a new disk to your server. In this example, for demo purpose I added a new disk drive, and it has 5GiB size. To find out information about new disks run:
$ sudo fdisk -l
$ sudo fdisk -l | grep '^Disk /dev/'
Sample outputs:

Fig.06: Find out installed disk names on Linux

Another option is to scan for all devices visible to LVM2:
$ sudo lvmdiskscan
Sample outputs:
  /dev/ram0                   [      64.00 MiB] 
  /dev/ubuntu-box-1-vg/root   [      37.49 GiB] 
  /dev/ram1                   [      64.00 MiB] 
  /dev/ubuntu-box-1-vg/swap_1 [       2.00 GiB] 
  /dev/vda1                   [     487.00 MiB] 
  /dev/ram2                   [      64.00 MiB] 
  /dev/ram3                   [      64.00 MiB] 
  /dev/ram4                   [      64.00 MiB] 
  /dev/ram5                   [      64.00 MiB] 
  /dev/vda5                   [      39.52 GiB] LVM physical volume
  /dev/ram6                   [      64.00 MiB] 
  /dev/ram7                   [      64.00 MiB] 
  /dev/ram8                   [      64.00 MiB] 
  /dev/ram9                   [      64.00 MiB] 
  /dev/ram10                  [      64.00 MiB] 
  /dev/ram11                  [      64.00 MiB] 
  /dev/ram12                  [      64.00 MiB] 
  /dev/ram13                  [      64.00 MiB] 
  /dev/ram14                  [      64.00 MiB] 
  /dev/ram15                  [      64.00 MiB] 
  /dev/vdb                    [       5.00 GiB] 
  2 disks
  18 partitions
  0 LVM physical volume whole disks
  1 LVM physical volume

Step 3 – Create physical volumes (pv) on new disk named /dev/vdb

Type the following command:
$ sudo pvcreate /dev/vdb
Sample outputs:

  Physical volume "/dev/vdb" successfully created

Now run the following command to verify:
$ sudo lvmdiskscan -l
Sample outputs:

  WARNING: only considering LVM devices
  /dev/vda5                   [      39.52 GiB] LVM physical volume
  /dev/vdb                    [       5.00 GiB] LVM physical volume
  1 LVM physical volume whole disk
  1 LVM physical volume

Step 4 – Add newly created pv named /dev/vdb to an existing lv

Type the following command to add a physical volume /dev/vdb to “ubuntu-box-1-vg” volume group:
$ sudo vgextend ubuntu-box-1-vg /dev/vdb
Sample outputs:

  Volume group "ubuntu-box-1-vg" successfully extended

Finally, you need extend the /dev/ubuntu-box-1-vg/root to create total 45GB (/dev/vdb (5G)+ existing /dev/ubuntu-box-1-vg/root (40G))
$ sudo lvm lvextend -l +100%FREE /dev/ubuntu-box-1-vg/root
Sample outputs:

  Size of logical volume ubuntu-box-1-vg/root changed from 37.49 GiB (9597 extents) to 42.52 GiB (10885 extents).
  Logical volume root successfully resized.

However, if you run df -h or any other command you will still see /dev/ubuntu-box-1-vg/root as 40G. You need to run the following command to enlarge the filesystem created inside the “root” volume:
$ sudo resize2fs -p /dev/mapper/ubuntu--box--1--vg-root
Sample outputs:

resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/mapper/ubuntu--box--1--vg-root is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 3
The filesystem on /dev/mapper/ubuntu--box--1--vg-root is now 11146240 (4k) blocks long.

Verify it:
$ df -H
Sample outputs:

Filesystem                           Size  Used Avail Use% Mounted on
udev                                 1.1G     0  1.1G   0% /dev
tmpfs                                146M   12M  135M   9% /run
/dev/mapper/ubuntu--box--1--vg-root   45G  2.3G   41G   6% /
tmpfs                                512M     0  512M   0% /dev/shm
tmpfs                                5.3M     0  5.3M   0% /run/lock
tmpfs                                512M     0  512M   0% /sys/fs/cgroup
/dev/vda1                            495M  109M  361M  24% /boot
tmpfs                                103M     0  103M   0% /run/user/0

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 13 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
13 comments… add one
  • Spinel Feb 23, 2017 @ 2:11

    Is it possible to remove a hard disk to from an vg without hurt?

    • 🐧 Vivek Gite Feb 23, 2017 @ 8:32

      Yes. Only if you have free extents. Otherwise data loss will occur.

  • Bas Feb 23, 2017 @ 10:17

    You’ll have to make sure that no extents are being used on the disk of which you want to remove. Otherwise you’ll have to move them with pvmove to the other disk. See this blog post for an example:

    My advise is to build a similar setup in Virtualbox to test the commands of which you want to execute. If everything goes well, you’ll probably have a better feeling on performing the change on the real setup.

    There is a high chance of data loss/corruption if you mess the commands up. So handle with care :)

  • sedlav Feb 23, 2017 @ 13:23

    I think LVM = Logical Volume Management and not Linux Volume Management

  • Juan Valdez Mar 9, 2017 @ 2:37

    Excellent! Worked to perfection. Thank you.

  • PKOZLENKO Aug 1, 2017 @ 23:53

    The instruction is excellent. Although when it got to the resize I got a bad superblock error. I found I needed to use xfs_growfs
    Recommend a step prior to the resize step to look in fstab.
    e.g. cat /etc/fsab
    and check the filesystem type. In my case – I have xfs – which is handled slightly different. Hence xfs_gowfs


  • Danilo Aug 27, 2017 @ 13:41

    Thank you very much. Well explained

  • Eslam Hamdy Jul 24, 2020 @ 9:19

    if disk xfs
    xfs_growfs istead resize2fs

  • Major Gear Aug 11, 2020 @ 2:06

    Is it a good idea to mix NVMe SSD,Sata SSD, Spinning Hard Drive in a LVM? Or should the storage types be heterogenous?

  • paul Dec 24, 2020 @ 5:29

    Followed the article, was able to increase
    /dev/mapper/ubuntu–vg-root 31G 4.0G 25G 14% /
    /dev/mapper/ubuntu–vg-root 86G 4.3G 78G 6% /

    Now the VM (ubuntu18.04 LTS) does not boot, I get grub rescue> prompt.
    I’d appreciate if you could email me …

    • Jason Ryals Feb 25, 2021 @ 2:18

      Paul I have the same issue , VM will not boot… Any advice on resolving

  • Stefan Jan 9, 2021 @ 17:08

    Thanks for this, it was very helpful as I could not recall how to do it on a new server.

  • d3c3 Feb 18, 2021 @ 20:11

    Great article.
    Can you please add to this article how to deal with situations when the first volume is encrypted?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @