• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL : How to remove used Physical Volume(PV) from Volume Group (VG) in LVM

by admin

We have already seen how to remove an unused PV from the volume group with vgreduce command.

CentOS / RHEL : How to remove unused Physical Volume(PV) from Volume Group (VG) in LVM

The vgreduce command shrinks the volume group by removing one or more PVs. But in case if the PV is in use by any of the LV, we have to first move the LVs onto some other free PVs using pvmove and then we can use the vgreduce command as usual to remove the PV. We can then either use these free PVS in another VG or remove them from the LVM configuration.

Removing used PV from VG

1. Extend the VG. where vg01 is the VG name and /dev/sdc is the destine device.

# vgextend vg01 /dev/sdc
  Volume group "vg01" successfully extended

If you have more than one disk, repeat this operation for all of them or provide disks in the same command with spaces.

2. Confirm the disk spaces using the pvs command. As you can see below the newly added disk is free with sufficient space to accommodate the data on /dev/sdb PV.

# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used  
  /dev/sda2  cl   lvm2 a--  19.00g     0  19.00g
  /dev/sdb   vg01 lvm2 a--  20.00g 10.00g 10.00g
  /dev/sdc   vg01 lvm2 a--  20.00g 20.00g     0

3. Run the pvmove command for the original PV that in this example is /dev/sdb. pvmove command will migrate all the LVs present on the device /dev/sdb to the device /dev/sdc. This is done online without any interruption. You could see the status on the command line.

# pvmove /dev/sdb
  /dev/sdb: Moved: 1.48%
  /dev/sdb: Moved: 100.00%

4. Reduce the VG in order to release the /dev/sdb PV.

# vgreduce vg01 /dev/sdb
  Removed "/dev/sdb" from volume group "vg01"

5. Check the /dev/sdb (origin) is completely free now.

# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used  
  /dev/sda2  cl   lvm2 a--  19.00g     0  19.00g
  /dev/sdb        lvm2 ---  20.00g 20.00g     0 
  /dev/sdc   vg01 lvm2 a--  20.00g 10.00g 10.00g

6. Now you can remove it completely from the LVM configuration if you want or you can use in some other volume group. Below is the example to remove it from LVM configuration.

# pvremove /dev/sdb
  Labels on physical volume "/dev/sdb" successfully wiped.

Filed Under: Linux

Some more articles you might also be interested in …

  1. checkupdates : Command Examples in Linux
  2. “git symbolic-ref” Command Examples
  3. “aws s3 ls” Command Examples
  4. losetup: command not found
  5. How to Disable IPv6 on Ubuntu 20.04 Focal Fossa
  6. mknod Command Examples in Linux
  7. btrfs property Command Examples in Linux
  8. How to resize (extend) a partition-based file system in Linux
  9. composer-require-checker: A CLI tool to analyze Composer dependencies for soft dependencies
  10. helm Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright