Posts Tagged ‘How to reorganize volume group’

Reorganize Volume Group What Is It And How To Do It?

Monday, April 13th, 2009

What is reorganization of a Volume Group and why its needed, is a bit confusing for the system administrators. Here in this article I am explaining it to make it easier for the reader.

Why Does Logical Volume Become Fragmented
A file system needs to be created on a Logical Volume to make it usable. When we run out of space on a File System, we have to add additional space to the Logical Volume, with which the file system is related. Now, Logical Volume’s space is increased by adding new Logical Partitions to it, which in turn point to Physical Partitions on Physical Volumes. Its not necessary that the Logical Partitions, which we are providing to a Logical Volume are close to its previous Logical Partitions. The very next Physical Partitions available on Physical Volume are assigned to Logical Partitions and those Logical Partitions are assigned to Logical Volume. As a result fragmentation occurs in a Logical Volume with time. This leads to performance issues later on.

What is Volume Group Reorganization
To get best performance from a Volume Group, its required that all the Logical Partitions within respective Logical Volumes must be contiguous. Or to say it more clearly, the Physical Partitions should be contiguous. For this purpose we need to reorganize the Volume Group. In this process, the Physical Partitions within Physical Volumes are assigned to Logical Volumes as per their characteristics. The net result is that the Logical Partitions point to Contiguous Physical Partitions within the Logical Volume.

Command Used To Reorganize A Volume Group
The command provided by Aix is reorgvg. The reorgvg command is used to reorganize the VG. The general format is:

reorgvg [-i] VG [LV1 LV2 LV3…]

-i: This option specifies that the input Physical Volumes comes from standard input. Only LVs within those Physical Volumes will be reorganized.
reorgvg my_vg lv2 lv5 lv9

This command is to reorganize Logical Volumes lv2, lv5 and lv9 within Volume Group my_vg.

If you want to specify that Physical Partitions from particular Physical Volumes only should be reorganized then you give command:

echo “hdisk2 hdisk3″ | reorgvg my_vg lv2 lv5 lv9

Now, whichever Physical Partitions related to lv2, lv5 and lv9 reside on hdisk2 and hdisk3, will be reorganized.

Things To Take Care About reorgvg Command
There are several things which should be taken care of while using reorgvg command:

  1. At least one Physical Partition should be free on Physical Volume. Otherwise command will fail.
  2. User should be either root user or system group member.
  3. if no arguments are given to reorgvg command, the whole Volume Group is reorganized.
  4. The reorganization flag of Logical Volume Should be set to Yes. Use:

    chlv –r lv   to do this, it’s not enabled.

What is The Limitation of reorgvg Command
The command has limitation that it does not recognize the placement of allocated Physical Partitions for striped Logical Volumes. As a result you may not run command on striped metaluns.

Is This reorgvg Command Disallowed Somewhere
Yes, The command is not allowed on snapshot Volume Group. Also the Volume Group should not be concurrent.

Tags: , , , , , , , , , , , ,
Posted in LVM | No Comments »