Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Sunday 5 January 2014

AIX LVM Concept

 


Components Of AIX Storage System



As a front user, we always work on Files and Directories. But as we also work as System Admin, we have to work with Physical Storage, Logical Storage and File System. These thing are manage with help of Logical Volume Manager i.e LVM

Definition of  LVM :  Set of commands and other tools that allow user to create and manage Logical Volume Storage.

  • LVM helps in storing data on logical volumes across multiple physical volumes (Physical volume is also called Physical hardisk)
  • Non Contiguous data on physical volume appears to be contiguous on logical volumes.
Advantages of Using LVM:
  • Data Integrity
  • Mirroring of LV can be done
  • Speed
  • Flexibility  in term of expansion, deletion.
  • LV size can be increase on demand.
  • Size of file system can be increaed or decreased as per application requirement.
Comman Terms used in LVM:
  • Physical Volume (PV)       : Physical hard disk which we can see and touch.
  • Volume Group    (VG)       : Two or more group of Physical hard disk forms Volume Group.
  • Physical Partition (PP)      : Data on PV is store in small unit of equal size called PP
  • Logical Partition (LP)        : Data on LV is store in smaller unit called LP
  • Logical Volume (LV)         : Creating Logical layer (i.e group of LP) on VG.
  • Volume Group Descriptor Area:  Small storage area on each PV of a VG which contain information about the Volume Group






Types of Volume Group: There are three type of Volume group present. By default if we are using SMIT for making Volume Group then Original VG is created.





Points to keep in Mind
  • Size of LP is equal to that of PP. Higher the number of PP's allocatd, lower is the performance.
  • LP and PP are always configure in 1:1,  1:2,  1:3  ratio (respectively) depending upon the requirement of application mirroring done.
                                                  LP     :   PP
                                                    1     :    1
                                                    1      :   2
                                                    1      :   3
  • Mirroring of data is done in order to increaese the DATA AVAILABILITY but the performance is reduce.
  • A mirror LV is slower in perfomance as compared to unmirrored LV as the data is written in 2 or 3 place.
  • Maxium we can make only 3 copies of same data.

Volume Group Commands


We can used both SMIT or command for creating Volume group, LV etc

SMIT : System Management Interface Tool 
  • It provides menu driven interface that provides access to most of common system management function within one consistent environment.

  1. #smit lvm : It will give four options. Move the cursor to desire item and press Enter.
      • Volume Group
      • Logical Volume 
      • Physical Volume
      • Paging space
  2. #smit mkvg   or  mkvg -y : Used to create a Vg
             Example:     mkvg -y  testvg1 hdisk1 hdisk2          Its Original Vg
                                mkvg -S  testvg1 hdisk1 hdisk2         Its Scalable Vg
              
     3.  #lsvg   or  #lsvg -o    or   #lsvg    : List all the volume group

            Example:     lsvg                                                    It will give all the Vg in the system.
                               lsvg -o                                               Show all the active VG.
                               lsvg rootvg                                        Give details about the rootvg.
                               lsvg -p rootvg                                    Gives all physical hdisk in the rootvg.
                               lsvg -l rootvg                                     Gives details about logical volume

     4.  #smit chvg   or    #chvg < attribute value >  < VG name>  : Used to change the properties of VG

            Example:     chvg -a y -Q y datavg                       It will activate and QUORUM is set.


      5. #extendvg -f   < hdiskn >  :We can add extra hdisk to volume group using this comd.

            Example:     extendvg -f rootvg  hdisk3                 It will add hdisk3 to rootvg 
                               lsvg -p rootvg                                   It will show the all hdisk of rootvg

     6.  #reducevg -f   : We can remove a hdisk from a volume group.

            Example:     reducevg -f rootvg hdisk3                  It will remove the hdisk3 from rootvg.
                               lsvg -p rootvg                                   We will not able to see hdisk3
                                            
                               reducevg -df rootvg hdisk3               We are deallocating the hdisk3 for vg

     7. #smit varyonvg    or     varyonvg     : To activate the Volume group

            Example:     varyonvg datavg                               Datavg will be online and we can used it

    8.  #smit varyoffvg   or   varyoffvg     :  To deactivate the Volume Group

            Exmple:      varyoffvg  datavg                              Datavg will be offline and we cannot used it
  
     9.  #smit exportvg  or    exportvg   : If we are having volume group on one or more external disks that we want to access on another system, we must first export the volume group from the current system using the exportvg command. This will remove all the information about volume group from the system. To export a volume group,it must be inactive 
  
            Example:   exportvg datavg                              It will remove the entry from the system

   10.  #smit importvg    or   importvg  -y : To access an exported volume group on a system, it must be imported to the system using the importvg command. Never attempt to import rootvg

           Example:   importvg  -y  datavg  hdisk3          It will make the entry on other system.

Logical Volume Commands

  • #smit  lv : This will show the various options related to Logical Volume. It include following these options.
        • List All Logical Volume by Volume Group.
        • Add a Logical Volume.
        • Set characteristic of a Logical Volume
        • Shown characteristic of a Logical Volume.
        • Remove a Logical Volume.
        • Copy a Logical volume.
           Select above mention options and press Enter to continue.

  • Adding a Logical Volume:
    • #smit  mklv      or
    • mklv -y -t -c
         Example:  mklv -y testlv -t jfs2 -c 2 testvg 10 hdisk2 hdisk3
    • The name of logical volume can be specified or a system generated name is userd.
    • The volume group the logical volume belong to and the size must be specified
      •  : This factor decide the size of LV.
  • Show LV characteristic:
    • lslv       : Show details of LV
    • lslv  -l   : Show the PV to which LV belong.
  • Show the LP to PP relationship on the disk :
    • lslv -m    : It will shown the LP to which PP it is mapped.
           Example:   #lslv  -m  testlv
                             testlv :N/A

  • Reorganizing logical volume in a volume group
    • # reorgvg  
              Example :  reorgvg  testvg  hd2 hd4
    • reorgvg command is used to redistribute the PP of the LV of a VG according to their preferred allocation policies.

  • Add copies to a Logical Volume
    • smit mklvcopy
    • #mklv  -k  
            Example:    mklvcopy -k  testlv  3  hdisk4

    • mklv command is used to add up to 3 copies to a logical volume
    • We should synchronizing the LV so that we get a consistence data.
      • It can be done using   -k   option while creating the copies
      • or   syncvg command in order to synchronize it later.

  • Increasing the size of a Logical Volume :
    • smit extendlv
    • #extendlv    
           Example:     extendlv  testlv  20                    : It will add 20 PP to LV.

  • Remove a logical volume :
    • smit  rmlv
    • #rmlv -f  

  • List all the logical volume by volume group :
    • lsvg -o  |  lsvg -il      

  • Mirroring volume group :
    • smit mirrorvg
    • mirrorvg    
      • mirrorvg command takes all the logical  volume on a given volume group and mirror those logical volumes
      • Same thing can be done using mklvcopy command for each individual logical volume present in a volume group
      • Before mirroring, target disk should be the part of volume group ( Use  extendvg testvg hdisk9)
      • While doing mirroring,we have to do synchronization of mirror.
      • Use  -S ( background Sync)  or  -s  (disable sync) options.
      • If we are having only two disk in a volume group to be mirror, Keep Quorum Checking On should be false 
  • Mirroring rootvg : Steps involves


      1. Add the target hdisk to rootvg before mirroring
          • extendvg rootvg hdisk3 
      2. Create a mirror for rootvg
          • mirrorvg -S rootvg hdisk3
      3. Create a boot image on mirrored disk,using bosboot command.
          • bosboot -ad /dev/hdisk3
      4. Add the newly mirrored to the bootlist
          • bootlist -m normal hdisk0 hdisk3
      5. Shutdown and reboot the system ( not required with AIX6 and later)
          • shutdown -Fr 



Physical Volume Commands

  • Physical Volume ( PV )  : It can be hard disk, a virtual disk or a LUN
  • Physical Partition ( PP )  : Smallest unit of allocation on a Physical disk
    • PP is a fixed size , contiguous set of bytes on a PV
    • PP must be same across an entire volume group.
    • Each Volume group can have different size of PP

  • Menu for Physical Volume in SMIT
    • smit pv    : It will show following options. Choose one and press enter to continues
      • List all Physical Volume in System.
      • Add a disk
      • Change characteristic of a Physical Volume
      • List Content of a Physical Volume
      • Move Content of a Physical Volume

  • To list the physical volume information.
    • lspv               : It will display all the physical volume present in the system
    • lspv hdisk3    : It will show the properties for hdisk3

  • To list  all the logical volume on a physical volume:
    • lspv  -l  hdisk3  : It will show all the logical volume present on physical hard disk 3

  • To list a physical volume partition map
    • lspv  -p  hdisk0


  • To Add or Move the content of Physical Volume
    • Disk are configure to AIX through Configure Manager  ( or run cfgmgr )
    • To move the contents of a physical volume
      • # migratepv  -l    
      • Example      migrate -l  testlv  hdisk0  hdisk7

    • migratepv command can be used to 
      • move  paritions from  selected physical volume to other physical volume in same volume group

No comments:

Post a Comment