Saturday 28 December 2013

Practical Guide to AIX "Volume Group Management"

Folks I am going to discuss about practical examples and real time usefull commands about AIX Volume Group Management.


Contents:


1)Volume Group Creation:

mkvg -y <vg> -s <PP size> <pv>  (normal volume group)
mkvg -y datavg -s 4 hdisk1

Use below options to creat Big & Scalable volume groups.

-B Creates a Big-type volume group
-S Creates a Scalable-type volume group.

Note: the PP size will be the size of the physical partition size you want  1, 2, (4), 8, 16, 32, 64, 128, 256, 512, 1024MB

2) List/Display Volume Group:

lsvg
lsvg <vg> (detailed)
lsvg -l <vg> (list all logical volumes in goup)
lsvg -p <vg> (list all physical volumes in group)
lsvg -o (lists all varied on)
lsvg -M <vg> (lists all PV, LV, PP deatils of a vg (PVname:PPnum LVname: LPnum :Copynum))
lsvg -o | lsvg -ip        lists pvs of online vgs
lsvg -o | lsvg -il        lists lvs of online vgs
lsvg -n <hdisk>           shows vg infos, but it is read from the VGDA on the specified disk (it is useful to compare it with different disks)

## Details volume group info for the hard disk
lqueryvg -Atp <pv>
lqueryvg -p <disk> -v (Determine the VG ID# on disk)
lqueryvg -p <disk> -L (Show all the LV ID#/names in the VG on disk)
lqueryvg -p <disk> -P (Show all the PV ID# that reside in the VG on disk)

3)Extending Volume Group:

#extendvg <vg> <pv>
#extendvg myvg hdisk5

4)Reducing Volume Group:

#reducevg -d <vg> <pv>
## removes the PVID from the VGDA when a disk has vanished without using the reducevg command
#reducevg <vg> <PVID>

5) Mirror Volume Group:

We can do mirroring in AIX, using mirrorvg command and we can create max of three copy of mirror.

If we have two PV’s in rootvg, now we want mirror, Data and OS installed in hdisk0 and now we want to mirror hdisk0 to hdisk1. Then your command will be
# mirrorvg –S –m rootvg hdisk1

S – Backgroup mirror
-m - exact (force) mirror
NOTE: in mirrored VG quorum should be off line because quorum is not recommended for mirror.

6)Un-Mirror Volume Group: 

Using Unmirror command we can Unmirror the VG
#unmirrorvg rootvg hdisk1
PV hdisk1 is removed from rootvg mirror.

7)Synchronize Volume Group:

Using Syncvg command we can sync the mirrored Vg and LV copy information’s

If we want to sync lvcopy
#syncvg –l lvname

#syncvg –l testlv
After executing the above command, testlv copy get sync with lv copied PV

If we want to sync mirrored PV’s
#syncvg –v rootvg
The above sync the mirrored PV’s in rootvg

8) Un-Lock Volume Group:

# chvg -u <vgname>          unlocks the volume group (if a command core dumping, or the system crashed and vg is left in locked state)
(Many LVM commands place a lock into the ODM to prevent other commands working on the same time.)

9)Re-Organise Volume Group:

# reorgvg   <vgname>
rearranges physical partitions within the vg to conform with the placement policy (outer edge...) for the lv.
(For this 1 free pp is needed, and the relocatable flag for lvs must be set to 'y': chlv -r...)

10) VarryOn Volume Group:

This is just for VG activation; some times clients want to deactivate VG for project restriction. After that we want to activate the VG for further data access

Suppose we want to activate testvg, then you should follow like below
#lsvg
rootvg
datavg
testvg
The above command shows what are VG’s available
#lsvg –o
rootvg
datavg
The above commands shows only online(active)  VG’s because testvg is offline so we have to activate testvg using "varyonvg". This makes us enable to mount the filesystems which were created on top of the testvg.

#varryonvg testvg

#lsvg –o
rootvg
datavg
testvg
Now above command is display the testvg.

11)Varryoff Volume Group:

This is just for VG deactivation; some clients want to deactivate VG for project Restriction. Suppose customer want deactivate testvg then your command will be
#lsvg –o
rootvg
datavg
testvg

#varryoff testvg

#lsvg –o
rootvg
datavg
The above command displays only two online VG’s and it will not show testvg because testvg is offline VG.

12) Rename Volume Group:

#varyoffvg <old vg name>
#lsvg -p <old vg name> (obtain disk names)
#exportvg <old vg name>
#import -y <new vg name> <pv>
#varyonvg <new vg name>
#mount -a

13) Exporting Volume Group:

Using exportvg command we can export VG (including all the PV’s) from one server to another server.

If you have ServerA, in this server has datavg with two PV’s. Now we want export datavg to ServerB

Before exporting the datavg, we should Varryoff the datavg, i.e. datavg is moved to offline.
#varryoff datavg (Varryoff the datavg)
#exportvg datavg (VG information removed from ODM
Now datavg is exported from the ServerA, after this run the following command to verify the export.
#lsvg
It won’t show datavg name. Because datavg is exported.

Then you should remove PV from the configuration
#rmdev –dl hdisk3
#rmdev –dl hdisk4
After that we can remove the PV’s from ServerA for import datavg to ServerB.

14)Importing Volume Group:

Using importvg command we can import the datavg to ServerB

First you should connect hdisk3, hdisk4, in ServerB then, run the
#cfgmgr (for hard disk detection)
Then check the PV’s installed or not using lspv command
#lspv (it will display the installed PV’s) if hdisk3, hdisk4 is available then PV’s are configured properly.
Then run the command importvg for import the datavg
#importvg –y datavg hdisk3 (VG information is added in ODM)
#importvg –y datavg hdisk4 (VG information is added in ODM)
NOTE:If ServerB has VG with same name datavg, This case we can rename the importing VG datavg to other name,
#importvg –y newdatavg hdisk3
#importvg –y newdatavg hdisk4
Like this we can import.

After importing the datavg, we no need to Varryon datavg, automatically it will Varryon while importing.

15)Removing Volume Group:

#varyoffvg <vg>
#exportvg <vg>
Note: the export command nukes everything regarding the volume goup in the ODM and /etc/filesystems

16) Check Volume Group Type:

Run the lsvg command on the volume group and look at the value for MAX PVs. The value is 32 for normal, 128 for big, and 1024 for scalable volume group.
VG type     Maximum PVs    Maximum LVs    Maximum PPs per VG    Maximum PP size
Normal VG     32              256            32,512 (1016 * 32)      1 GB
Big VG        128             512            130,048 (1016 * 128)    1 GB
Scalable VG   1024            4096           2,097,152               128 GB
If a physical volume is part of a volume group, it contains 2 additional reserved areas. One area contains both the VGSA and the VGDA, and this area is started from the first 128 reserved sectors (blocks) on the disk. The other area is at the end of the disk, and is reserved as a relocation pool for bad blocks.

17)Changing Normal VG to Big VG:

If you reached the MAX PV limit of a Normal VG and playing with the factor (chvg -t) is not possible anymore you can convert it to Big VG.

It is an online activity, but there must be free PPs on each physical volume, because VGDA will be expanded on all disks:
root@um-lpar: / # lsvg -p bbvg
bbvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk2            active            511         2           02..00..00..00..00
hdisk3            active            511         23          00..00..00..00..23
hdisk4            active            1023        0           00..00..00..00..00

root@um-lpar: / # chvg -B bbvg
0516-1214 chvg: Not enough free physical partitions exist on hdisk4 for the
        expansion of the volume group descriptor area.  Migrate/reorganize to free up
        2 partitions and run chvg again.

In this case we have to migrate 2 PPs from hdisk4 to hdsik3 (so 2 PPs will be freed up on hdisk4):

root@um-lpar: / # lspv -M hdisk4
hdisk4:1        bblv:920
hdisk4:2        bblv:921
hdisk4:3        bblv:922
hdisk4:4        bblv:923
hdisk4:5        bblv:924
...

root@um-lpar: / # lspv -M hdisk3
hdisk3:484      bblv:3040
hdisk3:485      bblv:3041
hdisk3:486      bblv:3042
hdisk3:487      bblv:1
hdisk3:488      bblv:2
hdisk3:489-511

root@um-lpar: / # migratelp bblv/920 hdisk3/489
root@um-lpar: / # migratelp bblv/921 hdisk3/490

root@um-lpar: / # lsvg -p bbvg
bbvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk2            active            511         2           02..00..00..00..00
hdisk3            active            511         21          00..00..00..00..21
hdisk4            active            1023        2           02..00..00..00..00

If we try again changing to Big VG, now it is successful:
root@um-lpar: / # chvg -B bbvg
0516-1216 chvg: Physical partitions are being migrated for volume group
        descriptor area expansion.  Please wait.
0516-1164 chvg: Volume group bbvg2 changed.  With given characteristics bbvg2
        can include up to 128 physical volumes with 1016 physical partitions each.

If you check again, freed up PPs has been used:
root@um-lpar: / # lsvg -p bbvg
bbvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk2            active            509         0           00..00..00..00..00
hdisk3            active            509         17          00..00..00..00..17
hdisk4            active            1021        0           00..00..00..00..00

18)Changing Normal (or Big) VG to Scalable VG:

If you reached the MAX PV limit of a Normal or a Big VG and playing with the factor (chvg -t) is not possible anymore you can convert that VG to Scalable VG. A Scalable VG allows a maximum of 1024 PVs and 4096 LVs and a very big advantage that the maximum number of PPs applies to the entire VG and is no longer defined on a per disk basis.

!!!Converting to Scalable VG is an offline activity (varyoffvg), and there must be free PPs on each physical volume, because VGDA will be expanded on all disks.
root@um-lpar: / # chvg -G bbvg
0516-1707 chvg: The volume group must be varied off during conversion to
        scalable volume group format.

root@um-lpar: / # varyoffvg bbvg
root@um-lpar: / # chvg -G bbvg
0516-1214 chvg: Not enough free physical partitions exist on hdisk2 for the
        expansion of the volume group descriptor area.  Migrate/reorganize to free up
        18 partitions and run chvg again.


After migrating some lps to free up required PPs (in this case it was 18), then changing to Scalable VG is successful:
root@um-lpar: / # chvg -G bbvg
0516-1224 chvg: WARNING, once this operation is completed, volume group bbvg
        cannot be imported into AIX 5.2 or lower versions. Continue (y/n) ?
...
0516-1712 chvg: Volume group bbvg changed.  bbvg can include up to 1024 physical volumes with 2097152 total physical partitions in the volume group.

19) Check VGDA (Volume Group Descriptor Area):

It is an area on the hard disk (PV) that contains information about the entire volume group. There is at least one VGDA per physical volume, one or two copies per disk. It contains physical volume list (PVIDs), logical volume list (LVIDs), physical partition map (maps lps to pps)
# lqueryvg -tAp hdisk0                                <--look into the VGDA (-A:all info, -t: tagged, without it only numbers)
Max LVs:        256
PP Size:        27                                    <--exponent of 2:2 to 7=128MB
Free PPs:       698
LV count:       11
PV count:       2
Total VGDAs:    3
Conc Allowed:   0
MAX PPs per PV  2032
MAX PVs:        16
Quorum (disk):  0
Quorum (dd):    0
Auto Varyon ?:  1
Conc Autovaryo  0
Varied on Conc  0
Logical:        00cebffe00004c000000010363f50ac5.1   hd5 1       <--1: count of mirror copies (00cebff...c5 is the VGID)
                00cebffe00004c000000010363f50ac5.2   hd6 1
                00cebffe00004c000000010363f50ac5.3   hd8 1
                ...
Physical:       00cebffe63f500ee                2   0            <--2:VGDA count 0:code for its state (active, missing, removed)
                00cebffe63f50314                1   0            (The sum of VGDA count should be the same as the Total VGDAs)
Total PPs:      1092
LTG size:       128
...
Max PPs:        32512

20)Mirroring rootvg (after disk replacement):

1. disk replaced -> cfgmgr           <--it will find the new disk (i.e. hdisk1)
2. extendvg rootvg hdisk1            <--sometimes extendvg -f rootvg...
(3. chvg -Qn rootvg)                 <--only if quorum setting has not yet been disabled, because this needs a restart
4. mirrorvg -s rootvg                <--add mirror for rootvg (-s: synchronization will not be done)
5. syncvg -v rootvg                  <--synchronize the new copy (lsvg rootvg | grep STALE)
6. bosboot -a                        <--we changed the system so create boot image (-a: create complete boot image and device)
                                     (hd5 is mirrorred, no need to do it for each disk. ie. bosboot -ad hdisk0)
7. bootlist -m normal hdisk0 hdisk1  <--set normal bootlist
8. bootlist -m service hdisk0 hdisk1 <--set bootlist when we want to boot into service mode
(9. shutdown -Fr)                    <--this is needed if quorum has been disabled
10.bootinfo -b                       <--shows the disk  which was used for boot

21)Miscellaneous VG Commands:

getlvodm -j <hdisk>       get the vgid for the hdisk from the odm
getlvodm -t <vgid>        get the vg name for the vgid from the odm
getlvodm -v <vgname>      get the vgid for the vg name from the odm
getlvodm -p <hdisk>       get the pvid for the hdisk from the odm
getlvodm -g <pvid>        get the hdisk for the pvid from the odm
lqueryvg -tcAp <hdisk>    get all the vgid and pvid information for the vg from the vgda (directly from the disk)
                          (you can compare the disk with odm: getlvodm <-> lqueryvg)
synclvodm <vgname>        synchronizes or rebuilds the lvcb, the device configuration database, and the vgdas on the physical volumes
redefinevg                it helps regain the basic ODM informations if those are corrupted (redefinevg -d hdisk0 rootvg)
readvgda hdisk40          shows details from the disk

Friday 27 December 2013

"xargs" All-IN-One Tutorial Guide

xargs:


xargs is a just like "awk" ,"find" & "grep" commands processes the standard input on all unix flavoured operating sysems.

Basically "xargs" is used to remove or do some operation on long list of file names which were produced by "find" & "grep" commands.

Usually many UNIX operating system doesn't accept such a long list of argument.UNIX xargs command divide that list into sub-list with acceptable length and made it work.

For example I'd like to find out all *.sh file located in 100s of sub-directories and move them to another directory called ~/back.scripts. How do I use command line args with xargs to achieve the same?

as per man page "xargs" is used to execute a command, passing constructed argument list(s). The arguments are typically a long list of filenames (generated by ls or find etc) that are passed to xargs via a pipe.

Some features:

  • xargs can execute the command supplying some initial arguments directly, and reading the remaining arguments from standard input (or piped input).
  • xargs passes arguments to command in several bundles, this allows command to process more arguments than it could normally handle at once.
  • Arguments in the standard input must be separated by unquoted blank characters, or unescaped blank characters or newline characters.
  • Characters can be quoted by enclosing them in "double-quotes" (non-double-quote and non-newline chars only).
  • Characters can be quoted by enclosing them in 'apostrophes' (non-apostrophe and non-newline chars only).
  • Any unquoted character can be escaped by preceding it with a backslash.

e.g. file1 file2 "file three" 'file four' file\ five
If command is omitted then the equivalent of /bin/echo is used.

 Exit Status

This command returns the following exit values:
Item Description
0 All invocations of the Command parameter returned exit status 0.
1-125 A command line meeting the specified requirements could not be assembled, one or more of the invocations of the Command parameter returned a non-zero exit status, or some other error occurred.
126 Command was found but could not be invoked.
127 Command could not be found.

Examples

Find all the .mp3 files in the music folder and pass to the ls command, -print0 is required if any filenames contain whitespace.:
   find ./music -name "*.mp3" -print0 | xargs -0 ls

Find all files in the work folder, pass to grep and search for profit:
   find ./work -print | xargs grep "profit"

{} as the argument list marker

{} is the default argument list marker. You need to use {} this with various command which take more than two arguments at a time. For example mv command need to know the file name. The following will find all .bak files in or below the current directory and move them to ~/.old.files directory:

$ find . -name "*.sh" -print0 | xargs -0 -I {} mv {} ~/back.scripts

You can rename {} to something else. In the following example {} is renamed as file. This is more readable as compare to previous example:
$ find . -name "*.sh" -print0 | xargs -0 -I file mv file ~/back.scripts

Where,
    -0 If there are blank spaces or characters (including newlines) many commands will not work. This option take cares of file names with blank space.
    -I Replace occurrences of replace-str in the initial-arguments with names read from standard input. Also, unquoted blanks do not terminate input items; instead the separator is the newline character.

10 Popular  "XARGS" Command Examples:

1) With& Without "xargs" observation:

 in this example of xargs command we will see how output changes with use of xargs command in unix or Linux. Here is the output of find command without xargs first and than with xargs, you can clearly see that multiline output is converted into single line:
um@server#find . -name "*sh*"
./.bash_history
./.bash_profile
./.bash_profile.cf-before-edit
./.cshrc
./.cshrc.cf-before-edit
./.sh_history
./.ssh
./.ssh2
./scripts/aix_sysinfo.ksh
./scripts/chperm_messages.sh
./scripts/linux_sysinfo.ksh
./scripts/solaris_sysinfo_v1.1.ksh
./testlocked.ksh

um@server# find . -name "*bash*" | xargs
./.bash_history ./.bash_profile ./.bash_profile.cf-before-edit ./.cshrc ./.cshrc.cf-before-edit ./.sh_history ./.ssh ./.ssh2 ./scripts/aix_sysinfo.ksh ./scripts/chperm_messages.sh ./scripts/linux_sysinfo.ksh ./scripts/solaris_sysinfo_v1.1.ksh ./testlocked.ksh

2) Xargs with grep:

When you use "xargs" in conjusction with find and grep , the grep will look for the specifig word in  each file in the from the stanadard input.
#find . -name "*.sh" | xargs grep "ksh"

In the above exanmple first find all .sh  files from current directory or below and than on each .sh file look for word "ksh".

3) Covert muti line output into single line

best example of xargs is  converting output of one command into one line. For example you can run any command and then combine xargs to convert output into single line. here is an example xargs in unix which does that.
um@server#ls -1 *.sh
linux_sysinfo.sh
aix_sysinfo.sh
audit_script.sh
chperm_messages.sh

um@system#ls -1 *.sh | xargs
linux_sysinfo.sh aix_sysinfo.sh audit_script.sh chperm_messages.sh

4) To Delete temporary files using xargs & find:

Another common example of xargs command in unix is removing temporary files from system.
#find /tmp -name "*.tmp" | xargs rm

This will remove all .tmp file from /tmp or below directory. xargs in unix is very fast as compared to deleting single file at a time which can also be done by using find command alone

5)  xargs -0 to handle space in file name

Above example of xargs command in unix will not work as expected if any of file name contains space or new line on it. To avoid this problem we use find -print0 to produce null separated file name and xargs-0 to handle null separated items. Here is an example of xargs command in unix which can handle file name with spaces and newline:
#find /tmp -name "*.tmp" -print0 | xargs -0 rm

6) Counting number of lines/words/characters in each file using xargs & find:

"find"in conjuction with "xargs" and "wc"  we can count number of lines/words/characters in each file under a perticaular directory.
um@server#ls -1 *.sh | xargs wc -l
112 linux_sysinfo.sh
85  aix_sysinfo.sh
35  audit_script.sh
18  chperm_messages.sh
250 total

Note: you can use '-c' & '-w' with wc to obtain number of characters and words repectively.

7) xargs and cut command in Unix:

 Though most of xargs examples in unix will be along with find and grep command but xargs is not just limited to this two it can also be used with any command which generated long list of input for example we can use xargs with cut command in unix. In below example of unix xargs we will xargs example with cut command. for using cut command let's first create a .csv file with some data e.g.

um@server# cat fruits.txt
Orange,Greenorange
Mango,Redmango
Banana,Pinkbanana

Now we will display name of actual fruit from first column using xargs command in one line:

um@server:/etc cut -d, -f1 fruits.txt | sort | xargs
Orange Mango Banana

8)To insert file names into the middle of command lines, type:

um@server#ls | xargs  -t  -I  {} mv {} {}.old

This command sequence renames all files in the current directory by adding .old to the end of each name. The -I flag tells the xargs command to insert each line of the ls directory listing where {} (braces) appear. If the current directory contains the files chap1, chap2, and chap3, this constructs the following commands:

#mv chap1 chap1.old
#mv chap2 chap2.old
#mv chap3 chap3.old

9) To run a command on files that you select individually, type:

um@server# ls | xargs  -p  -n  1 ar r lib.a

This command sequence allows you to select files to add to the lib.a library. The -p flag tells the xargs command to display each ar command it constructs and to ask if you want to run it. Type y to run the command. Press the any other key if you do not want to run the command.

Something similar to the following displays:

ar r lib.a chap1 ?...
ar r lib.a chap2 ?...
ar r lib.a chap3 ?...

10) To construct a command that contains a specific number of arguments and to insert those arguments into the middle of a command line, type:

um@server# ls | xargs -n6 | xargs -I{} echo {} - some files in the directory

If the current directory contains files chap1 through chap10, the output constructed will be the following:
chap1 chap2 chap3 chap4 chap5 chap6 - some files in the directory
chap7 chap8 chap9 chap10 - some file in the directory

Thursday 26 December 2013

Practical Guide To AIX "Paging Space Management"

In this article we are going to discuss about , how to manage paging in AIX OS.

Contents:

1. Create/Add Paging Space

To add paging space we need to use "mkps" command. Equivalent smitty faspath command is "smitty mkps".
There will be an entry added in "/etc/swapspaces" file when you create a paging space if you mention  optiion "-a".

mkps [ -t lv | [ps_helper psname] ] [ -a ] [ -n ] [-c ChksumSize]-s LogicalPartitions VolumeGroup [ PhysicalVolume ]

Eg:

To create a paging space in volume group myvg that has four logical partitions and is activated immediately and at all subsequent system restarts, enter:
#mkps  -a  -n  -s4 myvg

  • These are "man lsps options"

    Item Description
    -a Specifies that the paging space is configured at subsequent restarts.
    -c Specifies the size of the checksum to use for the paging space, in bits. Valid options are 0 (checksum disabled), 8, 16 and 32. If -c is not specified it will default to 0.
    -n Activates the paging space immediately.
    -s LogicalPartitions Specifies the size of the paging space and the logical volume to be made in logical partitions.
    -t Specifies the type of paging space to be created. One of the following variables is required: 
    lv
    Specifies that a paging space of type logical volume should be created on the system.
    nfs
    Specifies that a paging space of type NFS should be created on the system.
    ps_helper
    Name of the helper program for a third party device.
    psname
    Name of the device entry for paging space.

Example /etc/swapspaces file:

# cat  /etc/swapspacesExample /etc/swapspaces file:
* /etc/swapspaces
*
* This file lists all the paging spaces that are automatically put into
* service on each system restart (the 'swapon -a' command executed from
* /etc/rc swaps on every device listed here).
*
* WARNING: Only paging space devices should be listed here.
*
* This file is modified by the chps, mkps and rmps commands and referenced
* by the lsps and swapon commands.

hd6:
        dev = /dev/hd6

paging00:
        dev = /dev/paging00

paging01:
        dev = /dev/paging01

2. List Paging Space:

The lsps command displays the characteristics of paging spaces, such as the paging space name, physical volume name, volume group name, size, percentage of the paging space used, whether the space is active or inactive, and whether the paging space is set to automatic.

Equivalent smitty faspath command is "smitty lsps".

lsps { -s | [ -c | -l ] { -a | -t { lv | nfs | ps_helper} | PagingSpace } }

The following examples show the use of lsps command with various flags to obtain the paging space information. The -c flag will display the information in colon format and paging space size in physical partitions.
# lsps -a -c
#Psname:Pvname:Vgname:Size:Used:Active:Auto:Type
paging00:hdisk1:rootvg:20:1:y:y:lv
hd6:hdisk1:rootvg:64:1:y:y:lv

# lsps -a
Page Space  Physical Volume   Volume Group    Size   %Used  Active  Auto  Type
paging00    hdisk1            rootvg          80MB       1     no   yes    lv
hd6         hdisk1            rootvg         256MB       1     yes   yes    lv

# lsps -s
Total Paging Space   Percent Used
      256MB               1%

To display the characteristics of paging space myps using the helper program foo enter the following commad:
lsps -t foo myps

This displays the characteristics for all paging spaces and provides a listing similar to the following listing:
Page Space      Physical Volume   Volume Group    Size %Used Active  Auto  Type
myps             mydisk            myvg            512MB     1    yes   yes    lv

3. Change Paging Space:

You can change only the following two attributes for a paging space logical volume.

chps [ -s LogicalPartitions | -d LogicalPartitions ] [ -a { y | n } ] PagingSpace

Increasing Paging Space:

Eg:
#chps -s xx yyy (Where xx is the number of logical partitions to add and yyy identifies the logical volume)

#chps -s 10 hd6   ( adds 10 logical partitions to the logical volume hd6, which results in adding 1280 Mb ( lp size=128MB) to the paging space)

Decrease/Shrink Paging Space:

# chps -d 4 hd6
shrinkps: Temporary paging space paging00 created.
shrinkps: Dump device moved to temporary paging space.
shrinkps: Paging space hd6 removed.
shrinkps: Paging space hd6 recreated with new size.
shrinkps: Resized and original paging space characteristics differ,
check the lslv command output.

Note:You should not shrink the paging beyond the system requirement to avoid system crash.

Activate or deactivate a paging space for the next reboot:

To define the paging00 paging space as configured and active at subsequent system restarts,
chps -a -y  paging00

To define the paging00 paging space as configured and inactive at subsequent system restarts,
chps -a -n  paging00

4. Activate or deactivate a paging space:

"swapon" is the command used to activate the currently defined inactive paging. When a "swapon" ran on a particular paging space it will read the details from the
file "/etc/swapspaces"

swapon -a | devicename 

Examples:
To cause all devices present in the /etc/swapspaces file to be made available, enter:
swapon  -a

All devices present in the /etc/swapspaces file are now available.

To cause the /dev/paging03 and /dev/paging04 devices to be available for paging and swapping, enter:
swapon /dev/paging03 /dev/paging04

The /dev/paging03 and /dev/paging04 devices are now available.

Inorder to make the paging space active , you need to use "swapoff" command.
swapoff DeviceName { DeviceName ...}

5. Remove paging space:

The rmps command removes an inactive paging space, means whenever you  need to remove a paging space you should make it inactive by using "swapoff".

rmps[ -t ps_helper] PagingSpace

Examples:
To remove PS01 paging space, run the following command:
#rmps PS01

This removes the PS01 paging space.


Wednesday 25 December 2013

Practical Guide to AIX "Device Management"

Its very critical as AIX admin to manage devices. We are going to discuss in this tech-note device management, we will discuss the following things.


Contents:

1. Make/Add a Device

When ever you need to add a device to AIX OS server,in this case we should run following command
Let us consider we need add new Hard disk.

You  need to run config manager command "cfgmgr",it will detect all the newly attached devices to the server.
Once you run cfgmgr command system will detect the hard disk.
#cfgmgr (It will detect the all the devices)
#cfgmgr -l  fcs1

The above command configures the detected devices attached to the fcs1 adapter
When you run the above command it will detect only fcs1 devices i.e. HDD, Cdrom, and Tape.
you can verify the added disk by using
#lspv or #lscfg | grep -i hdisk

2. Change Device:

Sometimes we may need to change  attributes of the devices,it can be acieved by "chdev" command.
Need to discuss about two options of "chdev"

-P     Changes the device's characteristics permanently in the Customized Devices object class without actually changing the device. This is useful for devices that cannot be made unavailable and cannot be changed while in the available state. The change is made to the database, and the changes are applied to the device when the system is rebooted. This flag cannot be used with the -T flag. Not all devices support the -P flag.

-T  Changes the characteristics of the device temporarily without changing the Customized Devices object class for the current start of the system. This flag cannot be used with the -P flag. Not all devices support the -T flag.

Ex:
We want to change PVID (Physical volume ID) for PV ( physical Volume)
#chdev –l hdisk0 –a pv=clear (To clear the PVID)
#chdev –l hdisk0 –a pv=yes (To assign the PVID)
some more examples
#chdev –l inet0 –a hostname=umlpar (To change the host name)
#chdev -l rmt0 -a ret=yes (To instructs the tape drive to retension a tape automatically whenever a tape is inserted. )
#chdev –l ent0 –a media_speed=100_full_duplex (To Change Ethernet card duplex speed)

3. List Device

Suppose we want to list device configuration details, this case se should run following command.
Whenever we list the device information that information is listed from ODM because ODM is storing the device information.
#lsdev –C (To list the Customized device configuration information from ODM)
#lsdev –P (To list the Predefined device configuration information from ODM)

The above commands list the object class device information; it will list all the device information.
Suppose we want to see particular device (object) information,
#lsdev –Cc disk
#lsdev –Cc processor
#lsdev –Cc adapter
#lsdev –Cc memory
C –Customized (object class)
c – for device (object)
If any confusion please refer the ODM notes

4. Remove Device

Suppose you want to remove device from server. Suppose it is one HDD.
First you have removed the HDD from server. Then you checking device configuration details using
#lsdev –Cc disk
Or
#odmget CuDv

It will show the device status
There is two options is available in device removal
#rmdev –dl hdisk1

The above command is used to remove hdisk1 device from ODM (complete removal from OS)
After executing the above command this hdisk1 configuration is not available in ODM
#odmget CuDv | grep hdisk1

It wont display anything because device configuration is removed from ODM
Suppose you want to remove device from the server not from ODM
This case you should use the following command.
#rmdev –l hdisk1

The above command is used to remove hdisk1 device from server, this device configuration is available in ODM (not from OS)
After executing the above command this hdisk1 configuration is available in ODM and device status is defined
#odmget CuDv | grep hdisk1

It will show hdisk1 configuration details but device status is 0
If you want install hdisk1 device again, you should run the following command
#cfgmgr
#cfgmgr scsi0 (Directly you can search device on Parent device scsi0)

After executing above commands the device hdisk1 become to Available state.
And device status is 1

5. List device Properties (attributes)

Suppose you want to check the device attributes details, you should use following commands.
You want to see memory details,
#lsattr –El mem0 (For memory)
#lsattr –El processor0 (For processor)
#lsattr –El ent0 (For Ethernet card)
#lsattr –El rmt0 (For Tape drive)
E – Effective
l - Device

6. List device Configuration

Suppose you want to check the device configuration details, you should use following commands.
Suppose you want to see HDD FRU number
#lscfg (it will show full system information)
#lscfg –vl hdisk0 (It will show HDD configuration details FRU)
#lscfg –vl eth0 (It will so MAC address details of eth0)

Tuesday 24 December 2013

Installation methods available for AIX

There are 3 types of installation in AIX, they are:-

1. Complete Overwrite Installation
2. Preservation Installation
3. Migration Installation

Descriptions:-

COMPLETE OVERWRITE INSTALLATION:-

An installation method that completely overwrites an existing version of the Base Operating System that is installed on your system. This procedure may impair recovery of data or destroy all existing data on your hard drives. Be sure to back up your system before doing a complete overwrite installation.

PRESERVATION INSTALLATION:-

An installation method used when a previous version of the Base Operating System (BOS) is installed on your system and you want to preserve the user data in the root volume group. However, this method overwrites the /usr, /tmp, /var, and / (root) file systems, so any user data in these directories is lost. System configuration must be done after doing a preservation installation.

MIGRATION INSTALLATION:-

An installation method for upgrading AIX Version 5.3 or later to the current release while preserving the existing root volume group. This method preserves the /usr, /tmp, /var, and / (root) file systems, as well as the root volume group, logical volumes, and system configuration files. Migration is the default installation method for, and can only be used on, an AIX Version 5.3 or later machine.


IBM Tivoli Monitoring ITM 6.X Product Codes

This technote provides the location to a file that contains a list of most of the product codes and their descriptors. This method suggested below may not be applicable to all customer environments.

There is a file located at $INSTALLDIR/registry/proddsc.tbl. It contains a list of agent product codes. The proddsc.tbl file only exists in a Linux/Unix installation environment. It is not present in Windows or zOS. Please note some product codes listed in the table below may not be valid in all environments as some have reached end of support.

The output below is for example only and may not be complete. Since product codes are added periodically, do not use the list published in this Technote as the definitive source. Reference the most recent product documentation for updated product codes and descriptions.

2nAgentless Agent
3zMonitoring Agent for Active Directory
a2AF/Remote Alert Adapter
a4Monitoring Agent for i5/OS
ahSystem Automation for z/OS
amOMEGACENTER Gateway MVS Alert Adapter
auCA-Unicenter Alert Emitter
axIBM Tivoli Monitoring Shared Libraries
bbRAS1 programming building blocks
bcITCAM System Edition for WebSphere DataPower
blCASP Directory Server Monitoring Agent
bnITCAM for SOA Platform
brCASP Exchange Connector Monitoring Agent
bsBasic Services
c3IBM Tivoli Monitoring for CICS
c5OMEGAMON XE for CICS on z/OS
caAgent Management Services Watchdog
ceKCEagent in V5.1.0 and higher for OMEGAMON XE for CICS on z/OS
cfTEMS Configurator
cgIBM Tivoli Monitoring for Cryptographic Coprocessors
ciIBM Tivoli Monitoring Product Installer
cicatrsqIBM Tivoli Monitoring SQL Files
cienvIBM Tivoli Monitoring Product Installer
cjTivoli Enterprise Portal Desktop Client
coCommand and Control
cpIBM Tivoli Monitoring for CICS
cqTivoli Enterprise Portal Server
cuICU globalization support
cwTivoli Enterprise Portal Browser Client
czIBM Tivoli Monitoring CommandPro
d3IBM Tivoli Monitoring for DB2
d4ITCAM for SOA
d5OMEGAMON XE for PE and PM on z/OS
dcdistributed communications
ddDistributed Database common code
dedistributed communications transport protocol
dfOMEGAMON II for SMS
dhInternet http server
doIBM Tivoli Decision Support for z/OS
dpOMEGAMON XE for DB2 PE and PM on z/OS
dsTivoli Enterprise Management Server
dyremote deploy (os agent only)
e3R/3 Clients (for ETEWatch) Monitoring Agent
e4Siemens APOGEE Agent
e5OSIsoft PI Agent
e6Johnson Controls Metasys Agent
e7APC InfraStruXure Agent
e8Eaton Power Xpert Agent
e9Active Energy Manager Agent
eaInternet Monitoring Agent
elLotus Notes Clients (for ETEWatch) Monitoring Agent
emEvent manager
enSNMP Gateway on Windows NT
erManagement Agent for Tivoli Enterprise Console Gateway
esEIF to WS-Notification Converter
etEnd-to-End
euCustom Clients (for ETEWatch) Monitoring Agent
ewWeb Browsers (for ETEWatch) Monitoring Agent
exMonitoring Agent for Microsoft Exchange Server
ezOMA for eBA Solutions
fnMonitoring Agent for Tivoli Management Framework
fwWindows NT Tivoli Enterprise Portal
gaSNMP Gateway on AIX
gbIBM Tivoli Monitoring for Domino
glgeneral library
grGraphics and Sound Library for TEP
gsIBM GSKit Security Interface
gwOMEGAMON XE for CICS TG on z/OS
hcHMC Alert Adapter
hdWarehouse Proxy
hiHP OpenView IT/Operations Alert Adapter
hlOMEGAMON z/OS Management Console
hoHP OpenView NNM Alert Adapter
htMonitoring Agent for Web Services
i2OMEGAMON II for IMS
i5OMEGAMON XE for IMS on z/OS
icWebSphere InterChange Server Monitoring Agent
ieWebSphere InterChange Server Data Source
ihOpenView ITO Alert Emitter
ipOMEGAMON XE for IMS on z/OS
isIBM Tivoli Composite Application Manager for Internet Service Monitoring
itTEC GUI Integration
ivIBM Tivoli Enterprise Portal Server Extensions Update
iwIBM Tivoli Enterprise Portal Server Extensions
jrTivoli Enterprise-supplied JRE
juMonitoring Agent for JMX JSR-77
kaMonitoring Agent for Tivoli Enterprise Console
kfIBM Eclipse Help Server
ktITCAM for Response Time Enabler on z/OS
laIBM Tivoli LAP tool
lnLotus Notes Monitoring Agent
loMonitoring Agent for Netcool\OMNIbus Logfiles
lvITMS:Engine
lxPOSIX pthread mapping service (CT/Engine)
lzMonitoring Agent for Linux OS
m2OMEGAMON II for MVS
m3IBM Tivoli Monitoring for OS/390
m5OMEGAMON XE on z/OS
m6ITCAM Agent for WebSphere MQ File Transfer Edition
maRemedy ARS Alert Adapter
mcWebSphere MQ Configuration Agent
mdPQEdit
mqWebSphere MQ Monitoring Agent
msTivoli Enterprise Monitoring Server
n3OMEGAMON XE for Mainframe Networks
naIBM Tivoli NetView for z/OS Enterprise Management Agent
ndMonitoring Agent for Tivoli NetView Server
noTivoli Omnibus ObjectServer Agent
npIBM Tivoli Network Manager
ntMonitoring Agent for Windows OS
nvNetView/AIX Alert Adapter
nwNovell NetWare Monitoring Agent
obOMNIMON BASE
oeCCC for OS/390 Unix System Services
onOMEGAMON II for Mainframe Network
oqMonitoring Agent for Microsoft SQL Server
orMonitoring Agent for Oracle
osIBM Tivoli Monitoring for Sysplex
oxInformix Monitoring Agent
oyMonitoring Agent for Sybase Server
p0Tivoli Performance Analyzer Domain for DB2
p3Tivoli Performance Analyzer Domain for OS agent
p4Tivoli Performance Analyzer Domain for Oracle
p5Base Monitoring Agent for AIX
p6Tivoli Performance Analyzer Domain for System P
p8ITCAM Agent for PeopleSoft Enterprise Application Domain
p9ITCAM Agent for PeopleSoft Enterprise Process Scheduler
paPerformance Analyzer
pcDEC Polycenter Alert Adapter
peMonitoring Agent for Provisioning
phBase Monitoring Agent for HMC
piTivoli Performance Analyzer Domain for ITCAM RT
pkBase Monitoring Agent for CEC
plCandleLight Workstation
psPeopleSoft Monitoring Agent
ptPeregrine ServiceCenter Alert Adapter
puTivoli Performance Analyzer Domain for VMware
pvBase Monitoring Agent for VIOS
pxPremium Monitoring Agent for AIX
q5Monitoring Agent for Microsoft Cluster Server
q7Microsoft Internet Information Services (IIS) Agent
qaMonitoring for Microsoft Applications
qdIBM Tivoli Monitoring for IBM Director
qfMonitoring Agent for Microsoft .NET Framework
qiWebSphere Message Broker Monitoring Agent
qrMonitoring Agent for Microsoft Virtual Server
qvMonitoring Agent for VMware ESX
qxMonitoring Agent for Citrix Access Suite
r2Agentless Monitoring for Windows Operating Systems
r3Agentless Monitoring for AIX Operating Systems
r4Agentless Monitoring for Linux Operating Systems
r5Agentless Monitoring for HP-UX Operating Systems
r6Agentless Monitoring for Solaris Operating Systems
r9Business System Manager Common Agent
rcIBM Tivoli Monitoring for Rational Applications
rgIBM Tivoli Advanced Audit for DFSMShsm
rjIBM Tivoli Allocation Optimizer for z/OS
rkIBM Tivoli Automated Tape Allocation Manager
rnIBM Tivoli Advanced Catalog Management for z/OS
rvIBM Tivoli Advanced Backup and Recovery for z/OS
rwIBM Tivoli Tape Optimizer
rzITCAM Extended Agent for Oracle Database
s1ITCAM Lotus Sametime Agent
s2OS/2 Monitoring Agent
s3IBM Tivoli OMEGAMON XE for Storage on z/OS
saMonitoring Agent for mySAP
sbshared probes
sdStatus Data Manager
shTivoli Enterprise Monitoring SOAP Server
sjBest Practices for WebSphere
skReporting Agent for Tivoli Storage Manager
spSNMP Alert Adapter
srIBM Tivoli Service Level Advisor
ssWindows NT SNA Server Monitoring Agent
sySummarization and Pruning Agent
t1ITCAM File Transfer Enablement
t2ITCAM for Response Time Tracking TEMA
t3ITCAM Application Management Console (AMC)
t4ITCAM for Client Response Time (CRT) Agent
t5ITCAM for Web Response Time (WRT) Agent
t6ITCAM for Robotic Response Time (RRT) Agent
thITCAM for MQ Tracking
tlOmegamon XE for Message Transaction Tracker
tmMonitoring Agent for IBM Tivoli Monitoring 5.x Endpoint
tnUnicenter TNG Alert Emitter
toITCAM Transaction Reporter
trNetView Alert Emitter
tuITCAM Transaction Collector
tvTivoli Enterprise Console Alert Adapter
txTuxedo Monitoring Agent
uaCA-Unicenter Alert Adapter
ubIBM Tivoli Monitoring for Applications: Siebel Agent
udIBM Tivoli Composite Application Manager Agent for DB2
ueTivoli Enterprise Services User Interface Extensions
ufUniversal Agent Framework
uiTivoli Enterprise Services User Interface
ujUnison Maestro Alert Adapter
ulMonitoring Agent for UNIX Logs
umUniversal Agent
urUnison RoadRuner Alert Adapter
utUnicenter TNG Alert Adapter
uxMonitoring Agent for UNIX OS
vaPremium Monitoring Agent for VIOS
viHP OpenView Alert Emitter
vlOMEGAMON XE on z/VM and Linux
vmIBM Tivoli Monitoring for Virtual Servers
vtTivoli Enterprise Console Alert Emitter
vwNetView for z/OS Agent Support
w0IBM Message Service Client Library
weWebSphere Application Server Monitoring Agent
wjITCAM Common Components
wlBEA Weblogic Server Monitoring Agent
woIBM Tivoli Monitoring for OMEGAVIEW II for the Enterprise
wwWebSphere Application Server on OS/390
ybIBM Tivoli Information Management for z/OS
yjMonitoring Agent for J2EE
ynITCAM for Web Resources