To clear a PVID in AIX, first confirm that the disk is not part of a volume group or being used by an application. Then, for the correct disk, run chdev -l hdiskX -a pv=clear, replacing hdiskX with the device name. Verify the result with lspv and, if needed, lsattr. Clearing a PVID changes the disk’s LVM identification; it does not securely erase the disk’s data.
What Is a PVID in AIX?
A PVID, or physical volume identifier, is a unique identifier AIX uses to recognize a disk as a physical volume for Logical Volume Manager (LVM). AIX records PVID information on the disk and in its device configuration data. You can see the PVIDs AIX recognizes by running lspv.
A PVID helps AIX associate a disk with a volume group, even when device names or storage paths change. That makes it important not to clear a PVID simply because a disk looks unfamiliar. The disk could contain data or belong to a volume group that is temporarily unavailable.
Clearing the PVID removes the disk’s LVM identity so it can be prepared for a new use. It is not the same as deleting files, removing a disk from a volume group, or securely wiping all data from the device.
When Should You Clear a PVID?
Common reasons to clear a PVID include returning a disk to a storage pool, preparing a disk for a new volume group, or correcting an identifier left behind after a disk was repurposed. You might also encounter a PVID conflict after a disk has been copied or cloned.
A duplicate PVID needs particular care. It can occur when a disk is copied at the storage level, but the original and copy may both contain valuable data. Do not clear either identifier until you have established which disk is the intended copy and how it should be introduced to the volume group. Follow your organization’s documented cloning or recovery procedure.
Clearing a PVID is generally appropriate only when you have confirmed that the target disk is not in active use and that removing its LVM identity is part of the planned change. If you are unsure, stop and check with the AIX or storage administrator before proceeding.
Before You Clear the PVID
Start by confirming the disk name, its PVID, and its volume-group membership. A mistaken device name can affect the wrong disk, so verify the information against your storage mapping or change record as well as the command output.
- List physical volumes with
lspv. - Check a specific disk with
lspv hdiskX. - Review the volume groups with
lsvgand inspect a relevant group withlsvg -p vgname. - Check for mounted filesystems and application use before changing the disk.
- Confirm that the target is the correct AIX device, especially when the system uses multipath storage.
Replace hdiskX and vgname in examples with the actual device and volume-group names. Do not copy a sample device name directly into a production command without verifying it.
How to Clear a PVID in AIX
Once you have verified that the disk is safe to change, run the following command as an appropriately privileged user:
chdev -l hdiskX -a pv=clear
For example, if the confirmed target is hdisk7, the command would be:
chdev -l hdisk7 -a pv=clear
The chdev command changes a device attribute. Here, pv=clear requests that AIX clear the physical-volume identifier for the specified disk. Read the command output carefully. If AIX reports an error, do not repeatedly try alternative commands or write directly to the disk. Investigate why the operation was rejected first.
Command behavior and device support can vary with the AIX level, storage configuration, and device type. If the command is not accepted, consult the documentation for your installed AIX release and the storage vendor’s guidance. Avoid using low-level write commands to overwrite disk sectors as a workaround; doing so can damage LVM metadata or other disk contents.
How to Verify the PVID Was Cleared
After the command completes, check the disk again:
lspv
Or inspect only the target:
lspv hdiskX
Confirm that the PVID is no longer shown as a normal assigned identifier. You can also check the device attribute directly:
lsattr -El hdiskX -a pvid
Compare the output with your AIX release’s expected display for a disk without a PVID. If the old value still appears, or the command reports that the device is busy, stop and investigate. Check that you selected the intended disk, that it is not part of a volume group, and that the device paths are understood correctly.
If the Disk Belongs to a Volume Group
Do not clear a PVID on a disk that is actively used as a member of a volume group. First determine whether the volume group contains logical volumes or filesystems that depend on that disk. Review the group with commands such as lsvg -p vgname and lsvg -l vgname, and coordinate with application owners before making changes.
If the disk contains allocated physical partitions, those partitions may need to be moved to another disk before the disk can be removed from the group. AIX provides LVM tools such as migratepv for appropriate migration scenarios, but the destination must have enough usable space and the operation must be planned for the specific environment.
After the disk’s data and volume-group membership have been handled through the approved procedure, remove the physical volume from the group as required. Only then consider clearing its PVID. The correct sequence depends on whether the volume group is active, whether the disk holds data, and whether the system is using mirrored logical volumes, SAN storage, or other special configurations.
Never use a PVID-clearing command as a substitute for properly removing a disk from a volume group. Clearing the identifier does not safely migrate data or update application dependencies.
Important Storage and Data-Safety Considerations
A cleared PVID does not mean the disk is empty. Data blocks, filesystem content, and other metadata may remain. If the disk is being reused, follow the separate provisioning process for creating a volume group, logical volumes, and filesystems. If it is being retired, use your organization’s approved data-sanitization process.
On SAN-attached systems, a single storage device may be visible through multiple paths. Confirm that AIX has identified the intended disk correctly and that you are not confusing one path or device representation with another. Follow the multipathing configuration and storage vendor’s recommendations; do not clear identifiers on individual paths as a guess.
Also distinguish between clearing a PVID and removing a device from AIX’s device configuration. Commands that remove a device definition do not necessarily erase the PVID on the storage itself, and clearing a PVID does not necessarily remove the device definition. Choose the action that matches your goal.
Common Problems When Clearing a PVID
- The device is busy: A volume group, filesystem, application, or storage operation may still be using the disk. Identify and resolve the dependency before retrying.
- The PVID remains visible: Check that you used the correct disk name and review the command’s result. In multipath environments, confirm the AIX device mapping.
- Two disks show the same PVID: Treat this as a possible clone or mapping issue. Determine which disk is the original and follow the supported duplicate-PVID procedure instead of clearing one at random.
- The command is rejected: Verify the syntax and device support for your AIX level. Review the error message and consult the relevant IBM and storage documentation.
- You need to erase the data: Clearing a PVID is not secure erasure. Use an approved sanitization method for the device and storage platform.
Conclusion
To clear a PVID in AIX, verify that the disk is the correct target and is no longer needed by a volume group or application, then run chdev -l hdiskX -a pv=clear. Check the result with lspv and, where useful, lsattr -El hdiskX -a pvid. If the disk is active, the PVID is duplicated, or the command fails, investigate the storage and LVM configuration before taking further action. Most importantly, remember that clearing a PVID removes an LVM identifier—it does not move data, remove all disk metadata, or securely erase the disk.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.