Saturday, July 5, 2008

Using LVM on AIX Unix. Part One Of No More Than Two.

Hey there,

As you may recall, we just completed a short series of posts on using LVM on Linux and Unix. At the time that I wrote it, I made mention (probably several times) of the similarities between LVM for Linux and HP-UX's brand. Also at that time, since I had hardly any experience with AIX, I was completely unaware that LVM was being used on that operating system.

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

Now, I think I'm not allowed to get "too" excited about this, since this blog is mostly about Linux flavours and Solaris Unix (peppered with a little HP and one old post on AIX commands for the Unix user), but I thought I'd put this little series of posts (possibly not in totally sequential order -- Sometimes things come up that I'm compelled to write about ;) up for the AIX enthuisast who is thinking of using, or just beginning to use, LVM on AIX.

I hope this post is helpful to you. In any event, it should make for a good reference and might possibly be useful "later" :) Today, we'll look at LVM creation and display/monitoring commands for AIX and our next post will be on usage and destruction! Please note that all examples are mocked up and any variable that starts with Optional (such as OptionalVolumeGroupName) is an argument that you don't necessarily need to pass to the command.

Enjoy :)

AIX LVM Creation commands:

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

host # lsvpcfg <-- To show the disks/vpaths and any Volume Groups they may already be associated with.
host # lspv|grep None <-- To show available Physical Volumes
host # cfgmgr <-- Use this interactively to allocate the Physical Volume for use with LVM.

Create a Volume Group:

host # mkvg -y VolumeGroupName HardDiskNumber <-- You can get the hard disk number from the lsdev command
host # varyonvg VolumeGroupName

Create a logical volume within a volume group:

host # mklv -y LogicalVolumeName -t FileSystemType VolumeGroup PhysicalPartion(PP) OptionalSpecificHardDriveDefinition
Ex:
host # mklv -y MylogicalVolume -t jfs MyVolumeGroup 8 <-- Note that the PP size is in MB.
or
host # mklv -y MylogicalVolume -t jfs MyVolumeGroup 8 /dev/DiskName

AIX LVM Display/Monitoring commands:

List out information about physical volumes:

host # lspv OptionalPhysicalVolumeName

List out Physical Volume information by Hard Disk:

host # lspv HardDiskNumber

List out Logical Volumes Within a Physical Volume:

host # lspv -l HardDiskNumber

List out Physical Partitions within a Physical Volume:

host # lspv -p HardDiskNumber

List out information about volume groups:

host # lsvg OptionalVolumeGroupName

List out properties of logical volumes within a volume group:

host # lsvg -l VolumeGroupName

List out properties, including hard drives, within a volume group:

host # lsvg -p VolumeGroupName

List out properties of a logical volume:

host # lslv OptionalLogicalVolumeName

List out Logical Volumes within a Physical Volume:

host # lslv -l OptionalLogicalVolumeName

List out Logical Volumes by Physical Volume:

host # lslv -p OptionalPhysicalVolumeName

List out mirrored Logical Volumes:

host # lslv -m OptionalLogicalVolumeName

List out hard disks in a vpath (Virtual Path). Necessary after Physical Volume Allocation to ensure everything went ok:

host # lsvpcfg

List out Fiber Channel adapters:

host # lsdev -Cc adapter
host # scfg -vl Number of fiber channel card

, Mike