LVM Remove a Physical Volume: Difference between revisions

From UNIX Systems Administration
Jump to navigation Jump to search
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 6: Line 6:
# Select: <tt>'''SCSI and SCSI Raid Hot Plug Manager'''</tt>
# Select: <tt>'''SCSI and SCSI Raid Hot Plug Manager'''</tt>
# Select: <tt>'''Replace/Remove a Device Attached to an SCSI Hot Swap Enclosure Device'''</tt>
# Select: <tt>'''Replace/Remove a Device Attached to an SCSI Hot Swap Enclosure Device'''</tt>
# Select: <tt>'''Slot #'''</tt> of the physical volume you wish to remove.
# Select: <tt>'''Slot #'''</tt> of the physical volume you wish to remove
# Follow the on-screen1instructions to complete removal.
# Follow the on-screen instructions to complete removal


== Linux ==
== RHEL7 ==
=== Removal of a Physical Volume ===
=== Removal of a Physical Volume from LVM ===
# Removing a physical volume from a volume group:
# Ensure the physical volume is not being used
## Ensure the physical volume is not being used:
#: <tt>'''# pvdisplay /dev/<physical_volume#>'''</tt>
### <tt>'''# pvdisplay /dev/XXX#'''</tt>
# If physical volume contains any logical volumes, you will need to migrate the data off of the physical volume
## If physical volume contains any logical volumes, you will need to migrate the data off of the physical volume:
#: <tt>'''# pvmove /dev/<physical_volume#>'''</tt>
### <tt>'''# pvmove /dev/XXX#'''</tt>
# If physical volume is empty remove it from the volume group
## If physical volume is empty remove it from the volume group:
#: <tt>'''# vgreduce <volume_group> /dev/<physical_volume#>'''</tt>
### <tt>'''# vgreduce GGGG /dev/XXX#'''</tt>
# Remove the physical volume from LVM
## Remove the physical volume from LVM:
#: <tt>'''# pvremove /dev/<physical_volume#>'''</tt>
### <tt>'''# pvremove /dev/XXX#'''</tt>
 
=== Removal of the Physical Volume from the System ===
# Ensure all users are closed out of the device
# If the device is multipathed, note the multipath configuration for the device
#: <tt>'''# multipath -l'''</tt>
# Flush the I/O of the device
#: <tt>'''# blockdev --flushbufs /dev/<device>'''</tt>
# Remove any references to the device from <tt>'''/dev/disk/by-id'''</tt>
# Remove any references to the device from <tt>'''/dev/disk/by-path'''</tt>
# Remove any references to the device from <tt>'''/dev/disk/by-uuid'''</tt>
# Delete the device.
#: <tt>'''# rm /dev/<device>'''</tt>
# Remove the device from the SCSI Subsystem
#: <tt>'''# echo 1 > /sys/block/<device>/device/delete'''</tt>
# If the device is multipathed remove the configuration for the device
#: <tt>'''# multipath -f <mpath>'''</tt>


== Further Reading ==
== Further Reading ==
# [http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp IBM pSeries and AIX Information Center]
# [http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp IBM pSeries and AIX Information Center]
# [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/removing_devices RHEL7 Removing a Storage Device]


[[Category:AIX]]
[[Category:AIX]]
[[Category:Linux]]
[[Category:Linux]]

Latest revision as of 23:50, 19 September 2023

AIX

Removal of a Physical Volume

  1. # diag
  2. Select: Task Selection
  3. Select: Hot Plug Task
  4. Select: SCSI and SCSI Raid Hot Plug Manager
  5. Select: Replace/Remove a Device Attached to an SCSI Hot Swap Enclosure Device
  6. Select: Slot # of the physical volume you wish to remove
  7. Follow the on-screen instructions to complete removal

RHEL7

Removal of a Physical Volume from LVM

  1. Ensure the physical volume is not being used
    # pvdisplay /dev/<physical_volume#>
  2. If physical volume contains any logical volumes, you will need to migrate the data off of the physical volume
    # pvmove /dev/<physical_volume#>
  3. If physical volume is empty remove it from the volume group
    # vgreduce <volume_group> /dev/<physical_volume#>
  4. Remove the physical volume from LVM
    # pvremove /dev/<physical_volume#>

Removal of the Physical Volume from the System

  1. Ensure all users are closed out of the device
  2. If the device is multipathed, note the multipath configuration for the device
    # multipath -l
  3. Flush the I/O of the device
    # blockdev --flushbufs /dev/<device>
  4. Remove any references to the device from /dev/disk/by-id
  5. Remove any references to the device from /dev/disk/by-path
  6. Remove any references to the device from /dev/disk/by-uuid
  7. Delete the device.
    # rm /dev/<device>
  8. Remove the device from the SCSI Subsystem
    # echo 1 > /sys/block/<device>/device/delete
  9. If the device is multipathed remove the configuration for the device
    # multipath -f <mpath>

Further Reading

  1. IBM pSeries and AIX Information Center
  2. RHEL7 Removing a Storage Device