Sunday, July 6, 2008

AIX Unix LVM Destruction Commands. Part Two Of Two

Hey there,

Today, we're finishing up what we started yesterday with our post on using LVM on AIX Linux. Today we're going to move on to Logical Volume, Volume Group and Physical Volume destruction commands. I also opted not to list out the usage commands (since there are quite a few of them, and we haven't covered this subject when looking at Linux LVM yet). It's fairly short and simple, but this is a "Lazy Sunday" :)

If you need help with some of the basic concepts of LVM, please check out our older post on getting started with LVM.

Happy, and hopefully Lazy, Sunday :)

AIX LVM Destruction commands:

Remove a logical volume:

host # rmlv MylogicalVolume

Remove a Volume Group (Note that, again it doesn't agree too much with the Linux or HP versions, we're just turning off the volume group to destroy it):

host # varyoffvg VolumeGroupName

De-Allocate a Physical Volume (Note that Physical Volumes, in AIX, already exist - they just need to be allocated to Volume Groups):

There is no specific pv command for this operation. PV allocation and de-allocation actually, for better or worse, happen as a result of the vg and lv destruction commands. However, you can do the following to "destroy" the device:

host # rmdev DEVICE

, Mike

Chris Gibson wrote in with these additional helpful comments. Thanks, Chris!

With regard to "Removing a volume group", I use this procedure:

# umount //datafs
/# rmfs //datafs/
# varyoffvg /datavg/
# reducevg datavg /hdisk2 hdisk3 hdisk4/

Reducevg will remove the volume group from the ODM.

Then I can remove the hdisk devices:

# rmdev -dl /hdisk2/
# rmdev -dl /hdisk3/
# rmdev -dl /hdisk4/

Also, if you want to move the VG to another system (or just temporarily remove the VG definition from the system), I use:

# varyoffvg /datavg/
# exportvg /datavg/

I can import it again later on the same or different system using:

# importvg -y /datavg hdisk2 hdisk3 hdisk4/

And one last comment, when I remove an LV I usually want the associated FS to be removed also, so I do:

# rmfs/ /datafs/

This will remove the file systems and the underlying logical volume.