Thursday, 15 September 2011

Common AIX Commands 1.3


 
Volume Group Management
Each disk (PV) belongs to a Volume group (VG). A standard VG is a collection of 1 to 32 PVs (1 to 128 for a big VG). A PV can belong to only one VG. A maximum of 255 VGs can be defined per system.
When a VG is created, the PVs within the VG are partitioned into contiguous, equal-sized PPs (units of disk space). PPs are the smallest unit of allocatable storage space in a VG. The PP size is determined at VG creation (can't be changed dynamically afterwards), and all PVs that are placed in the VG inherit this size. The PP size can range from 1 MB to 1024 MB, but must be a power of two. If not specified at creation time, the default PP size for a VG is 4 MB for disks up to 4 GB (the minimum PP size needed is determined by the OS), but it must be larger for PVs greater than 4 GB due to the fact that the LVM, by default, will only track up to 1016 PPs/PV. The number of PPs/PV (1016) can be increased with a factor 1-16 (or 1-64 for a big VG) at creation time or later (which will reduce the number of PVs in the VG) and/or the number of PVs/VG can be increased from 32 to 128 at creation time or later (big or gigantic VG).
Importing a VG involves copying the VGDA data for the imported volume group into the ODM. When a volume group is exported, the data held in the ODM about that volume group is removed from the ODM database.

Displays information about VGs.
lsvg : lists all VGs.
lsvg rootvg : lists the characteristics of VG rootvg.
lsvg -o : lists only the active VGs (those that are varied on).
lsvg -p rootvg : lists the PVs in VG rootvg (state, size, distribution).
lsvg -l rootvg : lists the LVs in VG rootvg (type, size, state).
lsvg -M rootvg : displays a map of all LVs.
Queries the attributes of a VG using VG id, or PV name of a PV that is part of a VG.
lqueryvg -At -p hdisk0 : returns all attributes for the VG (static attributes, LV details and PV details).
Creates a VG.
mkvg -y datavg -s 32 hdisk2 hdisk4 : creates the VG datavg that contains PVs hdisk2 and hdisk4, with PP size set to 32 MB.
mkvg -B -y uservg : create a big VG uservg (supports 128 PVs and 512 LVs).
Sets the characteristics of a VG.
chvg -a{y|n} datavg : VG datavg is automatically activated (y=varyonvg) or not (n=varyoffvg) during system startup.
chvg -u datavg : unlock the VG datavg.
chvg -B datavg : changes the VG to big VG format (supports 128 PVs and 512 LVs). Mapping size is 4*original size.
chvg -t 2 datavg : changes the limit of the number of PPs/PV by factor=2 (1016*2=2032 PPs/PV). Which decreases the number of disks (#PVs/factor=16 PVs/VG).
chvg -sy datavg : attempts to automatically synchronize (AUTO SYNC) stale partitions in VG datavg (default this not done for a VG).
chvg -L256 uservg : changes the LTG size to 256KB of VG uservg for better disk I/O performance. LTG size should be less than or equal to the maximum transfer size of all disks in the VG. Check each disk in the VG with:
lquerypv -M hdiskx : checks the maximum supported LTG size of hdiskx.
chvg -b n datavg : turns off the bad block relocation policy of VG datavg (default is yes for a VG).
chvg -h y -s y uservg : sets policy in VG uservg to automatically (-h y) migrate PPs from one failing disk to one spare disk with automatic synchronization of stale PPs (-s y).
Synchronizes LV copies that are not current (stale).
syncvg -v datavg : synchronizes the copies on VG datavg.
syncvg -p hdisk3 : synchronizes the copies on physical volumes hdisk3.
Resynchronize the ODM. The VG must be active.
synclvodm rootvg : synchronizes the device configuration database with the LVM information for rootvg (use when the device configuration database is not consistent with the LVM information in the LVCBs and the VGDAs).
rvgrecover
Repairs the ODM.
Mirrors all the LVs that exist on a given VG.
mirrorvg -S -c 3 rootvg : triply mirrors VG rootvg, returns the mirrorvg command immediately and starts a background syncvg (-S).
mirrorvg -m datavg hdisk3 : creates an exact mapped mirror of the LVs in VG datavg.
Removes the mirrors that exist on VGs or specified disks.
unmirrorvg rootvg : default unmirroring of rootvg (rootvg now has only 1 copy).
Imports a new VG definition from a set of PVs.
It is highly recommended that you run the fsck command before you mount the file systems.
importvg -y datavg hdisk9 : imports VG datavg from PV hdisk9.
importvg -y uservg 0009898xy2727d4f : imports VG uservg from PV with PVID 0009898xy2727d4f.
importvg -L datavg : imports VG datavg and learns about possible changes. Use if the VG was not exported and used on another machine.
Exports the definition of a VG from a set of PVs.
exportvg datavg : removes VG datavg from the system.
Redefines the set of PVs of the given VG in the device configuration database.
Adds PVs to a VG.
extendvg datavg hdisk2 : adds PV hdisk2 to VG datavg.
Removes PVs from a VG. When all PVs are removed from the VG, the VG is deleted.
reducevg datavg hdisk3 : removes PV hdisk3 from VG datavg.
reducevg datavg 000005265ac63976 : removes PV using it's PVID 000005265ac63976 from VG datavg (use when a disk was removed without first running reducevg).
Reorganizes the PP allocation for a VG. Using the reorgvg command with the VG name and no other arguments reorganizes only the first LV in the VG.
reorgvg datavg lvdata1 lvdata3 : reorganizes LVs lvdata1 and lvdata3 on VG datavg.
Recreates a VG (with unique IDs, names, and mount points) on a set of disks that are mirrored from another set of disks. Imports and varies on the VG. Procedure after the real duplication of the PV (like mirroring):
chdev -l hdisk5 -a pv=clear : to avoid potential collisions of LVM component names (PVID, VGname, ...) of hdisk5.
recreatevg -y newvg -L /newfs -Y newlv hdisk5 : newvg is the newly assigned VG name, /newfs and newlv are used for prefixes of the newly assigned file systems and LVs, and hdisk5 is the duplicated target PV name.
Splits a single mirror copy of a fully mirrored VG.
splitvg -y snapvg -c 2 datavg : splits second mirror copy of the VG datavg and creates snapshot VG snapvg.
joinvg datavg : joins the the original VG datavg with the snapshot VG snapvg.
Deactivates a VG.
varyoffvg uservg : deactivates the VG uservg.
Activates a VG.
varyonvg -f datavg : used to force a varyon on VG datavg even when inconsistencies are detected (between the configuration data for each VG held in the ODM database and VGDA.
varyonvg -r uservg : varies on VG uservg in read-only mode.

2 comments:

  1. Sir Obaid,

    Thanks for you knowledge sharing....

    Regards,
    Zaman

    ReplyDelete
  2. Its My pleasure to share this information with a techno master like u

    ReplyDelete