AIX

Backspace & VI Mode

Most of the time the back space is not working to delete/correct a mistyped command. Insert two lines in /etc/profile and backspace key will work on most VT100 type terminals for normal telnet as well as ssh session.
Open /etc/profile in your editor (vi, emacs) and add
stty erase \^?
set -o vi
 
Performance & Error Log Monitoring


Performance monitoring
# topas
The topas command reports selected statistics about the activity on the local system. The command displays its output in a format suitable for viewing on an 80x25 character-based display. The topas command requires the bos.perf.tools and perfagent.tools filesets to be installed on the system.  (http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds5/topas.htm)

Error Log Monitoring
Run this command on aix for error log
# errpt
(For example result would be as follow, whereas)
IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION
A19337FA 1218232410 P H hdisk6 SUBSYSTEM COMPONENT FAILURE
A19337FA 1218221810 P H hdisk19 SUBSYSTEM COMPONENT FAILURE
The timestamp works like this: 1218221810 (12 = month, 18 = day, 22 = hour, 18 = min, 10 = year).
T (Type)=INFO, PEND, PERF, PERM, TEMP, and UNKN.
C (Class)=H(Hardware), S(Software), 0(Operator notice created with “errlogger” command), U(Undetermined).
So more detail of an error use this command
# errpt -aj A19337FA | more
 
Starting the AIX Server
1- After applying the power supply leave the machine for some time it would run some codes on the LED after that "Green" light would start blinking then push the white button to start the machine (For complete start partition need to be start).
2- After that connect the HMC server (with https, enter the user n pwd).
3- Click on HMC Management and then servers
4- From there click the server to which you want to start (new page would be loaded) check the default partition and click on activate. When it is activated then you can ping the machines.
5- Run this command to check SAN disks:
# sddpcm_get_config -A
6- Run this command for filesystems
# df

Growing File System

# df -g (use this command to see the free disk in gb block, select desired disk and enter with lslv command to see the detail )
# lslv hd2 (multiply MAXLPs with PP Size to see the size of max available disk)
# smitty fs
Add / Change / Show / Delete File Systems > Enhanced Journaled File Systems > Change / Show Characteristics of an Enhanced Journaled File System "Now select the desired item e.g: usr" and press enter > then go to "Unit Size" and press F4 to selet "Megabytes" now press enter > Now move to 'Number of units" and press F7 for edit enter here amount of disk e.g: 6000 and press enter. (See the text e.g: successfully changed size....)
#df -g (and now see the changings)

Moving SAN Disks

1-Moving/Mapping SAN disks from one system to another

Following method may be used to move SAN disks from one system to another. Similar technique can be used to access the disks, if a system is unavailable for some reason and access to data is required.
In this example disks were originial mapped to AIX host1 and remapped/reused at host2

2-List the existing Volume Groups (vgs)

# lsvg
rootvg
testvg
skvg

From above list skvg will be used as an example.

3-List the volumes and mounted File systems part of VG

Use the command lsvg to list the file systems. As file systems must be unmounted before a volume group can be varied off and exported

# lsvg -l skvg
skvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
loglv03             jfs2log    1       1       1    open/syncd    N/A
fslv03              jfs2       25      25      1    open/syncd    /sha
khan                jfs2       25      25      1    open/syncd    /ra
sak                 jfs        10      10      1    open/syncd    /sak
loglv04             jfslog     1       1       1    open/syncd    N/A
 
4-Unmount the mounted file systems in vg
#umount /sha
#umount /ra
#umount /sak 

5-Note down the physical volumes (for later removal, as well as remapping in SAN) 

The list of volumes part of volume group can be found using lsvg -p. While the labels used on san can be seen by using sddpcm_get_config

# lsvg -p skvg
skvg:
PV_NAME        PV STATE        TOTAL PPs  FREE PPs    FREE DISTRIBUTION
hdisk3         active          199        163         40..04..39..40..40
hdisk4         active          199        173         40..14..39..40..40

# sddpcm_get_config -Av
    Storage Subsystem worldwide name: 60ab80026aa240000463293f2
    Storage Subsystem Name = 'StorageDS4700'
        hdisk      LUN #   Ownership          User Label
        hdisk3         0   A (preferred)      10
        hdisk4         1   A (preferred)      6
6-Varyoff and export the volume using smitty
# varyoffvg skvg (before exporting disk must be varyyoff to releive for exporting where as skvg is vg in our case)
2- smitty vg
3- select "Export a Volume Group" and press enter
4- enter the name of vg (in our case it is skvg)
7-Remove and Remap Using DS4700 SAN Utility
********Open StorageDS4700 - IBM System Storage Manager Software******
1- Click on host from which you want to move disk and it would show you the logical device name (in our case its host aix-32 and it would show two ldu's 10 & 6)
2- Right click on one and select remove mapping then click on second one and click on remove mapping. Now these disk would be moved on "undefined mapping"
3- Right click on one disk and select "define additional mapping" > select your host and click on add and repeat this process for the second disk or so on.
4- These disk would be moved in to selected host (in our case it is host aix-33)

8-Configure disks on second (host2) Server

# cfgmgr
# lspv
hdisk0 000383e30006c4f8 rootvg active
hdisk1 000383e35ce1beee oravg active
hdisk2 000383e3f9e30c09 testvg1 active
hdisk3 000383e3f9e30ce9 testvg1 active
hdisk4 000383e3f9e30dd1 testvg1 active
hdisk5 000383e3f9ed9d6b testvg2 active
hdisk6 000383e3f9ed9e56 testvg2 active
hdisk7 000383e3f9ed9f2a testvg2 active
hdisk8 00cc375e1407fc3b None (san disk, move from other server)
hdisk9 00cc375e1407fd90 None (san disk, move from other server) 

9-Import the Volume Group

# smitty vg
select "Import a Volume Group" and press enter
5-
# enter the volume group (e.g; skvg, this is our case example) and physical volume (e.g; hdisk8, this is our case example). and press enter it would import the disks.
# lspv (and see the disks) 

10-Varyon the Volume Group

# varyonvg skvg (skvg is a vg in our case) 

11-Mount the file systems

# mount /sha
# mount /ra
# mount /sak
you can check by;
#lspv
#lsfs

Allocating Disk Space On / From SAN

1- Login the aix machine
# lspv
hdisk0          000383e30006c4f8                    rootvg          active
hdisk1          000383e35ce1beee                    oravg           active
(currently we dont have any physical volume available from SAN)
2- To see the hba information / wwn
# lscfg -vl fcs0 | grep Network
        Network Address.............************D6BB
# lscfg -vl fcs1 | grep Network
        Network Address.............************BE6C
3- Check the switch status for active ports or connected hba's:
 
IBM_2005_B16:admin> switchshow
.
Area Port Media Speed State Proto
=====================================
0 0 id N4 Online F-Port **:**:**:**:**:**:aa:25
1 1 id N4 Online F-Port **:**:**:**:**:**:aa:25
2 2 id N2 Online F-Port **:**:**:**:**:**:7f:7a
3 3 id N4 Online F-Port **:**:**:**:**:**:be:6c <======== 
 
Check the switch status for active ports or connected hba's:
IBM_2005_B16:admin> switchshow
Area Port Media Speed State     Proto
=====================================
  0   0   id    N4   Online       F-Port  **:**:**:**:**:**:aa:26
  1   1   id    N4   Online       F-Port  **:**:**:**:**:**:aa:26
  2   2   id    N2   Online       F-Port  **:**:**:**:**:**:7c:83
  3   3   id    N4   Online       F-Port  **:**:**:**:**:**:d6:bb <======== 
 
Zoning in SAN switch
(Server's had two HBA's we would add each one on san switch, Help:Zoning is the SAN term for dividing up the SAN into smaller “portions” so that SAN ports that
do not need to communicate with each other are unable to. )
4- Login the switch
5- Click on "Zone Admin" >>> Create an alias "e.g DRCTest" >>> Now add the device shown as WWN of the server hba's, select the device (fcs0 & fcs1) and click on "Add Memeber" >>>

Click on "Zone" tab and create a zone "e.g DRCtestZone "and click ok >>> Select the alias in which you had entered your required wwn/hba and click on "Add Member" >>>

Click on "Zone Config" tab and create "new zone config" "e.g DRC_Prod_Zone" click ok >>> Select your zone and click on "Add Member" >>> Close the "Zone Admin"

Now use the same steps on other switch to add the server hba.

To create HBA On IBM System Storage Manager

3- Run the software "IBM Systems Storage"
4- Double click "Storage sybsystem storage"
5- click on "Mapping view"
6- Right click on "Host Group" (in our case its Host Group DR-SAN) >>> click on "Define Host" >>> and click on "Next".
7- Select the HBA and click on "Add"
8- Name the HBA (Host AIX-00) >>> click "Next" >>> click on "Finish" (yes / no would be asked for more hba select your option)

To add disk on SAN
9- Right click the "Host Aix-00" >>> click on "Define Additional Mapping" >>> Select the logical drive name and logical unit number (must be different as same wont be added) >>> Click on "Add"
10-
# cfgmgr
11- To see the SAN disks
# sddpcm_get_config -A
    Storage Subsystem worldwide name: ************
    Storage Subsystem Name = 'StorageDS4700'
        hdisk      LUN #   Ownership          User Label
        hdisk2         0   B (preferred)      1
        hdisk3         1   A (preferred)      13
        hdisk4         2   A (preferred)      2
        hdisk5         3   B (preferred)      3
        hdisk6         4   A (preferred)      4
        hdisk7         5   B (preferred)      14
        hdisk8         6   A (preferred)      10
        hdisk9         7   A (preferred)      6
11-
# lspv
hdisk0          000383e30006c4f8               rootvg     active
hdisk1          000383e35ce1beee               oravg      active
hdisk2          000383e3f9e30c09               None      (san disk)
hdisk3          000383e3f9e30ce9               None      (san disk)
hdisk4          000383e3f9e30dd1               None      (san disk)
hdisk5          000383e3f9ed9d6b               None      (san disk)
hdisk6          000383e3f9ed9e56               None      (san disk)
hdisk7          000383e3f9ed9f2a               None      (san disk)
hdisk8          00cc375e1407fc3b               None      (san disk)
hdisk9          00cc375e1407fd90               None      (san disk)
 
Create vg (volume group) 


12-
# smitty vg
Add a volume group >>> Add an Original Volume Group >>> Enter name of vg in our case "drcvg", add the physical volume e.g hdisk2 >>> Press enter >>> Press F10 (to exit)
13-
# lspv
hdisk0          000383e30006c4f8               rootvg      active
hdisk1          000383e35ce1beee               oravg       active
hdisk2          000383e3f9e30c09               drcvg       active
hdisk3          000383e3f9e30ce9               None
hdisk4          000383e3f9e30dd1               None
hdisk5          000383e3f9ed9d6b               None
hdisk6          000383e3f9ed9e56               None
hdisk7          000383e3f9ed9f2a               None
hdisk8          00cc375e1407fc3b               None
hdisk9          00cc375e1407fd90               None
 



Backup & Restore
 
Backup 
mksysb is used to take the system backup of aix machine or backup of the operating system 
i.e; that is, root volume group 
# smitty devices select tape drives
select Change / Show Characteristics of a Tape Drive
select the device and press enter
set "BLOCK size (0=variable length) [0]" and press enter
(Following command could be also used for the same purpose mksysb -i /dev/rmt0 where /dev/rmt0 is tape drive in our case)

# smitty mksysb select the tape drive in our case its rmt0 and set block size to 512
Press enter and backup would be started
Backup is started and after complete the result would be like this.
Creating information file (/image.data) for rootvg.
Creating tape boot image.....
bosboot: Boot image is 39779 512 byte blocks. .
Creating list of files to back up..
Backing up 60235 files..............................
17091 of 60235 files (28%)..............................
17602 of 60235 files (29%)..............................
28665 of 60235 files (47%)..............................
52649 of 60235 files (87%)..............
60235 of 60235 files (100%)
0512-038 mksysb: Backup Completed Successfully. bosboot: Boot image is 39779 512 byte blocks.

Restore


To perform full systems restore:
  1. Reboot the system, and quickly go to the next step.
  2. As the system restarts, the console provides a series of POST messages. Before the last message, press F1 to bring up the SMS console.
  3. From the SMS console, alter or modify the boot sequence to have the system boot from the tape drive containing the mksysb tape (i.e., the bootable tape created by the mksysb command during the process of taking mksysb).
  4. Save the boot sequence and exit. The system should now boot from the tape.
  5. Go to the CommCell Console. Then right-click the backup set, click All Tasks, click Restore, enter / as the path to restore from, and select "restore to same paths."
Do not select Unconditional Overwrite from the Restore Options dialog box.
  1. When restoring encrypted data, refer to Data Encryption.
  2. Click OK to start the restore.
  3. Verify that the restore operation has completed successfully. Then reboot the computer. The system should boot to the newly-restored root.


Mirroring rootvg & Removing Hard disk
 
Purpose of rootvg is to overcome the problem of single point of failure, mirroring is best for higher levels of availability and fault tolerance.

Add hard disk for mirroring:

Add hdisk1 to the rootvg for mirroring:
#smit vg
Set Characteristics of a Volume Group
Add a Physical Volume to a Volume Group ( In our case the detail is as follows)
Force the creation of a volume group? yes
* VOLUME GROUP name                                                               [rootvg]
* PHYSICAL VOLUME names                              [hdisk1]   

Use this command for rootvg mirroring:
#mirrorvg rootvg
# syncvg -v rootvg (This command will Sync the volume group)
# lsvg -l rootvg (list the contents of rootvg)

Then check the devices which are varied on or activated alongwoth their boot status
# ipl_varyon -i PVNAME BOOT DEVICE PVID VOLUME GROUP ID
hdisk0 YES 00003cda49a4c8e10000000000000000 00003cda0000d100
hdisk1 NO 00003cb478b188e90000000000000000 00003cda0000d100
(till this time hdsik1 is not in boot device so in case of failure hdsik0, hdisk1 won't be boot)

#bosboot -a -d /dev/hdisk1
Use this command to active the hdisk1 to activate or act as boot device

# ipl_varyon -i PVNAME BOOT DEVICE PVID VOLUME GROUP ID hdisk0 YES 00003cda49a4c8e10000000000000000 00003cda0000d100 hdisk1 YES 00003cb478b188e90000000000000000 00003cda0000d100
(Now both PV's are active for boot)

# chvg -a'y' -Q'n' -x'n' rootvg
(This command is used for "A QUORUM of disks required = no")

# bootlist -m normal -o hdisk0
list the available devices (PV's) when system is boot

# bootlist -m normal hdisk0 hdisk1 to add both disk for boot

# bootlist -m normal -o hdisk0 hdisk1
Since disk quorum was disabled, we must reboot the system for the changes to take effect.

# shutdown -r now
It can be checked by removing a disk and reboot the system.

Removing Hard Disk

1- Move the PV's from hdisk0 to hdisk1
# smitty pv Move Contents of a Physical Volume * SOURCE physical volume name hdisk0 * DESTINATION physical volumes [hdisk1] + Move only data belonging to this [] + LOGICAL VOLUME? and press enter

2- Reduce the vg to the new disk by removing the old one from list
# reducevg rootvg hdisk0
 
3- Identify the disk which you wanted to remove
# prtconf | more
see the no against hdisk so it can be check in diag menu

#diag
Task Selection (Diagnostics, Advanced Diagnostics, Service Aids, etc.)
Identify and Attention Indicators
Select device by pressing enter and press F7

4- Run command to remove the disk and as well as from dev
# rmdev -dl hdisk0

Exporting NFS Shares In AIX

1- Edit /etc/exports (or create it if it doesn’t exist) and add folders to be shared:
/tmp/shafqaat -access=*.*.100.113,root=*.*.100.113(in our case)

Option access restricts the list of clients, root allows to mount the share by root user

2- Start nfsd services:
startsrc -s nfsd
startsrc -s mountd

3- Check daemons are running:
AIX_NFS_Server # lssrc -s nfsd
Subsystem Group PID Status
nfsd nfs 17968 active
AIX_NFS_Server # lssrc -s portmap
Subsystem Group PID Status
portmap portmap 11610 active
AIX_NFS_Server # lssrc -s biod
Subsystem Group PID Status
biod nfs 14966 active

4- Export all directories
exportfs -a

5- Check from the client rpc services are reachable:

AIX_NFS_Client # rpcinfo -p *.*.100.112 | egrep "(mountd|nfs)"
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100005 1 tcp 40574 mountd
100005 2 tcp 40574 mountd
100005 3 tcp 40574 mountd
100005 1 udp 51890 mountd

6- Shares should be visible:
AIX_NFS_Client # showmount -e *.*.100.112
export list for *.*.100.112:
/tmp/shafqaat (everyone)

7- To mount /tmp/shafqaat from host *.*.100.112 to /tmp/shafqaat using mount options:
AIX_NFS_Client # mount *.*.100.112:/tmp/shafqaat /tmp/shafqaat
or

1- Create the /etc/exports file (smit mknfsexp)
2- Add directory which you want to export in our case its /tmp/shafqaat with access and permissions.
3- Run the command to export the file system:
# exportfs -a
4- Check monunt point is exported (in our case its):
# showmount -a
d-blade02:/tmp/shaf
4- Now access the system on which you wanted to access that nfs (destination) and run the following command:
mount 172.21.100.112:/tmp/shaf /tmp/tmp2

before running this command make it sure that "tmp2" directory exist in "/tmp".

Unmount the NFS

To unmount the filesystem use the following command:
# umount /tmp/tmp2
and if error is like "umount: 1831-015 16 error while unmounting 172.21.100.112:/tmp/shaf - The requested resource is busy."

then run the following command:
# umount -f /tmp/tmp2
forced unmount of /tmp/tmp2



Creating a Filesystem



1. Create a vg
smitty vg >>> Add a volume group >>> Add an Original Volume Group >>> Enter name of vg in our case "abcvg", add the physical volume e.g hdisk2,hdisk3 >>> Press enter >>> Press F10 (to exit)



LV WOULD BE CREATED AUTOMATICALLY

2. Create a filesystem (by this lv would be made automatically)
 Add / Change / Show / Delete File Systems >>> Enhanced Journaled File Systems >>> Add an Enhanced Journaled File System >>> Select your vg >>> Enter the detail as per requirement;

                                        Add an Enhanced Journaled File System
Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                        [Entry Fields]
  Volume group name                                   vgname
  SIZE of file system
          Unit Size                                   Gigabyte                                                           +
*         Number of units                            [100]                                                            #
* MOUNT POINT                                        [/mountpointname]
  Mount AUTOMATICALLY at system restart?              yes                                       +
  PERMISSIONS                                         read/write                                               +
  Mount OPTIONS                                      []                                                             +
  Block Size (bytes)                                  4096                                                            +
  Logical Volume for Log                                                                                              +
  Inline Log size (MBytes)                           []                                                                #
  Extended Attribute Format                           Version 1                                                 +
  ENABLE Quota Management?                            no  

and it will create a mount point "/mountpointname" with 100GB space

FOR MANUAL LV

smitty lv >>> Add a Logical Volume >>> select ur vg >>>
                                                                   Add a Logical Volume

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                        [Entry Fields]
  Logical volume NAME                                [lvname]
* VOLUME GROUP name                                   vgname
* Number of LOGICAL PARTITIONS                       []                                                   #
  PHYSICAL VOLUME names                              [hdisk2,hdsik3]                                   +
  Logical volume TYPE                                []                                                                   +
  POSITION on physical volume                         middle                                                    +
  RANGE of physical volumes                           minimum                                                   +
  MAXIMUM NUMBER of PHYSICAL VOLUMES  [2048]                                          #
    to use for allocation
  Number of COPIES of each logical                    1                                                                   +
    partition
  Mirror Write Consistency?                           active                                                              +
  Allocate each logical partition copy                yes                                                                 +
    on a SEPARATE physical volume?
  RELOCATE the logical volume during                  yes                                                                 +
    reorganization?
  Logical volume LABEL                               []
  MAXIMUM NUMBER of LOGICAL PARTITIONS               [512]                                                                 #
  Enable BAD BLOCK relocation?                        yes                                                                 +
  SCHEDULING POLICY for writing/reading               parallel                                                            +
    logical partition copies
  Enable WRITE VERIFY?                                no                                                                  +
  File containing ALLOCATION MAP                     []
  Stripe Size?                                       [Not Striped]                                                        +
  Serialize IO?                                       no  

By using this way a manual lv would be create and then to create a fs

smitt fs >>> Add / Change / Show / Delete File Systems >>> Enhanced Journaled File Systems >>> Add an Enhanced Journaled File System on a Previously Defined Logical Volume >>> and then add the detail as follows;

Add an Enhanced Journaled File System

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                        [Entry Fields]
* LOGICAL VOLUME name                                                                                                     +
* MOUNT POINT                                        []
  Mount AUTOMATICALLY at system restart?              no                                                                  +
  PERMISSIONS                                         read/write                                                          +
  Mount OPTIONS                                      []                                                                   +
  Block Size (bytes)                                  4096                                                                +
  Logical Volume for Log                                                                                                  +
  Inline Log size (MBytes)                           []                                                                    #
  Extended Attribute Format                           Version 1                                                           +
  ENABLE Quota Management?                            no

Rename a Filesystem


1. umount /fs1
Issues in umounting:
> If it did'nt work use this command to force unmount "umount -f /fs1" and
>if there is issue that requested resource is busy then either restart machine or check for the running processes on required mount point or any user connected to that mount point.
try following commands to check the processes
ps -ef ( check process and then kill the process by command "kill -9 PID")
ps -ef | grep session (by this check sessions if any1 working on that mount point then close that session)
ps -ef|grep "/fs1"

2. Change the name of filesystem
#smitty chfs >>> Change / Show Characteristics of an Enhanced Journaled File System >>> select mount point and enter name of mount point of fs1 to fs1a (NEW mount point [/fs1a] and then press enter

3. mount the new fs1
#mount /fs1a
---------------------------------------------------
1) chfs -m new_filesystem old_filesystem
# chfs -m /testsaknew /testsak
check by df -g and if its not changed then
2) Unmount the filesystem
umount /testsak
3) After rename mount the fs by lvname then it will have entry in fs file
mount /dev/fslv02
Now new filesystem is mounted and afterwards mount and umount by filename

Permissions / Rights to a Filesystem

To give rights to a mount point enter the following command:

# chown -R oracle:oinstall /fs1

where oracle is user and oinstall is group

No comments:

Post a Comment