Saturday, May 21, 2011


AIX AND P-SERIES INTRODUCTION.

 classification of computers based on the number of instructions that can be executed.are:-

1. Complex instruction set computers (CISC)
                                         2. Reduced Instruction set computers (RISC)

Comparison  RISC VS CISC( which is best)

the Performance Equation
 a computer's performance ability is calculated by following equation:


The CISC  tries to minimize the number of instructions per program, sacrificing the number of cycles per instruction.
                                        RISC does the opposite, it reduces the cycles per instruction at the cost of the number of instructions per program.


RISC system has fewer instructions and are faster and reliable.



IBM has the following series of systems

x series – intel based systems
z series – Mainframe systems
i series – AS/400 systems
p series – RISC systems


IBM introduced RISC System (RS/6000) in 1986. 

Performance Optimized With Enhanced Risc (POWER) system was introduced in 1990
Which was the starting of the pseries.


Power 2 was introduced in 1993 
                                        power 3 in 1999. 
                           power 4 in 2000



Power 5 : p510,p520,p550,p570, p575, p590, p595


LOGICAL VOLUME MANAGEMENT

The fundamental concept used by lvm are
1.physical volume
2.volume group
3. physical partition
4.logical volume
5.logical partitions
6. filesystems
7. raw devices


each individual disk drive is named as physical volume such as hdisk0,hdisk1.

one or more pv's can make up  a volume group(VG). a pv can belong to maximum of one vg
you can't assign a fraction of pv to one VG




physical volumes can be assigned to the same VG even though they are of different type such as SCSI or SSA.


The storage space from physical volume is divided into physical partitions(PP's)
                                      the size of PP's are identical on all disks belonging to the same VG.


Within each VG ,one or more logical volume(LV) can be defined.
                                                           Data stored on logical volumes appears to be contiguous from user point of view ,but can be spread on different pv from the same VG.


Each LV consists of one or more logical partitions(LP's). Each logical partitions corresponds to atleast one
physical partition(PP).


If mirroring is specified for  the logical volume,additional  pp's are allocated to store the additional copies of each logical partitions.


LOGICAL VOLUME MANAGER


the set of operating system commands,library subroutines and other tools that allows you to eastablish and control logical volume storage is called the logical volume manager(LVM).


LVM controls disk resources by mapping data between a more simple and flexible logical view of storage space and the actual physical disks.


LVM CONFIGURATION DATA


The data that describes the components of the LVM  is kept in several places:


1. ODM database
2.Volume Group Descriptor Area(VGDA)
3.Volume group Status Area(VGSA)
4. Logical Volume control block


1.ODM DATABASE


The ODM database is the place where most of the aix system configuration data is kept.


the ODM database contains information about all
PV
LV
VG
this information mirrors the information found in the VGDA.


the process of importing a VGDA involves automatically copying the VGDA data for the imported VG into ODM.
           when the VG is exported ,the data held in the ODM about the VG is removed from ODM database.


ODM data also mirrors the information held in the logical volume control block(LVCB).




2. VOLUME GROUP DESCRIPTOR AREA(VGDA)


TheVGDA located at the beginning of each pv ,contains the information that describes
1. all logical volumes that belongs tp that particular VG
2. all physical volumes that belongs to particular VG


VGDA makes each VG self-describing.


An AIX system can read the VGDA kept on the disk and can determine which PV and LV are partof that particular VG.


Each disk has atleast one VGDA


VGDA is allocated when the disk is assigned as a PV(mkdev command). This reserves a space for the VGDA at the start of the disk.


Actual volume group information is placed in the VGDA when the PV is assigned to the VG.




3.VOLUME GROUP STATUS AREA(VGSA)


the VGSA contains  state information about physical partitions and physical volumes.


VGSA knows if one PV in a VG is unavailable.




Both the VGDA and VGSA have beginning and ending timestamps. these timestamps enables the LVM to identify the most recent copy of the VGSA and VGDA .


LOGICAL VOLUME CONTROL BLOCK(LVCB)


LVCB is located at the start of every logical volume .it contains information about the logical volume and uses a few hundred bytes.


"getlvcb" command displays the information held in LVCB


#getlvcb -AT hd2




DISK QUORUM.


each physical disk in a VG  has atleast one VGDA/VGSA.


the no. of VGDA'S contained on a single disk varies according to the no. of disks in the VG.






1.  single disk in a VG   ---------- Two VGDA on one disk
2.  Two PV in a VG  -------------- two VGDA on the first disk , one on the second disk.
3.  three or more PV in a VG --------  one VGDA  on each disk.




A QUORUM is a state in which 51% or more of the PV in a VG are accessible.


it is a vote of a no. of VGDA and VGSA that are active.


quorum ensures data integrity in the event of disk failure.


when quorum is lost,the VG varies off itself so that the disks are no longer accessible by the LVM.
this prevent further disk I/O to the volume group so that data is not lost or assumed to be written when there is physical problems.


also as the result of varyoff,the user is notified in the errorlog that a hardware error has occured and service must be performed.


PHYSICAL VOLUME


when a disk is initially added to the system,it seems to be simple device. that disk is not yet accessible for LVM operations.


to be made accessible ,it has to be assigned to the volume group.


For each disk , two device drivers will be created under the /dev directory
1. one block device driver
2. one character device driver.


each disk drive is assigned a 32-bit unique identifier that is called PVID.
PVID are stored on ODM.


 change the available disk device to the PV by assigning  a PVID
#chdev -l hdisk7 -a pv=yes


to clear the PVID from physical volume
#chdev -l hdisk7 -a pv=clear




listing information about physival volume


#lspv  ----list all PV'S ,there PVID ,VG and the status of VG  of which the disk is the member.


#lspv hdisk2 ---to list the attributes of that particular PV




# lspv hdisk2


PHYSICAL VOLUME: hdisk2                     VOLUME GROUP: testvg
PV IDENTIFIER: 00c478de09caf37f         VG IDENTIFIER  00c478de00004c00000001078fc3497d
PV STATE: active                                          STALE PARTITIONS: 0
ALLOCATABLE: yes                                   PP SIZE: 128 megabyte(s)
LOGICAL VOLUMES: 1                             TOTAL PPs: 546 (69888 megabytes)
VG DESCRIPTORS: 2                                 FREE PPs: 542 (69376 megabytes)
HOT SPARE: no                                          USED PPs: 4 (512 megabytes)
MAX REQUEST: 256 kilobytes
FREE DISTRIBUTION: 110..105..109..109..109
USED DISTRIBUTION: 00..04..00..00..00


the important  parameters that we can change in above outputs:
 1.allocatable
2. pv state
3. hot spare






#lspv -l hdisk0 --- to display the names of all logical volumes that have atleast one partitions located on hdisk0



# lspv -l hdisk0
hdisk0:
LV NAME   LPs    PPs    DISTRIBUTION      MOUNT POINT
hd3              1          1        00..00..01..00..00        /tmp
hd10opt       1          1        00..00..01..00..00        /opt
hd5              1          1        01..00..00..00..00       N/A
hd8              1          1       00..00..01..00..00        N/A
hd6             11        11      00..00..11..00..00        N/A
hd2             8          8        00..00..08..00..00        /usr
hd9var        1          1         00..00..01..00..00       /var
hd1             1          1        00..00..01..00..00       /home
hd4             1          1        00..00..01..00..00       /




#lspv -p hdisk1 ------to display the pp range ,state and the LV that corresponds tp that PP'S and there mountpoints.



# lspv -p hdisk0
hdisk0:
PP RANGE      STATE    REGION    LV NAME      TYPE        MOUNT POINT
1-1                    used        outer edge       hd5              boot           N/A
2-110                free         outer edge
111-219            free         outer middle
220-220            used        center                hd8            jfs2log          N/A
221-221            used        center              hd2               jfs2              /usr
222-222            used        center              hd3               jfs2              /tmp
223-223            used        center              hd10opt        jfs2              /opt
224-230           used         center             hd2                jfs2             /usr
231-241           used          center            hd6                paging         N/A
242-328           free           center
329-437           free           inner middle
438-546           free           inner edge






#lspv -M hdisk0

to display a detailed map of the disk and to display the relationship between each PP and LP.


# lspv -M hdisk0|more
hdisk0:1                hd5:1
hdisk0:2-110
hdisk0:111           lv1:1:1
hdisk0:112           lv1:2:1
hdisk0:113           lv1:3:1
hdisk0:114            lv1:4:1
hdisk0:115           lv1:5:1
hdisk0:116          lv1:6:1
hdisk0:117          lv1:7:1
hdisk0:118          lv1:8:1
hdisk0:119          lv1:9:1
hdisk0:120         lv1:10:1
hdisk0:121         lv1:11:1




CHANGING THE CHARACTERSTICS OF PV

1.changing the allocation permissions for PV


              the allocation policy for a PV determines whether the free PP'S on that PV can be further allocated to logical volume or not.

to disable the partition allocation for a PV

#chpv -an hdisk2

check for the line in output
allocatable = no

to enable the allocation permission for a PV
#chpv -ay hdisk

check for line in output
allocatable=yes

2. changing the availability of PV


availability of a PV defines whether any logical I/O operations can be performed to a specific PV.

#chpv -vr hdisk3 ------to make disk unavailable

output
check
pv state = removed.

#chpv -vy hdisk3 -----------to make disk available

check the output
PV state = active

#chpv -c hdisk1 ----------for clearing the boot record from disk.

3. Declaring a PV hotspare
if you are assigning a disk as hotspare ,the allocation permission will also get disabled for that particular PV

#chpv -hy hdisk3 ---------defines hdisk3 as hotspare

#chpv -hn hdisk3 --------------to remove hdisk3 from hotspare pool.

MIGRATING DATA FROM PV

physical partitions located on a PV can be moved to one or another PV contained in the same VG.

here we are moving data from hdisk1 to hdisk5

step 1..   check that that PV belongs to which VG

                     # lspv hdisk2

                          check the parameter VG

                     #lsvg -p <vg-name>  ---------it will list the PV's in that particular VG .

step2      check the mapping of all pp's on both the disks
                     #lsvg -M hdisk1

and                #lsvg -M hdisk5

step 3 --   check the used pp in hdisk1 and free pp,s in hdisk5
   
                   *the free pp's on hdisk5 must be greater than used pp's in hdisk1 then only data migration is                           possible.for that use commands

                         #lspv hdisk1

                               check in output  for used pp's here

                                #lspv hdisk5

                                  check  in output for free pp's here .

step 4 ----if everything os ok till now then use "migratepv" to migrate the data from hdisk1 to hdisk5.

                         #migratepv hdisk1 hdisk5 


:--- it is possible to migrate only data from partitions that belongs to a specific logical volume.

#migratepv -l testlv hdisk1 hdisk5

here we are migrating the data of LV testlv from hdisk1 to hdisk5.

VOLUME GROUP

when the AIX operating system is installed , one volume group named"rootvg" is created by default.

* All PV will be divided in PP'S having same size.the size of PP'S can't be changed after the VG is created.

CREATING A VOLUME GROUP

volume group can be created using "mkvg" command.
Each volume group is assigned an volume group identifier(VGID).

#mkvg -y vg1 hdisk4

this command creates a vg named "vg1" on physical volume "hdisk4".

#mkvg -y vg2 -s 64 -V99 hdisk5

this command creates a VG named "vg" with PP size=64mb and having major number 99 using hdisk5.


mkvg command by default creates a VG that can accommodate

255  LV'S
32  PV'S


VG is of three types
1. normal vg
2. big vg
3. scalable vg

vg type                    max. lv       max. pv       max. pp size

normal vg                256              32                1GB

big vg                     512               128              1 GB

scalable VG            1024             4096           128 GB



creating a big vg

#mkvg  -B -y bigvg -s 128 -V101  hdisk2 hdisk3 


here , -B option is used to create big vg

creating a scalable vg

#mkvg -S -y  scalvg  -s 1G  -f  hdisk1 hdisk2 hdisk3 hdisk4 

here -S option is used to create scalable vg.

listing information about VG

"lsvg" command list the information about the vg

#lsvg ------displays all  known vg's

#lsvg -o ----------lists the active vg's

#lsvg testvg  -------list the attributes of testvg

#lsvg -l rootvg  --------displays all logical volumes in rootvg
#lsvg -p rootvg ---------displays all physical volumes in rootvg
#lsvg -M rootvg -------- shows mapping of PP's in rootvg

Changing the characteristics of VG

1. auto varyon flag

to change the VG to be activated automatically the next time the system is restarted
#chvg -ay newvg

#chvg -an newvg  ---to disable autovaryon flag

. Quorum

#chvg -Qn newvg ----- to disable quorum
#chvg -Qy testvg -------  to enable quorum

3.changing the hotspare policy
to improve data availability one or more disk can be assigned as hotspare

#chvg -hy testvg  ----enabling the hotspare policy

#chvg -hn testvg  --disabling the hot spare policy

we can use this hotspare disk for migrating the data from the failing disk.

4. changing the synchronization policy

synchronization policy controls the automatic synchronization of stale partitions within the VG.

#chvg -sy testvg ----- enabling the synchronization policy

check in output the parameter
auto-sync=yes

#chvg -sn testvg ----- disabling the synchronization policy

after running this command check whether the policy has been set. using
#lsvg testvg

check in the output the parameter
auto-sync =no
5. changing the max. number of logical volume

#chvg -v 4096 testvg

if i am giving this command for normal vg it will through error since max. LV in normal VG is 256.but if testvg is scalable this command will work.

so kindly check the type of the VG and the max LV that can be created in that VG.

6. unlocking a VG

A  volume group can become locked after an abnormal termination of LVM commands

to remove the lock
#chvg  -u testvg

EXTENDING A VG

you can increase the space available in a VG by adding a new physical disk.

Before adding the disk ,ensure that disk is in available state

the PV which is going to be added shouldn't be member of other VG.

#extendvg testvg hdisk2

this command adds hdisk2 to the vg "testvg"

if you are getting any error try with forcefully  "-f" flag

#extendvg -f testvg hdisk2

REDUCING A VG
reducevg command is used to remove a physical disk from a volume group.

VG should be varied on .

when you remove the last physical volume from the vg , the vg will automatically be removed.

#reducevg testvg hdisk7
#reducevg -f testvg hdisk3
here -f is for forcefully

#reducevg -d testvg hdisk4

RESYNCHRONIZING THE ODM

the "synclvodm" command can be used to synchronize or rebuild information from ODM,device files and LVM metadata structure such as VGDA OR LVCB.

#synclvodm testvg


EXPORTING A VG

there are situations when all data from a VG needs to moved from one system to another system.
"exportvg" command will only  remove VG definition from the ODM and doesn't delete any data from physical disks.
it clears the stanza from"/etc/filesystems" .

you can't export a VG that contains an active paging space.

#varyoffvg testvg
#exportvg testvg

IMPORTING A VG
Importing a disk means recreating the reference to the VG data and making data available.

#importvg -y testvg hdisk4
An imported VG is automatically varied on.

you can also change the VG name also while importing
suppose i want to rename testvg as abhivg while importing testvg
#importvg -y abhivg hdisk3


SYNCHRONIZING A VG

"syncvg" command is used to synchronize the stale partitions

#syncvg -vf testvg --- it synchronizes the testvg
#syncvg -p hdisk4 hdisk5 ---  itsynchronizes the physical disk hdisk4 and hdisk5.


MIRRORING ROOTVG


step 1
check how many disk is there in rootvg
#lsvg -p rootvg
output :
hdisk0


step2
add another physical disk to rootvg. kindly check the size and pp size . that should be same for both disk.
#extendvg rootvg hdisk1


step3
use the mirrorvg  command to mirror the vg
#mirrorvg rootvg


step4


to make the disk bootable ,create the bootable image using bosboot command.
#bosboot -ad /dev/hdisk1


step5
modiffy the bootlist so that if system is not able to boot using hdisk0 it will boot using hdisk1


#bootlist -m normal hdisk0 hdisk1 


to check whether the vg has been mirrored or not, run
#lsvg -l rootvg


here in output pp's are double of lp's then Vg is mirriroed.



important point 
Disk mirroring can improve the read performance of a system, but at a cost to the write performance. 
 Of the two mirroring   strategies, parallel and sequential, parallel is the better of the two in terms of disk i/o.

how exportvg command works 

                    exportvg command is that is mostly a pure ODM related command. It does not affect the physical VGDA that sits on a disk platter. When running exportvg, it first checks to make sure the volume group has been varied off. If the volume group is not varied off first, the exportvg will fail.
                                                                                              When an exportvg is
run, First, exportvg finds all the disks associated with a volume group. Next, it    finds all the logical volumes associated with that volume group. After the logical volumes are discovered, the potential  mount points associated with the logical volumes are noted.
exportvg first deletes /etc/filesystems entries associated with logical volumes with filesystems. After this is done, the /dev  special files are removed, and then the ODM has all entries associated with the volume group deleted from the ODM database. 

           note that during this time, there was no action upon the volume group and the disk platters that make up the volume group.


 

 


PAGING SPACE IN AIX

               INTRODUCTION           

A paging space  also called as swap space is a logical volume with the attribute type set to paging.

when the amount of free space in the system is low ,programs or data that have not been user recently are moved from real memory to paging space to release real memory for other activities.

A page is a unit of virtual memory that holds 4kb of data and can be transferred between real and auxillary storage.

In AIX,  all the paging space is controlled by the virtual memory manager(VMM)

The VMM  is always scanning the memory for the oldest and least used processes in memory.

When real memory runs low,the VMM will page out this least used memory page to the paging space on disk. when the page frame is needed again,it is paged in by the VMM to run again.

ADDING A PAGING SPACE

to list the real memory in your system.

#lsattr -El sys0 | grep realmem
or
#bootinfo -r
or 

# prtconf -m

For adding paging space to the system you can use

#smit mkps

or
#mkps -a -n -s8 rootvg hdisk1

here,following command will create paging space on hdisk1  that is of 8LP'S in rootvg  and will be actvated immediately and on all subsequent system restart.

here options
-a = paging is configured at subsequent restarts.
-n= activates the paging space immediately.

for creating the NFS paging space
#mkps -t nfs <nfs-server hostname>   <server-file name>

this command creates an NFS paging space on the nfsserver where the server has the <server file name> exported.

DISPLAYING PAGING SPACE USAGE

#lsps -a
it displays characterstics of all paging spaces.here sizes are in mb.
#lsps -c = to list in  colon format.
#lsps -S = summary characterstics of all paging space.


ACTIVATING AND DEACTIVATING PAGING SPACES

for paging spaces to be user,it must be activated.

All paging spaces`are defined in /etc/swapspaces

#swapon -a = for activating all paging space once
#swapon /dev/paging00 = for activating paging /dev/paging00 only

#swapoff  /dev/paging01 = to deactivate the  /dev/paging01


REMOVING THE ACTIVE PAGING SPACE

before removing the paging space from the system,it should be de-activated

#swapoff /dev/paging03
#rmps paging 03


INCREASING PAGING SPACE

#chps -s 3 hd6 

increases`the size by 3 lp's

REDUCING THE PAGING SPACE

you can dynamically reduce the size of  a paging space,including hd6

if you decrease the size of the primary paging space, a temporary boot image and a temporary /sbin/rc.boot poinitng to the temporary primary paging space will be created to make sure the system is always in a state where it can be safely rebooted.

#chps -d 1 hd6

reduces`the size of hd6 by 1 lp


MOVING THE PAGING SPACE WITHIN SAME  VG

moving a paging space (including hd6) from the default location to a different disk within the same VG doesn't require reboot.

#migratepv -l hd6 hdisk0 hdisk1
this command moves the hd6 from hdisk0 to hdisk1 with the same vg.

UNIX -finding docmuntation


Almost every program written for Linux has a man page.
info pages tend to be more verbose than man pages and are hyperlinked.

#man <command-name>
#info <command-name>
you will get all details of the options that can be used with that command.

ex:
#man ls

for finding the command having a particular keyword  in unix ,you can use
$ man -k listing
$ apropos listing

UNIX

Unix  is a multitaskingmulti-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken ThompsonDennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna.