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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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. Understanding mpathconf Utility to configure DM-Multipath
  2. How to Enable IPv6 In CentOS / RHEL 5
  3. How to Start NTP Service With Slewing Enabled in Linux
  4. How to disable timeout in ssh during login prompt (login session inactivity) in Linux
  5. How to activate and mount 2 Volume groups with same names in CentOS/RHEL
  6. CentOS / RHEL 7 : systemd-analyze command to find booting time delays
  7. How to make alias command work in bash script or bashrc file
  8. How to verify if NX/XD is Enabled or Disabled in CentOS/RHEL 7 and 8
  9. Using iostat to monitor system performance in Linux (Examples included)
  10. CentOS/RHEL: How to find the package with a missing file using YUM

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ACPI in CentOS/RHEL 7
  • How to Use real-time query to access data on a physical standby database
  • CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  • How to Create a Physical Standby Database by Using SQL and RMAN Commands
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary