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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

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

by admin

To remove any physical volume in a volume group vgreduce command can be used. The vgreduce command shrinks the volume group by removing one or more PVs. We can then either use these free PVS in another VG or remove them from the LVM configuration.

Removing the PV

1. Before removing a physical volume from a volume group, you can make sure that the physical volume is not used by any logical volumes by using the pvdisplay command.

# pvdisplay /dev/sdb1 -m
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg_os2
  PV Size               558.88 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              143072
  Free PE               40672
  Allocated PE          102400
  PV UUID               EPwws6-yxK0-7Ycb-IbFC-iYzE-5vNk-eQ7mYl

  --- Physical Segments ---
  Physical extent 0 to 51199:
    Logical volume      /dev/vg_os2/lv_data
    Logical extents     0 to 51199

As shown in the commnad output above, the PV /dev/sdb1 is in use in the LV /dev/vg_os2/lv_data. If the physical volume you want to delete have some data, you can move it using the pvmove command and then delete the LV. refer the posts below to migrate the data and remove LV:

CentOS / RHEL : How to migrate storage (LVM) with pvmove Command
CentOS / RHEL : How to delete LVM volume

2. Use the vgreduce command to remove the physical volume. The following command removes the physical volume /dev/hda1 from the volume group my_volume_group.

# vgreduce vg_os2 /dev/sdb1
Search or use up and down arrow keys to select an item. CentOS / RHEL : How to remove used Physical Volume(PV) from Volume Group (VG) in LVM

Filed Under: Linux

Some more articles you might also be interested in …

  1. kexec Command Examples in Linux
  2. nixos-container : Command Examples in Linux
  3. How to calculate recommended value of vm.min_free_kbytes Kernel Tuning Parameter
  4. How to obtain virtual/physical CPU information in Oracle VM (XEN)
  5. nm : Command to list the symbols in object files.
  6. How to gzip all or specific files in Linux
  7. dstat Command Examples in Linux
  8. CentOS / RHEL : How to extend Physical Volume in LVM by extending the Disk Partition used
  9. po4a-gettextize: command not found
  10. flashrom: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright