Sunteți pe pagina 1din 69

Understanding IBM AIX O.

S easily by Amrik

WARNING
THIS DOCUMENT CONTAINS PRACTICAL COMMANDS, WHICH HELP TO ADMINSTER THE AIX IN A CONVIENENT WAY. BEFORE GOING THROUGH THIS DOCUMENT YOU SHOULD HAVE EXPERINCE OF ADMINSTERING ANY OTHER UNIX O.S. BECAUSE THIS DOCUMENT IS PICTURED MOSTLY ON COMMANDS AND ADMINSTRATION ONLY. NO BASIC IDEA OF AIX IS COVERD, INSTALLATION OF AIX O.S ON SERVER IS ALSO NOT CONSIDERD.

THANKS & REGARDS AMRIK SINGH

Understanding IBM AIX O.S easily by Amrik

Software update/install
Smit install Smit install_update Smit update_all Smit list_install :::To access software installation and maintenance To access Install and Update software. To access update installed software to latest level

:- To access list software installed and related information

smit maintain_software :- allow you to commit, reject, and remove software. This is the path where you can either commit the applied software and remove the older version or you can remove the newer version and use the previous version of fileset/software.

System Environment
smit system ;-- Stopping of system (shutdown), restarting system, change date/time, OS characteristics like max no. of user processes or so on, manage error logs, system dump logs Smit mlang ;-- To change the users or any language environment You can change language using command also :Chlang En_GB Chlang en_GB Chlang c Where En_GB,en_GB,c are languages, you need to logout and login to take effect Ex:Language code UTF-8 UTF-8 Language description Arabic (Algeria) [AR_DZ] Arabic (Bahrain) [AR_BH]

Devices
Smit devices Smit devices list devices list all supported devices Smit tty Smit mktty ;-Adding ASCII terminal

Understanding IBM AIX O.S easily by Amrik

SOFTWARE UPDATES Reports the latest installed maintenance level of the system To determine the maintenance level of the system, type: # oslevel 5.3.0.0 Understanding levels Oslevel output is divided into 4 parts:Version Release Modification fix 5 . 3 . 0 . 0 Version and release updates need to be purchase while modification and fix are free. Fixes are basically developed to resolve bugs for particular application or file set. Suppose if current version of catman command is 4.3.2.0, its giving problem that it doesnt create database for whatis command, then we have to download a fix and applied it on system, after applying out version of catman command changes to 4.3.2.1 If all the fixes are applied to a system and if there is no more fixes are available for a system, then modification field changes. For ex: Lets think IBM has only 255 fixes for catman command and also only 255 is supported for fix field, if all are applied then catman version will be 4.3.2.255, again if its giving any problem, then IBM will developed a new fix for catman bug, but the fix range is ended, in this situation our modification field changes i.e 4.3.3.255 Hope so you all understand this. To determine the file sets that are below level 4.1.2.0, type: #oslevel -l 4.1.2.0 To determine the file sets at levels later than the current maintenance level, type: # oslevel -g | more Fileset Actual Level Maintenance Level ----------------------------------------------------------------------------bos.rte 5.3.0.10 5.3.0.0 To determine the highest recommended maintenance level reached for the current version of AIX on the system, type: # oslevel -r 5300-02 To list all known recommended maintenance levels on the system, type: # oslevel -rq Known Recommended Maintenance Levels -----------------------------------5300-02 5300-01 5300-00

Understanding IBM AIX O.S easily by Amrik

Command :When you are installing software for first time its installed in committed state. When you are installing a fix/modification then you have a choice to install a fix either in Applied state or committed state. A Displays the name, most recent level, state, and description of the specified fileset bos.rte.* # lslpp -l bos.rte.* | more Fileset Level State Description ---------------------------------------------------------------------------Path: /usr/lib/objrepos bos.rte.Dt 5.3.0.0 COMMITTED Desktop Integrator bos.rte.ILS 5.3.0.10 COMMITTED International Language Support bos.rte.SRC 5.3.0.20 COMMITTED System Resource Controller List all installed software # lslpp -L bos.rte.*| more Fileset Level State Type Description (Uninstaller) ---------------------------------------------------------------------------bos.rte.Dt 5.3.0.0 C F Desktop Integrator bos.rte.ILS 5.3.0.10 C F International Language Support bos.rte.SRC 5.3.0.20 C F System Resource Controller F = Fileset C = Commited There are following states of software APPLIED: -We install a fixes in applied state, if we are not sure that weather this fixes will work or not, so that we can remove it easily if its giving any problem, we use applied state. COMMIT STATE: -If we install a package in commit state, it means we are sure it will not give any problem, and fixes are applied permanently, to remove commit state, you have to uninstall package completely BROKEN STATE: - The specified fileset or fileset update is broken and should be reinstalled before being used. APPLYING, COMMITTING, REJECTING ALL THIS STATE means software installation did not complete successfully, and cleanup was not performed. Show the history of software products # lslpp -h bos.rte.* | more Fileset Level Action Status Date Time ---------------------------------------------------------------------------Path: /usr/lib/objrepos bos.rte.Dt 5.3.0.0 COMMIT COMPLETE 08/02/05 08:19:51 bos.rte.ILS 5.3.0.10 COMMIT COMPLETE 08/02/05 08:19:51 List all dependent fileset related to particular package i.e below listed filesets are dependent on bos.rte.boot # lslpp -d bos.rte.* | more Fileset Dependents

Understanding IBM AIX O.S easily by Amrik

---------------------------------------------------------------------------bos.rte.boot 5.3.0.10 bos.rte 5.3.0.10 devices.chrp.base.rte 5.3.0.21 bos.perf.tune 5.3.0.20 Display the name and location of files added to system during installation of fileset # lslpp -f bos.rte.* | more Fileset File ---------------------------------------------------------------------------Path: /usr/lib/objrepos bos.rte.Dt 5.3.0.0 /usr/sbin/dtappintegrate bos.rte.ILS 5.3.0.10 /usr/bin/chlang /usr/bin/dspcat /usr/bin/dspmsg /usr/bin/gencat /usr/bin/locale /usr/bin/locale64 /usr/lib/nls/lsmle To display all files in the inventory database, type: # lslpp -w | more File Fileset Type ---------------------------------------------------------------------------/ bos.rte Directory /usr/aix bos.rte Directory /usr/lpp bos.rte Directory /usr/lpp/bos bos.rte Directory /usr/lpp/bos/inst_root bos.rte Directory Searches a fix for below APAR number #instfix ik IY38674 Install a fix from tape #instfix k IX38674 d /dev/rmt0.1 k stand for fix d stand for destinstion i Inform wheather a fix is installed

BOOTLIST
Check boot priority To list normal booting devices i.e in below output command has listed to 1 disk rootvg hdisk3 and similar mirrored copy hdisk0. Hdisk3 is first bootable device, then hdisk0..and so on # bootlist -m normal -o hdisk3 hdisk0 List if system is booted in maintenance or service mode which will be the first boot device. By default cd0 is first boot device in service mode because in case if system unable to boot from hdisk3 then u can boot then system from bootable exterbal devices like cd, tape and network # bootlist -m service -o

Understanding IBM AIX O.S easily by Amrik

cd0 rmt0 hdisk3 ent0 To make a boot list for Normal mode with devices listed on the command line, enter: #bootlist -m normal hdisk0 hdisk1 rmt0 fd To make a boot list for Normal mode with a device list from a file, enter: # bootlist -m normal -f /bootlist.devs where bootlist.norm is a file containing device names to be placed in the boot list for The device names in the bootlist.devs file must comply with the described format. To boot from a Token-Ring device in slot 2, enter: #bootlist -m normal tok0

Normal mode.

ALOG
Similar to dmesg command of sun which read the log file /var/adm/messages Will list all the log files configured and Defined in system # alog -L boot ------- All Booting related information, all devices configuration info. bosinst -------All information related to unattended installation nim ------console ------- shows all error message displayed on console cfg dumpsymp ---- When a system crash information is stored here All Booting related information, all devices configuration info #alog -o -t boot This command read /var/adm/ras/bootlog file, and put it on screen All information related to unattended installation, BLV, FS, Paging space creation is logged # alog -o -t bosinst This command read /var/adm/ras/bosint.data | more Similarly nim gives u NIM ( Network install manager ) log information. i.e any copy of software is installed on several client at a same time from server is logged here. Command read a /var/adm/ras/nimlog as input Console ----Other log files in /var/adm/ras #more /var/adm/ras/devinst.log All hardware devices and software, successful and unsuccessful installation information are loged here #more /var/adm/ras/BosMenus.log All bos installation information is logged here i.e if new insatllation of bos takes place what menus user have selected while installation is logged here # more /var/adm/ras/image.data We can custimize this image.data file to create our own type and method of system image, this is refer by mksysb command

Understanding IBM AIX O.S easily by Amrik

Please Take a backup of inittab file, I will concentrate on actions only /etc/inittab Identifier: runlevel: action: command Identifier: use the logical device name as identifier Runlevel:- default is 2 , Aix runlevels are 0 to 9. Action: Respawn Wait ::init will start the process again if it dies. wait for other process to complete before starting this process or start the process wait for it to finish before reading second line. start the process and dont restart if it stops command to run before accessing console do not run command

Once Sysinit Off #telinit 2 #telinit q

:::-

-- Request init to put system in run level 2. -- Request init to reread the /etc/inittab file

SRC (System Resource Controller)


SRC controls the subsystem i.e easy to administer the individual subsystem. A subsystem is a program designed to perform a function. Ex:- qdaemon, lpd this subsystem or sub process belongs to spooler subsystem group. ftp, telnet daemon belong to inetd subsystem where inetd belongs to tcpip subsystem group. Will list all groups and subsytem # lssrc -a | more Option a - Lists the current status of all defined subsystem. Status: - If active, means its working and enabled, if Inoperative means its there but not enabled or not active or not working, this are optionals subsystems. Will list SRC status of specific group # lssrc -g spooler IMPORTANT NOTE: - ALL THE PROCESS STARTED BY SRCMSTR i.e SRC MASTER CANNOT BE KILLED BY KILL COMMAND OR DONT KILL IT FORCEFULLY, JUST STOP THAT PROCESS USING STOPSRC COMMAND ONLY.. AMRIK IF ANY GROUP IS SPECIFIED IN /ETC/INITTAB FILE WITH RESPAWN AS ACTION THEN THAT PROCESS CANNNOT BE KILLED OR STOPED Will start the lpd daemon or subsystem # startsrc -s lpd 0513-059 The lpd Subsystem has been started. Subsystem PID is 565328. Option s - subsytem name

Understanding IBM AIX O.S easily by Amrik

If lpd subsystem is started, but not working properly, you dont need to kill just do or To reread this configuration file related to lpd without stopping use this command: # refresh -s lpd 0513-095 The request for subsystem refresh was completed successfully. Will stop the lpd daemon or subsystem # stopsrc -s lpd 0513-044 The lpd Subsystem was requested to stop.

DEVICES /dev :- contain all the logical devices that can be directly accessed by the user. # ls -l | grep ^b and ^c List all block devices in /dev directory starting strictly with first character as b or c Device Configuration Database

Predefined Configuration database This database contains drivers for all Devices for which the system is supported For ex: k/b adapters, Ethernet Adapters System will give driver support for thouShand of devices. This is default database For all devices supported by O.S.

Customized Configuration database This database contain data for all Currently installed and configured Devices or available devices.

If any new device is installed and if cfgmgr command is executed, then cfgmgr first look for driver support in predefined database, if its there then the device get configured automatically, otherwise system ask u for drivers. Cfgmgr command configures your devices automatically on system boot. List all supported Devices Predefined database related command List all predefined devices with header or All devices support listing # lsdev -PH | more class PCM PCM type fcpother scsiscsd subclass friend friend description AIX SCSI/FCP Disk Path Control Module AIX SCSI/FCP Disk Path Control Module

Understanding IBM AIX O.S easily by Amrik

PCM Adapter Adapter Where P : H:-

vscsi baud4232 chrp_ecp

friend isa_sio sa_sio

AIX SCSI/FCP Disk Path Control Module Ultimedia Integrated Audio CHRP IEEE1284 (ECP) Parallel Port Adap

Pulls information from predefined database in ODM Header i.e class, type, subclass, description. Class means what device does or Name os the device i.e disk, tape, cdrom.., Type indicate what model is it or what is the capacity/rpm of devices and Subclass indicates how it can attached to system.

List all Tape class devices supported on system # lsdev -PHc tape ( or disk or adapter or cdrom ) class type tape ost tape scsd tape ost Where c: subclass description fcp fcp iscsi Other FC SCSI Tape Drive FC SCSI Tape Drive Other iSCSI Tape Drive

Specifies the class of devices

List all Supported Type of devices, or capacity of device having 4mm2gb, Since 4mm2gb is Type thats why mention t to extract Type information only # lsdev -PHt 4mm2gb class type subclass description tape 4mm2gb scsi 2.0 GB 4mm Tape Drive

List all Supported scsi related devices on the system. Since scsi is subclass thats why mention s to extract subclass information only # lsdev -PHs scsi class type subclass description array cdrom cdrom cdrom dac7135 scsi 7135 Disk Array Controller cdrom1 scsi CD-ROM Drive enhcdrom scsi Multimedia CD-ROM Drive enhcdrom2 scsi Multimedia CD-ROM Drive

Customised database related commands This will list all devices installed on this system and configured or List all devices found on this system. # lsdev -CH | more name status location description L2cache0 aio0 cd0 dac0 dac1 Available Available Available Defined Defined L2 Cache Asynchronous I/O (Legacy) IDE DVD-ROM Drive 1722-600 (600) Disk Array Controller 1722-600 (600) Disk Array Controller

04-08-00 07-08-02 07-08-02

Status if Available, the device is ready and can be used, Status if defined, the device is unavailable, or not powered ON, devices is added in customized datbase, it has been allocated a logical device name, attributes are also assigned but its not powered ON.

Understanding IBM AIX O.S easily by Amrik

Status if Undefined, Device is supported by system but not configured. It does not reside in customized database. Device with location code is physical devices and devices without location code is logical devices. Extracting and # lsdev -CHc name hdisk0 hdisk1 hdisk2 list disk class information disk status l ocation Available 05-08-00-5,0 Available 05-08-00-8,0 Defined 08-08-02

description 16 Bit LVD SCSI Disk Drive 16 Bit LVD SCSI Disk Drive 1722-600 (600) Disk Array Device

Extract and List ide subclass information # lsdev -CHs ide name status location description cd0 Available 04-08-00 IDE DVD-ROM Drive Bringing the a particular device say cd0 to unavailable state or defined state Plz dont follow this step, below is the proper method of removing hardware # rmdev -l cd0 cd0 Defined # lsdev -CHc cdrom name status location description cd0 Defined 04-08-00 IDE DVD-ROM Drive Where l: - Stands for logical devices name, since above logical name of CDROM is cd0 we are extracting information for particular logical device Executing cfgmgr command to check for new devices configuration, it configure automatically, bring a device into available state from defined state. Since the driver for this devices is available in customized and predefined database, cfgmgr configure it automatically, # cfgmgr # lsdev -CHc cdrom name status location description cd0 Available 04-08-00 IDE DVD-ROM Drive Know removing devices from customized database First bring the device to defined state, this step is very much needed before removing any devices directly. #rmdev l cd0 Know delete the device # rmdev -l cd0 -d cd0 deleted Where d: - Stands for delete mentioned device. Check is it removed successfully # lsdev -CHc cdrom Nothing will appear, since that device is removed completely from database. # cfgmgr

Understanding IBM AIX O.S easily by Amrik

Even after removing, if cfgmgr command is executed, cfgmgr reconfigure that device again, since its supported device # lsdev -CHc cdrom name status location description cd0 Available 04-08-00 IDE DVD-ROM Drive

Bringing a Defined devices to Available state Bring device to define state # rmdev -l cd0 cd0 Defined Check the state # lsdev -CHc cdrom name status cd0 Defined

location 04-08-00

description IDE DVD-ROM Drive

Bring the define state of device to available state using # mkdev -l cd0 cd0 Available # lsdev -CHc cdrom name status location description cd0 Available 04-08-00 IDE DVD-ROM Drive If a devices is removed physically from system to some other area and it is no longer usable, even if that device is showing as defined state then you have to remove it from ODM database also use the following command to do so #rmdev dl cd0 Listing System Attributes List all attributes for devices in the system. # lsattr -EH -l sys0 attribute value Description maxpout maxuproc min_capacity minpout modelname 0 1024 1.00 0 IBM,9110-510

user_settable True True False True False

HIGH water mark for pending write I/Os per file Maximum number of PROCESSES allowed per user Minimum potential processor capacity LOW water mark for pending write I/Os per file Machine name

Where E: - stands for current values or attributes set i.e you can get changes made by a users over here. H: - Header l: - Logical device name If user settable is true means user or admin. Can change this value, if false admin. Cannot changes this value. Since its system related default value which is needed compulsorily to run system. List systems default value for each attributes # lsattr -DH -l sys0 maxpout 0 HIGH water mark for pending write I/Os per file True maxuproc 128 Maximum number of PROCESSES allowed per user min_capacity Minimum potential processor capacity

True False

Understanding IBM AIX O.S easily by Amrik

minpout modelname

LOW water mark for pending write I/Os per file Machine name

True False

List current value of maxuproc attribute for the sys0 # lsattr -EH -l sys0 -a maxuproc attribute value description user_settable maxuproc 1024 Maximum number of PROCESSES allowed per user True List current attribute of cd0 device # lsattr -EH -l cd0 attribute value audio_supported yes

description Play AUDIO supported

user_settable True

To list the current value of the data_verify attribute for the cd0, type the following: # lsattr -EH -l cd0 -a data_verify attribute value description user_settable data_verify enable Software Data Verification False To list the possible values of prevent_eject attribute for cd0 devices # lsattr -EH -l cd0 -a prevent_eject -R no yes Where R: - possible option or value that a user can set. If user settable is True, then user can change the attribute value to either yes or no, but no other value is taken as input inspite or no and yes . Whatever is listed with R option, user can set that value only. ========================================================= Examples of How to change attributes Suppose you want to change the attribute prevent_eject of cdrom, first check the all attributes # lsattr -EH -l cd0 attribute value description user_settable audio_supported cdda_supported data_verify prevent_eject yes Play AUDIO supported True yes CD-DA supported True enable Software Data Verification False yes PREVENT ejection of media when open True

First check what options are there for prevent_eject attribute of cdrom, provided by system # lsattr -EH -l cd0 -a prevent_eject -R no yes Change the device attribute using chdev to no # chdev -l cd0 -a prevent_eject=no cd0 changed Check weather the effect has taken place or not # lsattr -EH -l cd0 -a prevent_eject attribute value description prevent_eject no PREVENT ejection of media when open True

user_settable

Suppose if you forget what is the default value given to this attribute, then use: # lsattr -DH -l cd0 -a prevent_eject attribute deflt description user_settable prevent_eject yes PREVENT ejection of media when open True

Understanding IBM AIX O.S easily by Amrik

This yes indicate that system default value is yes, so that you can change it to default if giving any problem with the current settings. ============================================================== To list the possible values of the login attribute for the tty0 tty device, type the following: #lsattr -l tty0 -a login -R enable disable share delay To list the default attribute values for an cdrom with 48x speed with subclass ide and type cdrom48, type the following: # lsattr -c cdrom -s ide -t cdrom48X -DH attribute deflt description user_settable audio_supported cdda_supported prevent_eject yes yes yes Play AUDIO supported CD-DA supported PREVENT ejection of media when open True True True

To list the current attribute values for an cdrom with 48x speed with subclass ide and type cdrom48, type the following: # lsattr -c cdrom -s ide -t cdrom48X -EH attribute deflt description audio_supported cdda_supported prevent_eject yes yes yes Play AUDIO supported CD-DA supported PREVENT ejection of media when open user_settable True True True

To list the possible values of the prevent_eject attribute for an IDE CDROM, type the following: # lsattr -c cdrom -s ide -t cdrom48X -DH -a prevent_eject -R no yes #lsattr l pty0 E #lsattr l pty0 -D what CFGMGR command do when a new hardware is found Below my own way of understanding how and what cfgmgr do. STEP I Suppose a new CDROM is attached to a system, on the system boot cfgmgr is executed, it will find cdrom, he ask to cdrom who are you, what u r doing here STEP II CDROM replies, I am cdrom, I am attached at so and so location for storage purpose. STEP III

Understanding IBM AIX O.S easily by Amrik

Cfgmgr, please wait I am checking your identity, cfgmgr search for available device drivers in predefined database, if it found then cfgmgr make the device as defined. STEP III Cfgmgr load the device driver to kernel, kernel make a logical entry of the new device cdrom in /dev and cd0 and assign a major and minor number to the device STEP IV Cfgmgr make the device ready and put him in available state.

DEVICE ADDRESSING
SIMPLY, IF A MAN COMES TO BOMBAY AND HE WANT TO GO VASHI, HE HAS ADDRESS IN HIS HAND, WITH THAT ADDRESS HE REACHES HIS DESIRED LOCATION THIS IS CALLED AS LOCATION CODE. EVERY DEVICE HAS A SPECIFIC LOCATION CODE INDICATES WHERE IT IS INSTALLED ON THE SYSTEM. Execute lsdev CH | more to get location code of all devices attached to system. Since lsdev CH reads customized database i.e installed and configured devices on current system, you will get location code of you devices, NOTE: - Devices having location code means its a physical devices attached to system, devices without location code means they are logical devices. Format: AB-CD-EF-GH

IDENTIFYING PCI DEVICES


AB If AB = 00 Any Device attached to processor bus has location code always 00. EX: - Processor, Memory, Primary PCI Bus Lsdev -CH proc0 proc2 Available Available 00-00 00-02 Processor Processor

Clearly shown that 2 processor is there on system and connected to processor bus i.e 00 show you. If AB = 01 A Device is attached to ISA BUS Ex:pci6 Available 01-14 pci7 Available 01-12 pci8 Available 01-16 A Device is attached to PCI BUS

PCI Bus PCI Bus PCI Bus

If AB = 04

Understanding IBM AIX O.S easily by Amrik

EX:cd0

Available 04-08-00

IDE DVD-ROM Drive

From the first value i.e 04 you came to know that its connected to PCI Bus CD If CD = 01 to 99 Identify a slot/ adapter number FOR PLUGGABLE CARDS

CD will show the actual slot number where the card is installed. For Ex: If pluggable card is installed at slot number 3, then Location code will be 04-03 where 04 says you that its a PCI card, attached to PCI BUS and 03 say you that it is inserted in 3rd slot of PCI adapter/bus. cd0 Available 04-08-00 IDE DVD-ROM Drive

This means device is connected to pci bus, its a pluggable device and 08 means its connected to slot no 8 of pci bus (04) Note: - Its logical, all pluggable card is installed in PCI slot only, if it is installed at ISA then location code will be 01-02 where 02 is second slot. If CD = A to Z, 0 FOR INTEGRATED DEVICES This C value will be from A to Z and D value will be 0 Because its given like that CD = A-Z, 0. This comma Distinguishes the difference. For Example, consider keyboard port, which is integrated on the motherboard for keyboard connection has a location code as 01-F0 which means that keyboard adapter is on ISA Bus (01) and that keyboard adapter is integrated on motherboard (F0). Where F is C and 0 is our D.

EF and GH

Not used here.

Examples: 1 - C0 (Standard Serial Port 1) 2 - D0 (Standard Serial Port 2) 01 - F0 (Keyboard) 1 - H0 (Diskette Drive) 04 - B0 (PCI Ethernet Adapter) 04 C0 (Wise SCSI I/O Controller) 04 C0-00-4, 0 (SCSI DISK DRIVE) All Devices connected to ISA BUS and Integrated on Motherboard are :1 - C0 (Standard Serial Port 1) 01- F0 (Keyboard) 01- H0 (Diskette Drive) All Devices Connected to PCI BUS and they are also integrated 04 - B0 (PCI Ethernet Adapter)

Understanding IBM AIX O.S easily by Amrik

04 C0 (Wise SCSI I/O Controller) 04 C0-00-4, 0 (SCSI DISK DRIVE)

IDENTIFYING NON SCSI


In Non scsi devices AB and CD field are same as pci devices only EF and GH values come into picture. Lets Take an example of Multiplexer in Communication department, Multiplexer has upto 16 ports for serial communications, just like switch/hub ports. Asynchronous adapter allows connecting ASCII terminals to a server. Just think you have to connect this card to system, since its an PCI card you go for PCI BUS or slot, then you will check which slot is free to connect this card. Asynch. Adapter allow you to connect 128 serial devices i.e 128 Ascii Terminals you can connect . This card has 2 connectors, each connector support single serial bus. Just think that, on this 2 serial bus multiplexers are connected, you can name this multiplexers as RAN i.e: - Remote Asynchronous Nodes. You can connect multiple multiplexer to single connector since serial bus is there, to connect other multiplexers. The each connector can support upto 4 RANs on each, if you have 2 connector then 4 RANs on ONE and 4 RANs on another i.e I mean to say that you can connect 4 multiplexer on 1 connector and 4 multiplexer on another, Total 8 Multiplexer or RANs can be connected. Connecting is easy but identifying this in system is difficult, but dont worry I will explain you in simple manner. Location Codes: Since asynch. Is a Pluggable device its connected to PCI Bus so AB value is 04, Suppose its inserted in 5th slot, since its a pluggable device CD values varies from 01 to 99, Therefore CD value is 05 since its inserted in 5th slot (05). Therfore upto here AB-CD is 04-05 i.e PCI Async. Card is pluggable and inserted in 5th slot. We have 4 Multiplexer on 1 connector and 4 multiplexer on 2nd Connector. Therefore E values means this devices are connected to which connector, if connected to 1st connector then E value will be 1 and if connected to 2nd connector then E value will be 2. An F value identifies How many number of multiplexer are connected or how many number of RAN are there, starting in ascending order. It can be from 1 to 4, since 4 mupltiplexer or 4 RANS can be connected to single connector. Look into diagram how F value changes, if its 1st device then F=1, for 2nd device F=2, for 3rd device F=3, F values says device sorted numerically. PCI async. Adapter (Then AB=04) 3rd Multxr. Connected to same connector (Then F=3)

Understanding IBM AIX O.S easily by Amrik

2nd Multxr. Connected to same connector (Then F=2)

2 connector (Then E=2)

nd

1 Connector (Then E=1) 1st Multiplexer connected 1st connector (Then F=1)

st

GH This is the port number, i.e if a multiplexer has 16 ports it ranges from 0 to 15

If a ASCII Terminal is connected to port no 7 of multiplexer, then GH field will be 07, think connections of switches and patch chord
EX: 04-05-11-01 :- Forget AB and CD field, E is 1 means its connected to 1st connector, F is 1 this mean it 1st device out of 4 multiplexer. GH is 01 means ASCII terminal is connect to 1st port of multiplexer. Overall view :- Ascii terminal is connected to 1st port of multiplexer, a multiplexer is connect to 1st connector of Async. PCI card, and its 1st device in list. 04-05-13-07: - Forget AB and CD field, E is 1 means its connected to 1 connector, F is 1 this mean it 3rd device out of 4 multiplexer. GH is 07 means ASCII terminal is connect to 7th port of multiplexer. 04-05-21-10: - Forget AB and CD field, E is 2 means its connected to 2nd connector, F is 1 this mean it 1st device out of 4 multiplexer connected to 2nd connector. GH is 10 means ASCII terminal is connect to 10th port of multiplexer. 04-05-22-04: - Forget AB and CD field, E is 2 means its connected to 2nd connector, F is 2 this mean it 2nd device out of 4 multiplexer. GH is 04 means ASCII terminal is connect to 4th port of multiplexer.

IDENTIFYING SCSI DEVICES


SCSI devices are tape, cdrom, external storage, and disks Location code AB and CD field are same as Non SCSI devices, here I will concentrate only on EF and GH values. AB means where the Adapter card is attached, mostly its PCI i.e 04, CD means bus slot number EF :For single SCSI bus - 00 For Dual SCSI bus: Internal Bus :External Bus :-

00 01

G, H

:-

G is for SCSI ID of device i.e SCSI ID is set on device itself or Accomplished by setting jumpers or switches on device H is for LUNs i.e Logical Unit number, which we have created while configuring storage or disk or logical dividing of 2 disk into 4, system consider the 4 division as 4 hard disk on system i.e RAID is configured it will be 0 if there is no RAID or LUN

NOTE: External SCSI disk has an SCSI ID as 6 and External SCSI Tape has SCSI ID as 4, by default in single SCSI Bus, SCSI adapter has an SCSI ID as 7 reserved, thats why SCSI ID is never set as 7

Understanding IBM AIX O.S easily by Amrik

Examples: Suppose TAPE Device is connected it has following location code: 04-01-00-4,0 : - Here AB is 04, CD is 01, EF is 00, G is 4 and H is 0, I will explain you this in simple. Since the SCSI Adapter is inserted in PCI bus therefore AB is 04, All external device are mostly connected on PCI bus. This SCSI adapter which is pluggable inserted in 1st slot of PCI bus its CD value is 01. As its single SCSI bus, its EF value is 00. Value of G is 4 because Tape device connected on system has a SCSI ID as 4. As it is a TAPE device there is no question of LUNS therefore H is 0 SCSI

#lsdev -CHc tape name rmt0 rmt1 status Available Defined location 08-08-00-0,0 06-08-01-0,0 description LVD SCSI 4mm Tape Drive Other SCSI Tape Drive

LVM / STORAGE
LVM DEVICE DRIVERS are /usr/lib/drivers/hd_pin and /usr/lib/drivers/hd_pin_bot, before aix 4.1 the driver was just hd_pin and entire driver are pinned into memory i.e this drivers are not pageable means doest use paging space uses the whole physical memory, but after AIX 4.1 the non pageable portion of drivers are in hd_ping_bot and pageable portion are in hd_pin. The LVM device driver is either called by the jfs filesystem. When a request is received by the LVM device driver, it calls the disk device driver.

LVM contain Volume group (VG) Volume Group contains Physical Volume (PV) Physical Volume has Physical partition (PP) Physical partition has Logical Volume (LV) Logical Volume has Logical Partition (LP) Whenever a new disk is added to a system, it is our physical volume (i.e hdisk0), Or you can say that a new disk is considered as Physical volume when added, logical device name is given by kernel and placed at /dev directory as hdisk0. Then a new disk is added to a volume group, Each PV can have only one Volume group, but volume group can have many Physical volumes or disks. VG is largest unit of storage on system, size of Volume group depends on Number of physical volumes or disk in that VG. For EX:- If we have 5 disk of 4 GB, and if this 5 disk is added in single VG say datavg, then the size of datavg will be 20GB Calculating disk size , PP Size .

Understanding IBM AIX O.S easily by Amrik

Consider with AIX VG with Windows AIX Rootvg Datavg Internalvg windows c: d: e:

A single system has maximum 255 VGs only. Physical Partition is division of physical volume or Number of partition on single Disk PP size can be from 2 to 1024 MB and default is 4MB Default max. PPs each PV is 1016 i.e Maximum number of partitions Each Disk will be 1016 as default. VGDA (Volume Group Descriptor Area) VGDA contain administrative information about VG ie. List of Logical volumes entry, List of Physical volume entries. Its like a database which maintain data integrity and consistency. If any changes are made to logical volumes i.e creation, deletion, expansion then VGDA database is also updated Single disk has one VGDA, VGDA is an area on disk which keeps information of entire VG. To activate Volume group and make it available for use i.e running varyonvg / varyoffvg command, quorum must be available on VGDA. Quorum keeps information about VGDA, some amount of percentage is fixed on disk, and it acts as VGDA Quorum must be 51% or more then the available VGDA. When a volume group consists of one disk, there are two VGDAs on that disk. Thus, this single disk volume group has a quorum vote of 2. When another disk is added to the volume group with an extendvg, then this new disk gets one VGDA, but the Original, first disk still retains the two VGDAs. When the volume group has been extended to three disks, the third disk gets the spare VGDA sitting on the first disk and then each disk has a quorum vote of 1. Every disk after the third disk is Automatically given one VGDA, and thus one vote. VGSA (Volume Group status Area) The Volume Group Status Area (VGSA) is comprised of 127 bytes, where each bit in the bytes represents up to 1016 Physical Partitions that reside on each disk. VGSA are use to determine which physical partition have become stale. Stale means become bad or lacks originality. Below command will list all the logical volumes belongs to particular VG. lsvg -l internalvg lsvg -l rootvg

LVM device drivers are at /usr/lib/drivers as hd_pin and hd_pin_bot SCSI device drivers are at /usr/lib/drivers/hscsidd

Understanding IBM AIX O.S easily by Amrik

The main binary which determines how the partitions are allocated to the users request is /usr/sbin/allocp. The scsi device driver takes a command from a scsi device such as tape, disk, scanner, etc...and processes it to be sent to the scsi device connected onto the scsi bus. The scsi device is device neutral, it does not know or care which device sent it a command or even what that command is. It treats all requests the same and puts them into the same type of scsi command packaging required by all scsi devices. What is PVIDs and how they configure When a disk is configured to a system for the first time, it shouldnt have a PVID if it is a brand new disk. When it is used in a volume group, the user sees a message to the effect of: Making this disk a physical volume Which is another way of saying that a PVID is being placed onto the disk. The PVID is an combination of the machines serial number (from the systems EPROMs) and the date that the PVID is being generated. This combination insures the extremely low chance of two disks being created with the same PVID. Finally, when a system is booted, the disk configurator goes and looks at the PVID sitting on each disk platter and then compares that to an entry in ODM. If the entry is found, then the disk is given the hdiskX name that is associated with the ODM entry for the PVID. If there is no PVID, the configuration routines will automatically assign the next free hdisk name from the pool of free hdisk names. Note that if a hdisk has been removed with the rmdev -l hdiskX -d command, then this hdisk name will be available for reuse by a later disk. Logical Volume Control Block The logical volume control block (lvcb) consists of the first 512 bytes of a logical volume. This area holds important information such as the creation date of the logical volume, information about mirrored copies, and possible mount points in a journaled filesystem. DEFAULT LOGICAL VOLUMES /dev/hd1 /dev/hd2 /dev/hd3 /dev/hd4 /dev/hd5 /dev/hd6 /devhd8 /proc /dev/hd9var /home /usr /tmp for / (root) i.e JFS or JFS2 Boolt logical volumes Contain the boot image Paging space use lsps a to see Journal Log; is a logical volume where any changes made to FS is logged. /proc /var

Special file system to support threads or light weight processes. /etc/filesystems Directives meaning /: dev = /dev/hd4 vol = "root" mount = automatic

Understanding IBM AIX O.S easily by Amrik

check free vfs log type /usr: dev vfs log mount check type vol free

= false = true = jfs2 = /dev/hd8 = bootfs = /dev/hd2 = jfs2 = /dev/hd8 = automatic = false = bootfs = /usr = false : : :

: All logs are logged to /dev/hd8 which is journal log

DEV VOL MOUNT

For local mounts or files/directory to be mounted on volume label i.e root, /usr, /var used by mkfs command Automatic Mount automatically on boot, True Mount on boot ( Used by mountall command, if mountall command is issued, it check first in /etc/filesystem by asking loudly that is anyone there who has mount = true set, if a File system has this value then mountall command will mount it

Check

False Dont Mount on boot, I will mount it manually If True Execute fsck on this filesystem on boot, if any inconsistency detected If Fales Dont execute fsck on this fs on boot even if Filesystem are Inconsistent Specifies type of mount or Type of FS ie. JFS, NFS or so on The log file location, if any changes is made to filesystem where to log or update this information, if not specified then default will be /dev/hd8, you can specify your own path also. use to mount group of filesyetem i.e if its bootfs then mount t will mount all the filesystem which belongs to the bootfs group. Mount t where t means type of fileystem

VFS LOG

: :

TYPE

OPTIONS ACCOUNT FREE

: : :

FILE SYSTEM COMMANDS List all filesystem configured

Understanding IBM AIX O.S easily by Amrik

# lsfs Name Nodename /dev/hd4 -/dev/hd1 -/dev/hd2 -/dev/hd9var -Name Nodename Mount pt VFS Option : : : : :

Mount Pt / /home /usr /var

VFS Size Options jfs2 262144 -jfs2 1048576 -jfs2 4718592 -jfs2 262144 --

Auto Accounting yes no yes no yes no yes no

Partition Name Name of the remote server to mount Files system to mount on Type of File system Can be read/write or readonly

Create a File system using smit fs, and if you want to remove a filesystem then use below commands, please take backup of filesystem before removing, since it will no longer available after rmfs # unmount /test # rmfs /test rmlv: Logical volume fslv04 is removed. Or # rmfs -r test rmlv: Logical volume fslv04 is removed. LOGICAL VOLUMES REALTED COMMAND List Logical volume fslv00 belongs to which PV or how many pv Show the mirrord copies # lslv -l fslv00 fslv00:/sybase PV COPIES IN BAND DISTRIBUTION hdisk0 040:000:000 100% 000:040:000:000:000 hdisk1 040:000:000 100% 000:040:000:000:000 This means LV fslv00 is mirrored copy i.e one copy is on one hdisk0 and another on hdisk1, Logical partitions comes in picture only when you want to create a mirrored copy of your logical volume i.e you have create a logical volume for file system, if you specifies copies as 2, then LV will use 2 physical volumes as mirrored copy for LV. # lslv -l fslv03 fslv03:/backup PV COPIES IN BAND DISTRIBUTION hdisk0 080:000:000 0% 000:000:079:001:000 This means LV fslv03 has only one copy i.e local copy only To increase the size of the logical volume represented by the lv05 directory by three logical partitions, type: #extendlv lv05 3 Suppose you have created a lv with following command : # mklv -y jax -t jfs2 -c 2 -u 2 rootvg 1

Understanding IBM AIX O.S easily by Amrik

i.e Create LV with name jax, file system as jfs2, Number of copies 2, Number of PV to use, to keep this copies are 2 , create LV in rootvg with only 1 LP. To request a logical volume named lv05 with a minimum size of 10MB, type: #extendlv lv05 10M Calculating the Size of LV Number LP X Size of Single PP = Total LV size

LETS UNDERSTAND LV-STATE IN LOGICAL VOLUME AND WHAT IT MEANS Create LV abc with only 1 LP # mklv -y abc datavg 1 abc Where y means use our logical device name i.e abc, test, backup. Instead of system define name i.e lv00, lv01 or #mklv -y test -t jfs2 -c 2 datavg 1 test Check lv name test is created or not # lsvg -l datavg Check the state, without file system created on it. # lslv abc LOGICAL VOLUME: abc LV IDENTIFIER: 00cf3f9d00004c000000010577737308.14 VG STATE: active/complete TYPE: jfs MAX LPs: 512 COPIES: 1 LPs: 1 STALE PPs: 0 INTER-POLICY: minimum INTRA-POLICY: middle MOUNT POINT: N/A MIRROR WRITE CONSISTENCY: on/ACTIVE EACH LP COPY ON A SEPARATE PV ?: yes

VOLUME GROUP: datavg PERMISSION: read/write LV STATE: closed/syncd WRITE VERIFY: off PP SIZE: 128 megabyte(s) SCHED POLICY: parallel PPs: 1 BB POLICY: relocatable RELOCATABLE: yes UPPER BOUND: 32 LABEL: None

Understanding IBM AIX O.S easily by Amrik

Serialize IO ?:

NO

Above command create a LV abc on rootvg with only one Logical partaion. See the LV STATE is closed/syncd, since this abc is newly created LV its LV STATE is closed/synced. LV STATE : opened/syncd ---- LV is mounted and synced means its mirrored Whenever a LV is newly created its LV STATE will be closed/synced, and when a file system is created on this newly created LV, then state will be opened/syncd. Simply :- Closed means not mount, Opened means mounted Closed/stale means not mounted, stale means LV is not synced There is no file system created on this LV abc thats why LV STATE is closed/syncd. Whenever a file system is created and that file system is mounted on LV. LV STATE changes to opend/synced. See below output, I will create LV then I create a File system, upto here also LV STATE is closed/syncd after this I mounted filesystem then its state changes to opend/synced. Finally, LV STATE according to me is Logical volumes state and this state determine weather a filesystem is created on LV or not. # lslv test LOGICAL VOLUME: test VOLUME GROUP: datavg LV IDENTIFIER: 00cf3f9d00004c000000010577737308.14 PERMISSION: read/write VG STATE: active/complete LV STATE: opened/syncd TYPE: jfs2 WRITE VERIFY: off MAX LPs: 512 PP SIZE: 128 megabyte(s) COPIES: 2 SCHED POLICY: parallel LPs: 1 PPs: 2 STALE PPs: 0 BB POLICY: relocatable INTER-POLICY: minimum RELOCATABLE: yes INTRA-POLICY: middle UPPER BOUND: 32 MOUNT POINT: /home/cmsadmin/scripts LABEL: /home/cmsadmin/scripts MIRROR WRITE CONSISTENCY: on/ACTIVE EACH LP COPY ON A SEPARATE PV ?: yes To make a logical volume in volume group datavg with one logical partition and a total of two copies of the data, type: #mklv -y abc -c 2 datavg 1 abc # To request a logical volume with a minimum size of 10MB, type: #mklv datavg 10M # To make a logical volume in volume group datavg with nine logical partitions and a total of three copies spread across a maximum of two physical volumes, and whose allocation policy is not strict, type: #mklv y abc -c 3 -u 2 -s n datavg 9

Understanding IBM AIX O.S easily by Amrik

Creation Of Logical Volumes Create LV abc with only 1 LP # mklv -y abc datavg 1 abc Where y means use our logical device name i.e abc, test, backup. Instead of system define name i.e lv00, lv01 or #mklv -y test -t jfs2 -c 2 datavg 1 test Check lv name test is created or not # lsvg -l datavg Check the state, without file system created on it. # lslv abc LOGICAL VOLUME: abc VOLUME GROUP: datavg LV IDENTIFIER: 00cf3f9d00004c000000010577737308.14 PERMISSION: VG STATE: active/complete LV STATE: closed/syncd TYPE: jfs WRITE VERIFY: off MAX LPs: 512 PP SIZE: 128 megabyte(s) COPIES: 1 SCHED POLICY: parallel LPs: 1 PPs: 1 STALE PPs: 0 BB POLICY: relocatable INTER-POLICY: minimum RELOCATABLE: yes INTRA-POLICY: middle UPPER BOUND: 32 MOUNT POINT: N/A LABEL: None MIRROR WRITE CONSISTENCY: on/ACTIVE EACH LP COPY ON A SEPARATE PV ?: yes Serialize IO ?: NO

read/write

# smit crfs Add JFS2->Add an Enhanced Journaled File System on a Previously Defined Logical Volume --> LOGICAL VOLUME name test + * MOUNT POINT [/home/cmsadmin/scripts] upto here LV STATE is closed/syncd #mount /home/cmsadmin/scripts Know is have mounted my FS, LV STATE changes suddenly to opend/syncd NOTE: No need to create LV first and then File system, you can create both at same time. No need to follow the above steps just use smit fs create fs and enter the desire values ur LV and FS both will get created If your are going to create a File system on Logical volume say abc, then you can create only one FS on one logical volume, you cannot create another file system on same Logical volume abc. This funda clear the point that only File system creation will create logical volume also.

Understanding IBM AIX O.S easily by Amrik

Removing Logical volume First unmount the file system # unmount /home/cmsadmin/scripts if you are in the location /home/cmsadmin/scripts then umount command throws error umount: 0506-349 Cannot unmount /dev/test: The requested resource is busy. Then remove # rmlv -f abc rmlv: Logical volume abc is removed. # rmlv -f test Mirroring Logical volume or File system #mklv -y test -t jfs2 datavg 4 #mklvcopy fslv03 2 hdisk0 hdisk1 where fslv03 is test create a Mirrored copy of test on 2 disk #syncvg v datavg or smit mklvcopy To reduce the number of copies of each logical partition belonging to logical volume lv0112, enter: #rmlvcopy lv0112 2 Reduce the fslv03 LV from 2 LPs to 1 LP i.e remove the copy #rmlvcopy fslv03 1 hdisk1 Understanding Copies, Distribution and In band fileds of lslv l command $ lslv -l fslv03 fslv03:/backup PV COPIES IN BAND DISTRIBUTION hdisk0 080:000:000 0% 000:000:079:001:000 hdisk1 080:000:000 0% 000:000:076:004:000 This command shows the file system is located on how many PV. Copies: Will show the copy or mirrored copy of Logical volume. First field indicate number of logical Partitions, if last 2 fields are 000 and 000 this means that mirrored are reside on different PV. From the above output you came to know that, Number of LP used by /backup or fslv03 file system is 80.

Understanding IBM AIX O.S easily by Amrik

Last 2 fields are 000:000 means mirrored copies lies on different PV, copy are not on same PV. In Band: 0% means No free PPs are available on any region. 100% means if any free PPs found on any region then it will show you 100%.

Distribution: 000 : 000 : 000 : 000 : 000 Outer edge : Outer Middle : Center : Inner Middle : inner edge Ex:- hdisk0 080:000:000 0% 000:000:079:001:000 From copies we came to know that it has total 80 LPs, mirrored on different PVs and From Distribution we came to know that How total 80 LPs is distributed in the region, i.e we have Total 80 LPs, 79 LPs is on center and 1 LP lies on Inner middle, similarly hdisk1 080:000:000 0% 000:000:076:004:000

Since its a mirrored copy, it show total 80 LPs, this 80 LPs is divided as 76 LPs on center and 4 LPs on inner middle. $ lslv -l fslv02 fslv02:/syblog PV COPIES IN BAND hdisk0 040:000:000 100% hdisk1 040:000:000 0%

DISTRIBUTION 000:040:000:000:000 040:000:000:000:000

FIRST UNDERSTANDING FREE DISTRIBUTION #lspv hdisk1 PHYSICAL VOLUME: hdisk1 VOLUME GROUP: rootvg PV IDENTIFIER: 00cf3f9d9c4cab2f VG IDENTIFIER 00cf3f9d00004c000000010577737308 PV STATE: active STALE PARTITIONS: 0 ALLOCATABLE: yes PP SIZE: 128 megabyte(s) LOGICAL VOLUMES: 13 TOTAL PPs: 546 (69888 megabytes) VG DESCRIPTORS: 1 FREE PPs: 243 (31104 megabytes) HOT SPARE: no USED PPs: 303 (38784 megabytes) MAX REQUEST: 256 kilobytes FREE DISTRIBUTION: 29..00..00..105..109 USED DISTRIBUTION: 81..109..109..04..00 Consider the above output, just concentrate on Free and used distribution. This show the area in which free PPs available and area in which PPs are used. The same distribution is also shown by following command, you will no get an clear idea about free PPs, Used PPs and Region in which they belong, with lspv hdisk1 command, execute the below command the get a clear picture of PPs. #lspv p hdisk1 Know lets discuss the lspv hdisk1 command FREE DISTRIBUTION: 29 .. 00 .. 00 .. 105 .. 109 Oe .. om .. c .. im .. ie

Understanding IBM AIX O.S easily by Amrik

This means Free that 29 Free PPs are available at outer edge, 105 Free PPs are available at Inner middle and 109 free PPs are available at inner edge regions. Where oe is outer edge, OM is outer middle, c is center and im is inner middle and so on. Similar explanation is for Used Distribution.

Utilizing Free PPs $ lspv -p hdisk0 hdisk0: PP RANGE STATE 1-1 used 2-67 free 68-70 used 250-328 used 329-329 used 330-437 free 438-546 free

REGION outer edge outer edge outer edge center inner middle inner middle inner edge

LV NAME hd5 hd6 fslv03 fslv03

TYPE boot paging jfs2 jfs2

MOUNT POINT N/A N/A /backup /backup

Free means Free PPs are available in that region, used means all PPs are used. You can get same output from lspv hdisk0 command also. Create a file anywhere and specify the PP range in below format only # vi test hdisk0:330 hdisk0:331 save it exit # mklv -y ltest -t jfs2 -m /home/cmsadmin/test rootvg 2 ltest Will create ltest with 2 PPs. #lspv p 330-331 332-437 438-546 hdisk0 used inner middle ltest free inner middle free inner edge jfs2 N/A

Note:- Creating to use exact PP Range is not recommended. STALE PPS IN LV #lslv fslv03

Understanding IBM AIX O.S easily by Amrik

If LV STATE:- Stale, then it means LV is not synchronized, and stale PPs shown will be 2 and if its synched the stale PP will be 0 and if Logical volume is mirrored and if its copies is not up to date then also it shows you stale Reorganize the logical volume If the intra physical policy of any LV is changed after the LV is created, PPs related to this LP are not automatically relocated. Reorgvg command is used to redistribute the PPs according to our preferred policy. #Smit reorgvg or Reorganize fslv02 and fslv03 from the datavg. #reorgvg datavg fslv02 fslv03 RENAMING LOGICAL VOLUME NAME Create a mirrored LV # mklv -y jill -t jfs2 -c 2 -u 2 rootvg 2 Rename the LV name from jill to jid #chvg n jid jill

PHYSICAL VOLUMES RELATED COMMANDS To display the status and characteristics of physical volume hdisk1 by physical partition number # lspv -p hdisk1 hdisk1: PP RANGE STATE REGION LV NAME TYPE MOUNT POINT 1-1 used outer edge hd5 boot N/A 2-70 free outer edge 71-110 used outer edge fslv02 jfs2 /syblog 111-126 used outer middle hd6 paging N/A 127-166 used outer middle fslv01 jfs2 /sybdata 167-206 used outer middle fslv00 jfs2 /sybase To display the status and characteristics of physical volume hdisk3, enter: #lspv hdisk3 To display the status and characteristics of physical volume hdisk5 using the volume group ID, enter:

Understanding IBM AIX O.S easily by Amrik

#lspv -v 00014A782B12655F hdisk5 To close physical volume hdisk03 enter: #chpv -v r hdisk03 The physical volume is closed to logical input and output until the -v a flag is used. To open physical volume hdisk03, enter: #chpv -v a hdisk03 The physical volume is now open for logical input and output. To stop the allocation of physical partitions to physical volume hdisk03, enter: #chpv -a n hdisk03 No physical partitions can be allocated until the -a y flag is used. To clear the boot record of a physical volume hdisk3, enter: #chpv -c hdisk3 MIGRATING DATA FROM ONE PV TO ANOTHER WITHOUT ANY LOSS. #mklv y seme t jfs2 datavg 1 #smit crfs create file system name seme #mount the file system and create a data # migratepv -l seme hdisk0 hdisk1 Know execute migratepv command which move your file system from hdisk0 to hdisk1, do this only if you find high I/O on hdisk0 and users are getting low performance.

VOLUME GROUP RELATED COMMAND Will list all Active VGs in a system. #lsvg -o Physical Volumes Definations Physical volumes, also known as direct access storage devices (DASDs), are fixed or removable storage devices Block is a contiguous, 512-byte region of a physical volume Partition is a set of blocks (with sequential cylinder, head, and sector numbers) contained within a single physical volume. physical volume is divided into five regions (outer_edge, outer_middle,center, inner_middle, and inner_edge) Limitation of LVM for VG, PV, PP, LP. Volume Group: Maximum volume group you can create on each system is only 255

Understanding IBM AIX O.S easily by Amrik

Physical Volumes: Max PVs per VG : - 32 (Normal VG) selected Max PVs per VG : - 128 (BIG VG) selected Physical Partitions: If Big VG is selected, then max PP will be 1016 for 128 disk drives and 1016 for 32 disk drive in case of Normal VG. Logical/Physical Partition Size: Default SIZE is 4mb and max size ranges from 2 mb to 1024 mb. This value get divided by total number of disk size in single VG. For ex: if we have 3 disk of size 400MB each, then Total disk size is 1200 MB In volume group say datavg, and you have selected a PP size of 4 MB, then total PPs on this VG will be calculated as 1200 / 4 : - 300 Physical partition is possible on this datavg volume group List logical volumes by VG Name and there characterstics lsvg l rootvg # lsvg -l rootvg rootvg: LV NAME hd5 hd6 hd8 hd4 hd2 TYPE boot paging jfs2log jfs2 jfs2 LPs 1 16 1 1 18 PPs PVs LV STATE 2 2 closed/syncd 32 2 open/syncd 2 2 open/syncd 2 2 open/syncd 36 2 open/syncd MOUNT POINT N/A N/A N/A / /usr

Give information about all PV in system. $ lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs hdisk0 active 546 299 hdisk1 active 546 379 CALCULTAING DISK SPACE AND PP SIZE

FREE PPs FREE DISTRIBUTION 69..13..00..108..109 69..13..79..109..109

$ lsvg rootvg VOLUME GROUP: rootvg VG IDENTIFIER: 00c493ae00004c0000000103ff22db4d VG STATE: active PP SIZE: 128 megabyte(s) VG PERMISSION: read/write TOTAL PPs: 1092 (139776 megabytes) MAX LVs: 256 FREE PPs: 624 (79872 megabytes) LVs: 14 USED PPs: 468 (59904 megabytes) OPEN LVs: 13 QUORUM: 1 TOTAL PVs: 2 VG DESCRIPTORS: 3 STALE PVs: 0 STALE PPs: 0 ACTIVE PVs: 2 AUTO ON: yes MAX PPs per VG: 32512 0

Understanding IBM AIX O.S easily by Amrik

MAX PPs per PV: 1016 MAX PVs: 32 LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no HOT SPARE: no BB POLICY: relocatable Suppose we have a 2 disk of 72 GBs each i.e Total 139776 megabytes or 144 GB, And we are adding this to a single VG, say datavg, know before creating any VG we have to decide the partition size in MB, i.e what is the size of each PP in this VG. If we hve selected PP size as 128, then its get divided by Total size of disk added to a single VG i.e datavg, as we hve 2 disk of 144 GB it will be 139776 in MBs, out input value i.e 128 PP size will give us a below Total Number of partition we can create. 139776 ( size of all disk in single VG)/ 128 ( PP size selected while adding VG) = 1092 i.e we can create total 1092 partitions on datavg volume group. If we select a PP size of 512 MB, then total PP we can create on This VG is: - 273 only. if you increase the PP size, then you are decreasing the number of partition on single VG. Before creating any VG, this PP size is to be keep in mind. See below the ouput of single disk, I have just selected hdisk1 $ lspv hdisk1 PHYSICAL VOLUME: hdisk1 VOLUME GROUP: rootvg PV IDENTIFIER: 00cf3f9d9c4cab2f VG IDENTIFIER 00cf3f9d00004c000000010577737308 PV STATE: active STALE PARTITIONS: 0 ALLOCATABLE: yes PP SIZE: 128 megabyte(s) LOGICAL VOLUMES: 12 TOTAL PPs: 546 (69888 megabytes) VG DESCRIPTORS: 1 FREE PPs: 379 (48512 megabytes) HOT SPARE: no USED PPs: 167 (21376 megabytes) MAX REQUEST: 256 kilobytes FREE DISTRIBUTION: 69..13..79..109..109 USED DISTRIBUTION: 41..96..30..00..00 PV always inhert PP size of VGs PP size, due to this you can calculate how many PPs can be created on this single disk. 69888 / 128 = 546 i.e 546 Partitions can be created on this single disk. Create VG Smit mkvg or #mkvg f y newvg s 8 hdsik5 s stands for: - PP size, 8 is PP size in MB i.e create VG with PP size of 8 MB. f stands for: - Force creation of VG (this is optional) Create VG of 2 MB PP size, with maximum number of PP per vg, #mkvg -s 2 -t 2 -y newvg hdisk1

Understanding IBM AIX O.S easily by Amrik

Maximum PP available per VG by AIX is 2032, here we have givel a T-factor as 2 therefore 2032 X 2 = 4064 MB or Total size of disk you get is 4 GB. Remove VG Smit reducevg2 To remove physical volume hdisk1 from volume group vg01, enter: #reducevg vg01 hdisk1 To remove physical volume hdisk1 and all residing logical volumes from volume group vg01 without user confirmation, enter the following command. Attention: The reducevg command with the -d flag automatically deletes all logical volume data before removing the physical volume. #reducevg -d -f vg01 hdisk1 Change VG, ExtendVG, remove PV from VG Smit vgsc To add physical volumes hdisk3 and hdisk8 to volume group datavg, enter: #extendvg datavg hdisk3 hdisk8 or Extend rootvg #extendvg f rootvg hdisk5 To remove a added disk hdisk5 from rootvg execute the below command #reducevg rootvg hdisk5 or smit vg show/characterstics of VG VG Name PV Name Force deallocation Press Enter :::rootvg hdisk5 no or yes

Show what major numbers are free, that is being assigned to device # lvlstmajor 41... Almost all the devices in /dev directory has the major and minor number. List Max. Logical track group size on hdisk0 $ lquerypv -M hdisk0 256 Extend Volume group size, if LUN size is increased through storage manager, If original size of newvg is 5GB detected by AIX kernel and if you have increased the LUNS from 5GB to 10 GB, this will not understand by AIX, it will still show you 5 GB, to regain the increased size just execute the below command, it will take the increased size and know if you run lsvg newvg you will get 10 GB. #chvg g newvg

Understanding IBM AIX O.S easily by Amrik

FILE SYSTEM
Block is a contiguous, 512-byte region of a physical volume 2 Type of block : - Data block and Indirect block. Data block: - Contain Data Indirect block: - Contain pointer to data block. Super Block is first addressable logical block on file system, keeps information related to file size, file name, number of inodes, date/time of creating file. Always written or placed in block 31. By default a single file within a file system have allocated some space i.e in unit in block of 4096 bytes (4 k). This means every file in file system is allocated with default block unit of 4096 bytes (4 k). Data structures that contain information about files in Unix file system, that are created when a file system is created. Each file has an inode and is identified by an inode number (i-number) in the file system where it resides. inodes provide important information on files such as user and group ownership, access mode (read, write, execute permissions) and type. There are a set number of inodes, which indicates the maximum number of files the system can hold. A file's inode number can be found using the ls -i command, while the ls -l command will retrieve inode information. Inodes follows after super block, which contain identifying information for files such as file type, size, permission, users/groups/others ownership, user ID, group ID, Number of links, time modified, time accessed, time changed, Contain pointer to data block. Will show you # ls li /nbtest 16384 drwxr-xr-x 3 root system 4096 Nov 29 10:46 changes 24608 drwxr-xr-x 3 root system 256 Dec 31 02:30 scripts Where 16384, 24608 are number of Inodes associated with file or directory. Will list you inode information on file, # istat smit.log Inode 4340 on device 10/8 File Protection: rw-r--r-Owner: 1005(cmsadmin) Group: 3(sys) Link count: 1 Length 100696 bytes Last updated: Tue Jan 10 17:06:46 IST 2006 Last modified: Tue Jan 10 17:06:46 IST 2006

Understanding IBM AIX O.S easily by Amrik

Last accessed: Thu Dec 29 15:24:38 IST 2005 Last updated: - If the size of file increased then this field show you change, Last modified: - If you have open a file and added something in it ot you have just modified the content of file then this field show you change. If modified time changes updated time also changes. Last accessed: - File access lastly. Partition is a set of blocks (with sequential cylinder, head, and sector numbers) contained within a single physical volume.

FILE SYSTEM FRAGMENTATION


Since by default a JFS allocate 4096 bytes of block size to each file. Fragmentation provide a way to allocate pieces of 4096 bytes logical block to file and directory. Fragment size is applied at creation of file system time only, valid option are 512, 1024, 2048, 4096 bytes. Default is 4096 bytes. Suppose your file size is of 2000 bytes or you have created a file of 2000 bytes, default fragment size is of 4096 byte, i.e one block is of 4096 bytes, File system allocates data block to a single file of 4096 bytes. So this 2000 bytes size file will allocate only 2000 bytes, rest of the block space is unused and its also unusable by another file. NO FRAGMENTATION FILE SIZE IS OF 2000 BYTES 2000 BYTES

This Free space is cannot be used by another files because the no fragment size is selected while creating file system, so by default JFS allocates default block size of 4096 bytes i.e every file is allocated with a block of 4096 bytes. If the file size is of 4000 bytes then a complete block is used, but in above case only half of the block is used and remaining space in a block is unusable by another file. =============================================== FRAGMENTATION FILE SIZE IS OF 2000 BYTES FRAGMENT SIZE TAKEN WHILE CREATING FILE SYSTEM IS 1024 BYTES 2000 - BYTES 1024 block

Understanding IBM AIX O.S easily by Amrik

1024 block

1024 block

1024 block

Free fragment can be used by another files. See here if fragment size is imposed on file system is 1024, then file is being allocated a block size of 1024 bytes only, then our 2000 bytes file will use on 2 block i.e 1024 + 1024 = 2028. But still the last 28 block space is unused. Because 28 bytes is still left from above blocks. If fragment is enabled, then a disk block is made of size as specified in fragment size, as above case its 1024 therefore a disk block of 1024 bytes is being allocated to every files. Large fragment block size can also improves disk I/O, suppose file size is of 4096 bytes and fragment size is of 4096 bytes, then a single disk block is read while performing read operation by disk to read a single data, it mean only single disk I/O operation is being performed, therefore less disk I/O operation is there, if fragment size is of 2094 block, then two I/O operation is to be performed to read a same data, thus I/O is increased, increase in I/O cause performance degradation. This is how fragmentation works.

NBPI (NUMBERS OF BYTES PER INODES)


JFS only support NBPI and fragment size, this is not valid or used by JFS2 file systems. Disk space is only one of the file system resources required by files and directories: each file or directory also requires a disk i-node. If more or fewer number of i-nodes are required then the default i-nodes given by JFS. This number of disk i-nodes can be specified at file system creation as the number of bytes per i-node (NBPI). For example, an NBPI value of 1024 causes a disk i-node to be created for every 1024 bytes of file system disk space i.e if disk block size is of 1024 bytes and also file system NBPI value is of 1024 bytes, then a single file of 1024 bytes refer 1 inode, if NBPI value is 512 bytes then a single file of 1024 bytes refer 2 inodes in a single file system. If NBPI value is = 4096 bytes, then an inode is created for every 4096 bytes in file system, you can say that every 4096 byte, a block is constructed , so every 4096 byte of block a inode is created. If NBPI value is small, then you can use large Inode. If NBPI value is large, then you can use less inodes means you can create less files. NBPI and Fragment fields are not supported in JFS2.

ALLOCATION GROUP SIZE

Understanding IBM AIX O.S easily by Amrik

For grouping related inodes, allocation group size is required, inodes are grouped into logical units of 8,16,32, or 64 MB, within file system.

FILE SYSTEM
JFS support individual file size from 2 GB to 64 GB. JFS2 support individual file size of 1 TB. JFS FILE SYSTEM LIMIT CALCULATION MAX FILE SYSTEM SIZE IN BYTES = FRAGMENT SIZE x 228 EX: IF Fragment and NBPI value is 4096 then total file system size in bytes will be as: - 212 (where 212 =4096) X 228 = 1 Terabyte OR MAX FILE SYSTEM SIZE IN BYTES = NBPI x 224 NOTE: - While creating file system an option appears like mount option, Which give you 2 sub option like nodev and nosuid Nodev means: - You cannot run any open system calls, Nosuid means: - You cannot run any program if suid is not set on a program. EX:- smit fs Add jfs datavg mount options. Smit fs, smit jfs (fast path for jfs), smit jfs2 (fast path for jfs2), smit crjfslvstd (Create JFS on a previously defined logical volume), Smit crjfsstd (Create standard JFS) Smit cejfs2lvstd (Create JFS2 on a previously defined logical volume)

COMPRESSED FILE SYSTEM


This file system saves disk space by allowing logical block to stored on disk smaller than the full block size of 4096 bytes. Compress or decompress make our logical block size to be resized. If 2 block are required to store a file on disk, and if a file system is compress then it will use only 1 block inspite of 2 blocks, and when a file decompress then again one more block is required. Root file system must not be compresses, /usr compression is not recommended. 50 CPU cycles is required to compress 1 byte of data, 10 CPU cycles per byte for decompression.

Understanding IBM AIX O.S easily by Amrik

LARGE FILE ENABLED FILE SYSTEM

In Large file enabled, if data or file stored before 4 MB file offset is allocated in 4096 byte block, after 4 MB file offset is allocated in 128 KB size disk block each. 1 2 3 . . 1023 1024 1025 1026 . . . 1055 1056

Each block is of 4096 bytes, Total 1024 disk blocks required for of file.

4 MB

Each block is of 128 KB, Total 32 contiguous disk block are required for each 128 KB of disk block. i.e Here Each 128 KB block consist of 32 block of 4096 bytes. See the calculation below

Simply follow this formula to calculate: 1 KB = 1024 bytes, 1 MB = 1024 KB. Consider a file of 132 MB, see how its divided in file system. First 4 MB will come under the category of 4096 blocks offset, i.e (1024 * 4 KB disk block = 4 MB) or (1024 * 4 * 1024 bytes disk block = 4 MB) The remaining 128 MB is above 4 MB, therefore comes under the category of 128 KB disk block, therefore this 128 MB size data is stored on 128 KB disk block as (1024 * 128 KB = 128 MB) or (1024 * 128 * 1024 bytes = 128 MB) Lets calculate how many disk block of 4096 comes under 128 KB disk block size:First Converting 128 KB into Bytes 128 X 1024 = 131072 bytes i.e 128 KB Dividing the total value by 4096 since each disk block is of 4096. 131072 / 4096 = 32, i.e 32 contiguous disk block of 4096 bytes is required for each 128 KB of disk block (1024 * 4 KB disk block) 4 MB Consider in Bytes: + (1024 * 128 KB) 128 MB = = 132 MB 132 MB

Understanding IBM AIX O.S easily by Amrik

(1024 * (4 * 1024)) 4194304 bytes

+ +

(1024 * (128 * 1024)) 134217728 bytes =

138412032 bytes

JOURNAL LOG
If any changes is made to FS, its first logged in jfs2log, then a changes is applied to JFS, this is done sync system call, which run after every 60 seconds. Contains sync pointer, if any thing is written on disk, and sudden crash happens, then after reboot data will be written to the area from where its stopped last, i.e continuity is maintain by JFSLOG, disk read from jfslog and write to the disk.

INLINE LOG
It will log all read/write operation within file system.

SPACE MANAGEMENT
Show used space in 512 byte blocks #df I CONTROL GROWING FILES /var/adm/wtmp /var/spool/*/* $HOME/smit.log $HOME/smit.script $HOME/smit.transaction $HOME/websm.log $HOME/websm.script /etc/security/failedlogin /var/admsulog /tmp

Clearing the printer Queue #stopsrc s qdaemon #rm /var/spool/lpd/qdir/* #rm /var/spool/lpd/stat/* #rm /var/spool/lqdaemon/*

Understanding IBM AIX O.S easily by Amrik

#startsrc s qdaemon

PAGING SPACE
Whenever a program or application is executed, it come in RAM first become a Process/daemon or for process to be actively running, it must be loaded in memory. When its loaded into memory or whenever any program or binary comes in memory it become a process, and it is assigned with number of 4k areas called page frame in Real Memory. As more processes are loaded into memory, memory becomes full, not everything that resides in memory is active, some processes are in sleep state, some in wait state, when memory gets full, memory is scanned to locate those page frames that are not required currently or less recently used, whenever any process found to be in this state, a 4KB block or page is allocated and data from the page frame is moved to disk, this is called as paging space. Number of page frame move to disk is called page out (po). Number of page frame needed and brought back in memory is called page in (pi). Paging is temporary holding area for inactive processes, its not substitute for real memory. Machine should have enough Real memory to hold all active processes, increasing paging space on disk will not solve this problem, when your machine dont have enough real memory, you have increased paging space, but the number of active processes are very high, then your machine will reach a constant state of paging called thrashing. NOTE: - Thrashing is result of less Physical memory.

PAGING SPACE CREATION If Physical RAM is >= 64 MB then Paging space = Physical RAM size + 16 MB If Physical RAM is < 64 MB then Paging space = twice the Physical RAM size LOW PAGING SPACE INDICATION
If paging space is low on disk, also your Real memory is full but have many inactive processes but there is no more space available on disk to perform page out process, then the system will unable to start any new processes until some running processes is terminated or released to disk, so if you see below messages then paging space is less: -

Init: paging space is low, Cannot fork no swap space, No enough memory Fork function failed, Fork () system call failed, Unable to fork, too many processes, Fork failure not enough memory available, Fork function no allowed, Cannot fork: not enough space.
List paging Summary report $ lsps -s Total Paging Space Percent Used

Understanding IBM AIX O.S easily by Amrik

4096MB

39%

ADDING/CHANGING/REMOVING/DECREASING PAGING SPACE Paging space created during system installation is named as hd6, after installation name will be paging00, paging 01. and so on. #more /etc/swapspaces contain list of paging space that will be activated at system startup. * * This file is modified by the chps, mkps and rmps commands and referenced * by the lsps and swapon commands. hd6: dev = /dev/hd6 INCREASING PAGING SPACE To increase the size of paging space more then the currently installed, then #Smit mkps Volume group name rootvg SIZE of paging space (in logical partitions) [16] PHYSICAL VOLUME name hdisk1 Start using this paging space NOW? yes Use this paging space each time the system is yes RESTARTED? # +

Volume group, select the VG, if you are increasing the paging space, it is better to use different disk or VG for better performance. Size in LP, if you each PP size is of 128 MB, since LP = PP, then LP is also of 128 MB If your current paging space is of 2 GB i.e 16 LPs, and you want to increase up to 4 GB, then enter 16, then your total paging will 4 GB. Select the PV, its better to select different PV, then the PV on which currently paging space is defined, for improve in performance. OR #mkps s 16 n a rootvg -s : - define size in LPs -n : - Activate paging space immediately -a : - Activate paging space on every restart and add a entry in /etc/swapspaces

ADDING NEW PAGING SPACE

Understanding IBM AIX O.S easily by Amrik

#smit mkps Volume group name datavg SIZE of paging space (in logical partitions) [2] PHYSICAL VOLUME name hdisk1 Start using this paging space NOW? yes Use this paging space each time the system is yes RESTARTED? Or #mkps s 2 -n a datavg hdisk1 ANOTHER METHOD OF CREATING NEW PAGAING SPACE Step I #smit mklv Logical volume NAME * VOLUME GROUP name * Number of LOGICAL PARTITIONS PHYSICAL VOLUME names Logical volume TYPE

[paginglv00] rootvg [2] [hdisk1] [paging]

Or #mklv t paging y paginglv00 rootvg 2 hdisk1 Step II #swapon /dev/paginglvoo (Activate the paging created) Step III # lsps a (check the paging space listed) DECREASING PAGING SPACE This is done by smit chps or chps command, infact while decreasing the paging space a scripts name shrinkps is called to reduce the active paging space size. 1. Create temp. paging space from the same VG on which paging space is to be reduced. #mkps -a -n -s 30 rootvg hdisk0 Deactivate the original paging space i.e hd6. #swapoff /dev/hd6 Reduce the original paging space #chps d 16 hd6 ( reducing the paging space, that reducing 16 LPs) Reactivate the origignal paging space #swapon /dev/hd6 or #swapon a (To activate all paging space defined in /etc/swapspaces)

2. 3. 4.

Understanding IBM AIX O.S easily by Amrik

5.

Deactivate and remove temporary paging space #swapoff /dev/paging00

#chps d 2 paging00 (decreasing user specific paging space by 2 LPs)

BACKUP/RESTORE
UNDERSTANDING HOW DATA IS WRITTEN/READ FROM/TO TAPE(AIX) by Amrik
Tape devices support multiple tape files. Tape files are the result of a backup/cpio/tar/dd type command, where the device is opened, written to, and closed. Because tapes allow large Quantities of data to be written on a single tape, several backups (that is, tape files), may be combined on one physical tape. Between each tape file is a "tape file mark" or simply "file Mark". The device driver to indicate where one tape file ends and another begins uses these file marks. B E O O -------> T T __ ___________________________ ______________ physical | \ | | \ |physical beginning| \ | tape | \ | end of | \ | file | \ | of tape | \ | mark | \ | tape |_____\________|_______|__________\_________| <------Note that there is a distinction between the beginning of tape (BOT) side of a file mark and the end of tape (EOT) side of a file mark. If the head is on the BOT side of a file- mark, "tctl fsf 1" command will move only to the EOT side of the same file mark. With the 1/4" tape drive, writing can only take place sequentially, or after blank tape has been detected. You cannot

Understanding IBM AIX O.S easily by Amrik

write over data on the tape (except at BOT). If you wish to add data to a tape which has been written and then rewound you should space forward file mark until an error occurs. Only then can you start writing again. With an 8mm tape drive, writing can only take place before blank tape, an EXTENDED file mark, or at BOT. Thus if several backups have been made on one tape and you wish to overwrite one of the backups, position the tape to the place you wish to start writing and issue the following commands: tctl bsf 1 tctl eof 1 The first command skips back to the BOT side of the same file mark. The second command rewrites the file mark (writing is allowed before extended file marks). The erase head will erase data ahead of the write head, so that after writing the file mark the head will be positioned before blank tape. Only after this may you start writing over data in the middle of the tape. (All data beyond where you are currently writing will be lost). Note that you cannot write over short file marks. In order for this to work, the tape must have been written with extended file marks (use smit to change this). With the 9-track drive writing can take place anywhere on the tape although overwriting single blocks of data is not supported. On the 8mm drive extended filemarks use 2.2 megabytes of tape and can take up to 8.5 seconds to write. Short filemarks use 184K and take up to 1.5 seconds to write. BLOCK SIZES: When data is written to tape it is written in blocks. The blocks on a tape are separated by inter-record gaps. It is important to understand the structure of the written tape in order to Understand the problems, which can occur with changing block sizes. In fixed block size mode all blocks on the tape are the same size. They are the size of the block size set in the device configuration. All read()s and write()s to the tape drive must be a multiple of the fixed block size. In fixed block mode a read () will return as many blocks as needed to satisfy the read() request. If a file mark is encountered while reading the tape only the data up until the file mark will be returned. It is not possible for the tape drive to read a tape whose block size is not the same as the block size in the device configuration. (Unless the device configuration is in variable size blocks.) In variable block size (0) mode, the blocks written on the tape are the size of the read() and write() requests to the device driver. In this case, the actual block sizes on the tape can be changed using the options to the backup commands (tar -C, cpio -C, backup -C). In variable mode, read() requests greater than size of the block on the tape will return only the data from the next block on the tape. It is this feature that allows tapes written in any block size (fixed or variable) to read with the dd command (the output from the dd command may be piped to restore, tar, or cpio for example.) Note that backup, tar, and cpio cannot read all tapes by using a large block size because they assume there is an error if they get a short read(). dd ibs=128k obs=16k if=/dev/rmt0 | ... The tape head is always positioned at an inter-record gap, file mark, or blank tape after reading or writing.

Understanding IBM AIX O.S easily by Amrik

With the 8mm tape drive, using a fixed block size which is not a multiple of 1K is inefficient. The 8mm tape drive always writes internally in 1K blocks. It simulates the effect of variable block sizes, but, for example, using a fixed block size of 512 bytes (or using variable block size and write()ing 512 bytes at a time) wastes one half of the tape capacity and gives only one half the maximum transfer rate. To figure out a tape's actual block size try: Dont test this on live servers. 1). Set the tape to variable block size. 2). "dd if=/dev/rmt0 of=/tmp/dummy bs=128k count=1" 3). "ls -l /tmp/dummy" 4). The number of bytes in "/tmp/dummy" is the physical block size. Many tape drives support both variable and fixed block sizes. Variable block mode writes block sizes the size of the write command issued (tar and backup specify this with the -b option). In fixed mode, block sizes are fixed and all writes must be a multiple of the fixed block size. Unix often internally chops larger reads and writes up into manageable pieces (often 65535, 65534, or 65532 bytes) before doing the actual reads and writes. This means reads and writes of 64K bytes are often broken up into a 65535 byte record and a 1 byte record (In fixed mode the write will fail). Block sizes >= 64K (-C128 and greater) should be avoided for this reason. AIX does not break up read and write requests, but be aware of the situation on other machines. If the tape is written in an unknown block size then set the device configuration in smit to use variable size blocks, use the "dd" command with a large input block size, and pipe it to the restore command. For example: chdev -l rmt0 -a block_size=0 dd if=/dev/rmt0 ibs=128k obs=16k | tar -tvfAIX has the World's Only Variable Block Size 1/4" tape drive. If you use SMIT to set the block size to a nonzero value, AIX treats the device as fixed block size, whether it is or not. By default, 8mm drives are set to the same size as 1/4", 512 bytes. This is wasteful, but otherwise mksysb and installp would fail. If you set the block size to 0, the device is treated as variable block size, and the size passed to write becomes the physical block size. Then if you use a sensible block size to dd, all should be wonderful. Backup Command and SMITTY MKSYSB #Smit mksysb OR To generate a system backup and create an /image.data file to a tape device named /dev/rmt0, type:#mksysb -i /dev/rmt0

Understanding IBM AIX O.S easily by Amrik

To generate a system backup and create an /image.data file with map files #mksysb -m /dev/rmt1 To generate a system backup with a new /image.data file, but exclude the files in directory /home/user1/tmp, create the file /etc/exclude.rootvg containing the line /home/user1/tmp/, and type: #mksysb -i -e /dev/rmt1 High-level shell command for backing up mounted file systems in the rootvg volume group. mkszfile -f must be called prior to mksysb in order to create the /.fs.size file that mksysb uses to determine which files will be backed up. An 8mm tape drive is the preferred method of backing up your system because that tape can be used to recreate the rootvg image if one or more physical volumes fail. Each of the file systems MUST have at least 500 blocks free when the mksysb backup is made. The system will need some work space in each file system when it is installing from a mksysb backup. To utilize the full 2.3 gb tape capacity... Set the blocksize to 1024 Edit the /usr/lpp/bosinst/diskette/startup2 file o Change the following line from 512 to 1024. /etc/methods/chggen -a rmt0 -a block_size=1024 Create a new install/maint diskette

MKSYSB can create a BOOTABLE tape. Further, the data is archived in TAR format. In order to look at the names of files backed up by this command, perform the following: tctl -f/dev/rmt1.1 fsf 3 tar -tvf/devrmt1.1

Example: mkszfile -f && mksysb /dev/rmt0 -f forces extending the /usr or /tmp file system if not enough working space (8 MB) exists. This command should ALWAYS succeed unless a tape has not been inserted into the archive device (eg., rmt0), or the tape is either write-protected or has defective media.

MKSYSB IMAGE BOS boot image: - Contain a copy of system kernel and device driver needed to boot from tape. Mkinsttape image: - Contain image.data file and bosinst.data file Dummy.toc: - Used to make mksysb tapes have same number of files as BOS install tapes. Rootvg Data: - Contain all data from the backup NON ROOTVG BACKUP

Understanding IBM AIX O.S easily by Amrik

#smit savevg 1 Create /tmp/vgdata/vg_name/vg_name.data file, this file is same as image.data file of rootvg. Or you can create file using command #mkvgdata vg_name i.e #mkvgdata datavg For excluding files from file system or if you want some files not to be backed up. Create /etc/exclude.internalvg or /etc/exclude.rootvg Vi /etc/exlude.internalvg /utsarch/ /utsdb2/ Exclude /utsarch and /utsdb2 filesystem from datavg RESTORE NON ROOTVG BACKUP

#smit restvg

To list the contents of a root volume group backup that is created with the savevg command, enter the following #smit lsmksysb To list the contents of a user volume group backup that is created with the savevg command, enter the following #smit lsbackvg To restore individual files from a root volume group backup, enter the following SMIT fast path: #smit restmksysb To restore individual files from a Non-root volume group backup, enter the following SMIT fast path: #smit restsavevg BACKUP AND RESTORE COMMAND Relative pathnames will have a ./ pre-fixed to their path. These files will be restored relative to the current directory. Absolute pathnames won't have the ., just the /. These are restored with the full pathname to the exact directory as specified on the archive device.

Backup files by Name

backup -i [ -b Number ] [ -p [ -e RegularExpression ] ] [ -f Device ] [ -l Number ] [ -o ] [ -q ] [ -v ]


Options:-

Understanding IBM AIX O.S easily by Amrik

-i: -

Specifies that files be read from standard input and archived by file name. If relative path names are used, files are restored relative to the current directory at restore time. If full path names are used, files are restored to those same names. List names of files being backed up Name of output device (typically de/v/rmt0 for tape drive) Won't attempt to compress or pack files that are greater than 24 MB. Limits the total number of blocks to use on the diskette device To create a Version 2-compatible backup by name, use the -o flag along with other flags required for backups by name. Files with attributes and values, such as user IDs and group IDs, that are too large for Version 2 systems will not be backed up. A message is displayed for each such file and each value that is too large. Won't prompt user to insert tape Pack data. Backup images by default are NOT packed. If you wish to pack your data, use this option. The restore command has enough intelligence to determine if a backup image is packed or not and take appropriate action

-v: -f: -e: -l: -o: -

q: -p: -

Backup the file system /u to tape device using absolute pathnames. #find /u -print | backup -ivf/dev/rmt0 Backup files and directories under current directory (.) using relative pathnames. The tee (|) will take as input the output of the backup command (filenames being copied) and write them to the log file 'BACKUP.LOG' for later review #find . -print | backup -iepqvf/dev/rmt0 | tee /tmp/BACKUP.LOG Find any REGULAR files (-type f) that have been modified within the past 24 hours (-mtime -1) and write them to the tape device but don't rewind (/dev/rmt*.1) the tape after backup has finished. #find /faxdata -mtime -1 -type f -print | backup -ivf/dev/rmt0.1 Backup files interactively. Select the file(s) to backup by typing in the file's name. When done, press ^D to finish. #backup -ivqf/dev/fd0 If there is more than one tape drive attached to the system, then you can specify a range of devices to the -f flag of the backup command. (/dev/rmt0-1) #find / -print|backup -icvqf/dev/rmt0-1 OR #smit backfile

Backup File system by Inode


backup [ [ -Level ] [ -b Number ] [ -c ] [ -f Device ] [ -L Length ] [ -u ] ] [ FileSystem ] | [ -w | -W ]

Understanding IBM AIX O.S easily by Amrik

-Level: -b: -

Specifies the backup level (0 to 9). The default level is 9.

For backups by name, specifies the number of 512-byte blocks; for backups by i-node, specifies the number of 1024-byte blocks to write in a single output operation. When the backup command writes to tape devices, the default is 100 for backups by name and 32 for backups by i-node. Specifies that the tape is a cartridge, not a nine-track. Specifies the length of the tape in bytes. This flag overrides the -c, -d, and -s flags. You can specify the size with a suffix of b, k, m, or g to represent Blocks (512 bytes), Kilo (1024 bytes), Mega (1024 Kilobytes), or Giga (1024 Megabytes), respectively. To represent a tape length of 2 Gigabytes, enter -L 2g. This flag only applies to AIX 4.2 and above. Updates the /etc/dumpdates file with the raw device name of the file system and the time, date, and level of the backup. You must specify the -u flag if you are making incremental backups. The -u flag applies only to backups by i-node.

-c: -L: -

-u: -

-w: - Currently disabled. If the -w flag is specified, no other flags are applied. -W: Displays, for each file system in the /etc/dumpdates file, the most recent backup date and level. If the -W option is specified, no other flags are applied.

To backup the / (root) file system, enter: #backup -0 -u -f /dev/rmt0 / To backup all the files in the / (root) file system that have been modified since the last level 0 backup, enter: #backup -1 -u -f /dev/rmt0 / OR #smit backfilesys

RESTORE COMMAND
List Files archived by File system

restore -T [ q v ] [ -b Number ] [ -f Device ] [ -s SeekBackup ]


T= -q= -x= -d= -r= table of contents, -v=list the file name being copied, -f=name of output device, should not prompt to insert tape for restore, this options says that tape is inserted and ready for task. Restores individually named files specified by the File parameter Indicates that, if the File parameter is a directory, all files in that directory should be restored. This flag can only be used when the archive is in file-name format. Restores all files in a file-system archive. The -r flag is only used to restore complete level 0 backups or to restore incremental backups after a level 0 backup is restored. The restoresymtable file is used by restore to pass information between incremental restores. This file should be removed once the last incremental backup is restored. The File parameter is ignored when using the -r flag. Specifies the backup to seek and restore on a multiple-backup tape archive.

-s=

To list the names of files in either a file-name or file-system archive on the diskette device /dev/rfd0, enter: #restore Tq To restore a specific file, enter: #restore -xvqf myhome.bkup system.data

Understanding IBM AIX O.S easily by Amrik

To restore a specific directory and the contents of that directory from a file-name archive, enter: #restore -xdvqf /dev/rmt0 /home/mike/tools To restore an entire file-system archive, enter: #restore -rvqf /dev/rmt0 To restore the fifth and ninth backups from a single-volume, multiple-backup tape, enter: #restore -xvqs 5 -f/dev/rmt0.1 #restore -xvqs 4 -f/dev/rmt0.1 To restore the fourth backup, which begins on the sixth tape on a 10-tape multiple-backup archive, put the sixth tape into the tape drive and enter: #restore -xcs 2 -f /dev/rmt0.1 /home/mike/manual/chap3 To improve the performance on streaming tape devices, pipe the dd command to the restore command by entering: #dd if=/dev/rmt0 bs=64b | restore -xf- -b64 To improve the performance of the restore command on the 9348 Magnetic Tape Unit Model 12, you can change the block size by entering: #chdev -l /dev/rmt0 -a BlockSize=32k

Restores all files that start with "My" from the /usr/tmp directory #restore -xvf/dev/rmt0 ./usr/tmp/My* Restores all files that start with "My" from the /usr/tmp directory #restore -xvf/dev/rmt0 ./usr/tmp/My* Restores the directory named /usr/tmp from tape device #restore -xdvf/dev/rmt0 ./usr/tmp Restores all the files located on the tape device that were backed up using the backup command. #restore -xvf/dev/rmt0 -x=extract data from output device. Restores only the file named ./tmp/TestFile from the tape device. If the subdirectory /tmp doesn't exist in the current directory, then that subdirectory will be made prior to restoring 'TestFile'. #restore -xvf/dev/rmt0 ./tmp/TestFile Rewind to the beginning of tape #tctl -f/dev/rmt0 rewind Review files on FIRST backup image #restore -s1 -Tvf/dev/rmt0.1 Review files on SECOND backup image #restore s2 -Tvf/dev/rmt0.1 Displays the table of contents for multiple backup images. s1=specifies that multiple backups are on the tape and that the restore command skips to the backup specified by the number associated with the 's' option. The 0.1 for the output device (-f flag) means that once the tape

Understanding IBM AIX O.S easily by Amrik

has been read, it will not rewind. If only the second backup image was needed, could have just typed in: restore -s2 -Tvf/dev/rmt0.1 If by chance the ./unix file was deleted, go back to your install tape and extract the file that needs to be restored. The first three images on the tape are BOSBOOT, INSTALL/MAINT, followed by the TOC (table of contents) image #tctl -f/dev/rmt0.1 fsf 3 #restore -xvqf/dev/rmt0.1 ./unix. Selectively restore ONLY those files listed in file /tmp/DISK.LIS #restbyname -xvqf/dev/fd0 -Z /tmp/DISK.LIST

LOGICAL TAPE DEVICE NAME AND FUNCTIONS


Tape devices you have 2 functionalities, 1) rewind after completing the job. 2) retention the tape before starting the job (on tape). Retension means winding to the end of the tape and then rewinding to the beginning of the tape to reduce errors One has to use the device name depending on the above functionality, /dev/rmt0 rewind true, retension false /dev/rmt0.1 rewind false, retension false /dev/rmt0.2 rewind true, retension true /dev/rmt0.3 rewind false, retension true To take tar backup, #tar -cvf /dev/rmt0 *.cbl will take backup of all .cbl file from the begining of the tape and rewinds on completion. If you have to take multiple backups on the same tape, do the following, #tar -cvf /dev/rmt0.1 *.cbl (which takes backup on to tape --1st 'tar file' --and waits without rewinding). Issue another tar backup, #tar -cvf /dev/rmt0.1 *.cbl (2nd tar file --which again waits without rewinding)

Density

Rewind-on-Close

You can select whether to write with the tape drive Density Setting #1 or with the tape drive Density Setting #2. The values for these density settings are part of the attributes of the tape drive. Because it is customary to set Density Setting #1 to the highest possible density for the tape drive and Density Setting #2 to the next highest possible density for the tape drive, special files that use Density Setting #1 are sometimes referred to as high density and special files that use Density Setting #2 sometimes are referred to as low density, but this view is not always correct. When reading from a tape, the density setting is ignored. You can select whether the tape is rewound when the special file referring to the tape drive is closed. If rewind-on-close is selected, the tape is positioned at the beginning of the tape when the file is closed.

Understanding IBM AIX O.S easily by Amrik

Retension-on-Open

You can select whether the tape is retensioned when the file is opened. Retensioning means winding to the end of the tape and then rewinding to the beginning of the tape to reduce errors. If retension-on-open is selected, the tape is positioned at the beginning of the tape as part of the open process.

Special File /dev/rmt0 /dev/rmt0.1 /dev/rmt0.2 /dev/rmt0..3 /dev/rmt0.4 /dev/rmt0.5 /dev/rmt0.6 /dev/rmt0.7

Rewind on Close Yes No Yes No Yes No Yes No

Retension on Open No No Yes Yes No No Yes Yes

Density Setting #1 #1 #1 #1 #2 #2 #2 #2

For Tape Drive characteristics go to: http://publib16.boulder.ibm.com/pseries/en_US/aixbman/baseadmn/tape_attr.htm

cpio
Copies files to/from an archive storage device. This command is often used to copy files from UNIX to AIX systems. This command will span across multiple tapes. cpio stands for Copy Input to Output. -c: -r: -v: -i:Writes header information in ascii format for portability across UNIX systems. When restoring will prompt for new path/file to restore to. List the file name as it's being copied. Read from standard input, i.e. keyboard -u Copies unconditionally. Older file replaces a newer one. Files with older modification times will replace files with newer modification times. -d: Creates directories, if applicable -t For table of contents. -C1: - Performs block I/O in 512 byte blocks, if the block size of the device that wrote the data on the tape was set to 512 bytes -o: - Create a cpio image -t: - read/verify the content of a cpio image. -m: - retain original modification times associated with file. Reads file names using the find command and copies to the floppy drive (/dev/fd0). #cd /u/roger #find . -print | cpio -ocv > /dev/fd0 Saves files in current directory and writes this info to floppy. Same command as above except much faster. #find . -cpio /dev/fd0 -print

Understanding IBM AIX O.S easily by Amrik

Restore files and directories saved on the floppy device. These files are restored under the current directory (/u/roger) Only if relative pathnames (./<filename>) were used. #cd /u/roger #cpio -icuvd < /dev/fd0 List the table of contents from a tape device. #cpio -itvcC1 < /dev/rmt0 Copies all files FROM one directory TO another WITHOUT changing the permissions, owner/group or modification date of the file. Use the following command to verify that all files were copied: #cd /u/roger #find . -print | cpio -dumpv /u/jerry If the number of files encountered is the same for both directories its safe to assume that the directories are identical. NOTE: that the number of blocks allocated to the SOURCE directory (/u/roger) may be larger than the DESTINATION directory (/u/jerry), since compaction of the directory structure will have occurred at the destination end. #find /u/roger -print | wcfind /u/jerry -print | wc Selectively restore the /home/roger/.profile file from floppy #cpio -imv /home/roger/.profile < /dev/fd0 Selectively restore only the *.f and *.c files from floppy #cpio -i "*.f" "*.c" </dev/fd0

DD
Converts/copies files to/from an output device. DD stands for Data Dump. This command will NOT span across multiple tapes. Common utility found on most versions of UNIX. Read the files off the tape device faster because of the blocking factor (bs=blocksize of 512K or cache upto 1/2 MB at a time) #dd if=/dev/rmt0 bs=512k | cpio -icdmv Copies the data from the input file (if=rs6000.dat) to the output tape device (/dev/rmt0). The rmt*.4 device extension means output is written in 1600 bpi format. This creates an EBCDIC low density tape, resulting in a 1024 byte blocked non-labeled file. To extract this file on the AS/400, create a physical file with a record length of 1024 bytes. Use the CPYFRMTAP command to copy the file. NOTE: When copying data from an EBCDIC machine, make sure your BLOCK SIZE is set to 0 on the tape device #dd if=rs6000.data of=/dev/rmt0.4 bs=1024 conv=ebcdic Copies the data from the input file (if=unixfile.txt) to output name (of=DOSFILE.TXT) and converts the source data to UPPERCASE characters #dd if=unixfile.txt of=DOSFILE.TXT conv=ucase. Copies the ABSOLUTE path /u/roger using the tar utility. To speed this process up, these files are piped to the dd utility using a cache buffer size of 1 MB. #tar -cvf- /u/roger | dd of=/dev/rmt0 bs=1024k

Understanding IBM AIX O.S easily by Amrik

Copies the raw physical volume named hdisk0 to the raw physical volume named hdisk1. This represents a copy disk utility #dd if=/dev/rhdisk0 of=/dev/rhdisk1 bs=5120b. Copies the data from the tape device (if=/dev/rmt0) and creates an output file (/tmp/ascii_file) - which is BYTE swapped (conv=swab) as it is being written out. This needs to be done if your copying ascii files from a System V Unix machine (unisys to the RS/6000) #dd if=/dev/rmt0 of=/tmp/ascii_file conv=swab Useful when reading an ASCII file that is NOT delimited by a NL character. #dd if=/dev/rmt0.1 of=/tmp/data1 cbs=242 ibs=3240 conv=sync,unblock Will read a record size of 147 bytes, a block size of 2940 bytes, and convert the output to an ASCII file. #dd if=/dev/rmt0.1 of=/tmp/data1 cbs=147 ibs=2940 conv=ascii If a filesystem superblock is corrupted, as a backup copy of superblock is kept at 31st block of filesystem, to repair the corrupted superblock copy the backed up superblock from 31st location. #dd count=1 bs=4k skip=31 seek=1 if=/dev/hd4 of=/dev/hd4

Tapechk
Performs consistency checks on a tape device. Primarily used to check tapes written in backup format. # tapechk 2 ( Checks the first 2 files found on the tape device.)

Tcopy
Copies from one magnetic tape device to another. This command will work for copying multiple backup images from one media type to another. It will continue to copy until two endof-tape marks are encountered Displays ALL the backup images and their size for the tape your currently viewing. #tcopy /dev/rmt0 Copies all the data from one media type to another until two end of tape marks are encountered. In the example above, rmt0 could be a 8mm device and rmt1 may be a 1/4" tape device. If the error message: tcopy: Cannot open /dev/rmt?' is displayed, make sure the destination device is not write-protected. #tcopy /dev/rmt0 /dev/rmt1

Tctl
Command used to fast forward a tape device (Tape ConTroL). Options: rewind = rewind a tape, fsf = fast forward a tape, offline=ejects a tape rewoffl = rewind and ejects a tape

Understanding IBM AIX O.S easily by Amrik

Rewind the tape device #tctl -f/dev/rmt0 rewind. Move tape forward to the second tape mark. The .1 on the rmt0 device instructs the device NOT to rewind after performing the command. Use this command to skip past unwanted tape images - assumming there are multiple archive images on the tape to skip past. #tctl -f/dev/rmt0.1 fsf Moves the tape to the beginning, end, and back to the beginning again. Used to retension the tape when encountering multiple read errors on restore operations. #tctl -f/dev/rmt0 retension

MT # # # # # # mt mt mt mt mt mt status Print status information about the tape unit. rewind Rewind the tape. erase Erase the tape. retension Re-tension the tape (one full wind forth and back. fsf 1 Forward space count by one file. One can be any number. -f /dev/rmt/1n fsf 3

Backup files from a remote computer


The local host MUST be included in remote's hosts /etc/hosts.equiv file. The local host and user name MUST be included in the $HOME/.rhosts file at the user account at the remote machine. Restores files FROM a remote tape drive on a host named 'lanai' #rsh lanai -l roger "dd if=/dev/rmt0" | tar -xvfThe tar command will write it's output to the rsh command which pipes the data to the remote host (lanai) and the tape drive (/dev/rmt0). Specify -l <UserName> if the local user is different from the remote user. #tar -cvf- * | rsh lanai -l roger "dd of=/dev/rmt0 bs=64k conv=block" Uses the floppy drive device on node lanai to store files in tar format. #tar -cvf- * | rexec lanai " dd of=/dev/fd0 bs=4096 Commands for remote tape backup

Understanding IBM AIX O.S easily by Amrik

#tar cvf - $DIRNAME | rsh $SYS dd of=$TAPEDEV To retrieve the backed up info... #rsh $REM dd if=$TAPEDEV | tar xvf

SECURITY & USER ADMINISTRATOR


I am not covering, what is chmod, chown, chgrp, SUID, SGID, SVTX (sticky bit) basics, SUID is set on executable file, no meaning on directories, completely insecure becoz for some time normal users gain access of root or become as root for ex: Create a shell script named shell.sh that contains the following two lines. These lines should begin in the left most column. #!/bin/ksh id Set the shell script's file owner to root, and the permissions to rwsr-xr-x (SETUID bit on). Execute the following commands: chown root shell.sh chmod 4755 shell.sh Prior to AIX 3.1.7, if an ordinary user named "joeuser" ran shell.sh, the output would be : - uid=200(joeuser) gid=200(staff) euid=0(root) The euid=0(root) indicates that the user was effectively root while the shell script executed. For AIX 3.1.7 and later, the output is: uid=200(joeuser) gid=200(staff) The SETUID bit no longer has any meaning for shell scripts. The means that the SETUID does not function as it does on other UNIX systems. Other versions of UNIX do pass the euid 0 to other kornshell scripts and child processes; thus, creating a security vulnerability unacceptable to AIX. File systems are mounted over a directory mount point. Both the mount point and the file system have permissions. The permissions on the mount point are determined by the current umask setting at the time the file system is created. Even though the permissions on the mounted file system take precedence over the permissions on the mount point, the mount point must have at least search

Understanding IBM AIX O.S easily by Amrik

permissions for everyone (that is, 111) to avoid unpredictable results. Remember, after the file system is mounted, you cannot see the permissions on the mount point. You must umount the file system before the mount point permissions can be examined and changed. Your user id (uid) is used to set the owner of the file. Your primary group is used to set the group (unless the directory in which the file is created has the sgid permission bit set; then the group is the same as the group on the directory entry). The id command can be used to see the uid and primary group for that user. Your umask setting is used to set the initial permissions. Type umask at the command line to see the current setting. To change the umask setting, type umask number, as in: umask 022 NOTE: You do not use the equal sign (=) when setting umask. umask does not set the execute bit on a text file or shell script but only on a directory. To determine what umask to use, take the umask setting and subtract it from 777 for a directory or from 666 for a text file or shell script. Then, if you create a directory or text file, you see permissions as follows: Example with umask 022: 777 - 022 = 755 (Default rights for directory) 666 - 022 = 644 (Default rights for file) Executing ls -l shows the following permissions: for a directory: - rwxr-xr-x for a text file: rw-r--r-Similar case is for SGID, sticky bit SVTX is removed from AIX.

LOGIN SEQUENCE
Before I continue with this understand the main files and there field needed, for login up to the, users shell prompt comes. Please read the login sequence file.doc file first which explain you all the required files and there directives in depth. I Since init is last stage of system initialization, when init runs it start the getty process because of following entry in /etc/inittab cons:0123456789:respawn:/usr/sbin/getty /dev/console A getty process is started for all ports who is responsible for providing login prompt. II Whenever a request is received for login from user, a message is displayed by getty process from the file /etc/security/login.cfgs hearld directive and getty process waits for users intervation by giving login prompt. Know login program take the control. III User enters username and password, login program passed the username and then checks /etc/passwd weather its valid username, /etc/security/passwd is checked if a password is required or not. In this step, if username or password is invalid or not exist, a error is thrown on users terminal and entry is made /etc/security/failedlogin, Number of failed login attempts are also tracked by /etc/security/lastlog attribute: - unsuccessful_login_count. A user account is locked after if loginretries field in /etc/security/user reaches to the value specified.

Understanding IBM AIX O.S easily by Amrik

IV If a user enter a successful or valid username and password, then usw(user conf. Stanza) /etc/security/login.cfg is checked for number of maximum simultaneous login made by each user, if it exceed then the value specified, then login is denied and a message is display. V Now users environment is set up using /etc/environment (Setups global variables), /etc/security/eviron(setup environment attributes for users, /etc/security/limits(setup users file and system usage limits), and /etc/security/user(setup individual users roles and security)

VI If /etc/nologin file exist then no one can login except root, login program setups users home directory login shell after displaying the content of /etc/motd(message of the day), if .nohushlogin file exist in users home directory then all the login messages are ignored i.e date of last successful and unsuccesfull login VII Finally control is passed to login shell, which will run the /etc/profile(read and executed by every login) and $HOME/.profile, $HOME/.profile customized by user, overwrites the variables of /etc/profile. Smit security, smit user, smit mkuser List all users, all attributes i.e username, uid, primary group, login shell and so on. #lsuser ALL To display the user id and group-related information about the smith account in stanza form, enter: #lsuser -f -a id pgrp groups admgroups smith Information similar to the following appears: smith: ID=2457 pgrp=system groups=system,finance,staff,accounting To display the user id, groups, and home directory of smith in colon format, enter: #lsuser -c -a id home groups smith Information like the following appears: # name: ID:home:groups smith: 2457:/home/smith:system,finance,staff,accounting USER CREATION File Involved in user creation /etc/passwd Username is created, with * in password field.

Understanding IBM AIX O.S easily by Amrik

/etc/security/.ids /usr/lib/security/mkuser.default /etc/shells

UID is chosen from this file for normal/admin user. Default user/admin stanza in picked if no argument supplied while creating users i.e primary group, login shell. All valid shells on scripts are mentioned here, /etc/security/login.cfgs shell directive pick shells from /etc/shells Script executed for creating users home directory This .profile is copied into users home directory by /usr/lib/security/mkusers.sys script. User Name entries are made here with all default attributes of this file.

/usr/lib/security/mkusers.sys /etc/security/.profile /etc/security/user

/etc/security/passwd

No entry is made here if password is not set for user. If password is specified then /etc/passwds password field changes to ! sign indicate that password is in /etc/security/shadow valid group to which user belongs is picked from this file. contain predefined roles for users Contains the administrative role attributes of users. Defines resource quotas and limits for each user. contains the environment attributes of users. if exist then no user can login.

/etc/security/group /etc/security/roles /etc/security/user.roles /etc/security/limits /etc/security/environ /etc/nologin

Whenever a mkuser or smit mkuser command is executed the below process come into picture. Step I An entry of username is made in /etc/passwd file. When a useradd/mkuser command is executed, /usr/lib/security/mkuser.default file is being used, the user stanza is picked up if ordinary user is being added and admin stanza is being picked up if admin. User is added. Step II If the user ID is not specified, the default user id number is chosen from /etc/security/.ids file, For admin users, ids are given starting from 6 above and for normal users starting from 200, or u can say that user id 6 to 199 is fixed for admin. and above for normal users. Step III

Understanding IBM AIX O.S easily by Amrik

Then the /usr/lib/security/mkusers.sys shell scripts is run during user creation. These scripts create users home directory, copy /etc/security/.profile to users home directory. Step IV When a users get created, its ID is disabled in /etc/passwd i.e an *(aestrik) is placed in the password field of /etc/passwd file. As soon as password is set using passwd or smitty * field of a password changes to ! (Exclamation sign).

Users are created in 2 ways 1. only mkuser username is command is executed or just username is enter in smit mkuser, no other parameters are specified. First /usr/lib/security/mkusers.sys script is run to create users home directory and .profile is also being copied from /etc/securioty/.profile to users home directory. mkuser adds username in /etc/passwd, put * in password field, then read the /etc/security/.ids file for available user ID and Since no other parameters are specified while creating user then the default parameters are picked up from /etc/security/mkusers.default, if users is normal user then user stanza come into picture and if user is admin users then admin Create USER: Smit mkuser, users, security

Mkuser add user name in username field of /etc/passwd, put * in password field, take uid from /etc/security/.ids second column and place it in UID field of /etc/passwd, takes the group id from /etc/security/group and place it to GID field, take a home directory and login shell path from /usr/lib/security/mkuser.default and place it to 6th and 7th field of /etc/passwd. /etc/passwd test:*:213:1::/home/test:/usr/bin/ksh /etc/security/.ids 8 214 14 202 /usr/lib/security/mkuser.default User: pgrp = staff groups = staff shell = /usr/bin/ksh home = /home/$USER /usr/lib/security/mkuser.sys script create users home directory and copy .profile. After entering password /etc/passwd changes to: -

Understanding IBM AIX O.S easily by Amrik

test:!:213:1::/home/test:/usr/bin/ksh if ROLES is specified while creating user say test user is created with roles as manageRoles, then this entry gets added into /etc/security/users.roles as test: roles = manageRoles if only expiration date is specified for user roltest, entries get appended into a file /etc/security/user as roltest: admin = false expires = 0320144206 if the users account is expired and if he is currently working in his home directory, he will not receive any message of expiration until and unless he/she logout or login again. Following message appair if account expires Login: roltest roltest's Password: 3004-302 Your account has expired; please see the system administrator. To reset expiration go to smit chuser expiration date=0. Just type 0 and press enter, user can login If is the account is locked is set to true, entry is appended in /etc/securiuty/user if users logout login again user will receive a following message:Login: roltest roltest's Password: 3004-301 Your account has been locked; please see the system administrator. After this message, login program wait for 60 seconds by reading file /etc/security/login.cfgs logintimeout directive, and if user doesnt do anything then terminal is closed automatically after 60 sec. logintimeout = 60 If a login prompt is not used within 60 seconds by a user. then that telnet or terminal is cloed automatically after 60 seconds i.e its reads /etc/security/login.cfgs logintimeout. For ex : user enter a username/password and system says that username/password is wrong then at that time system will wait for only 60 seconds for users input after that terminal/session closed after 60 sec. And unsuccessful_login_count in /etc/security/lastlog is incremented by 1, if same user whose account is locked is trying again. roltest: unsuccessful_login_count = 2 if user can login is specified to false, then user have to change a password at the time of login i,e Login: roltest roltest's Password:

Understanding IBM AIX O.S easily by Amrik

[compat]: 3004-610 You are required to change your password. Please choose a new one. roltest's New password: Enter the new password again: Otherwise user cant login. An entry of user can login = false is made in /etc/security/user as roltest: admin = false account_locked = false login = false Password updated entry is modified in /etc/security/passwd file as roltest: password = USe/fr10rIW4Y lastupdate = 1142889261 from this lastupdate field you can calculate when the user has changed his/her password. If Number of FAILED LOGINS before user account is locked is set to 2, then user account is locked, i.e if he enter wrong username/password for atleast 2 times, and then again he is attempting for entering u/n or p/w then his account will get locked, on next login he receive message like :Login: roltest roltest's Password: 3004-303 There have been too many unsuccessful login attempts; please see the system administrator. Entries are updated in /etc/security/user as: And /etc/security/lastlogs unsuccessful_login_count get incremented by how many times user tried invalid usename/password. If Login AUTHENTICATION GRAMMAR : - files the only local users of system can only login, no NIS users are accepted, for NIS plus local user compat variable is to be specified Entry of this field is appended in /etc/security/users as: - SYSTEM = "files" If you specify Valid TTYs: - /dev/pts/10, then a user roltest can login only from /dev/pts/10, any attempt made to login from other terminal will give below message roltest's Password: 3004-309 You are not allowed to access the system via this terminal. Entries of this change is made in /etc/security/user: - ttys = /dev/pts/10 If u specify : - Days to WARN USER before password expires to 1, then user will receive password expiration message before 1 day. (expire) (pwdwarntime) (histsize) (histexpire) EXPIRATION date (MMDDhhmmyy) Days to WARN USER before password expires NUMBER OF PASSWORDS before reuse WEEKS before password reuse [0321101506 [1] [2] [1]

Understanding IBM AIX O.S easily by Amrik

(maxexpired) (maxage) (minage) (minlen) (minalpha) (minother)

Weeks between password EXPIRATION and LOCKOUT Password MAX. AGE Password MIN. AGE Password MIN. LENGTH Password MIN. ALPHA characters Password MIN. OTHER characters Password MAX. REPEATED characters

[1] [2] [1] [4] [1] [1] [8]

Entries are made in /etc/security/user as: expires = 0321101506 pwdwarntime = 1 histsize = 2 histexpire = 1 maxexpired = 1 maxage = 2 minage = 1 minlen = 4 minalpha = 1 minother = 1

if roltest try to change password then histexpire, histsize, minage fields comes into picture, user will get message if above setting is done. $ passwd Changing password for "roltest" roltest's Old password: roltest's New password: a minimum of 1 elapsed week between changes. 3004-320 Only the system administrator can change this password. If u specify NUMBER OF PASSWORDS before reuse : - to 1, then if current password of user roltest is rolt, then if he tries to change the password first time as rolt then he/she is not allowed and below message is thrown. roltest's New password: 3004-314 Password was recently used and is not valid for reuse. A user can use password rolt again, until he changes password for atleast 1 time. i.e I mean to say, if user get above message password was recently used, and if user current password is rolt, and password changes action comes, then user cant use the password rolt again, then he hve to user some other password i.e rolp or any other not matching to rolt password, after changing if he willing to change password then he can use the password rolt again, if NUMBER OF PASSWORDS before reuse : - 1, cant use same password for atleast 1 time.

Understanding IBM AIX O.S easily by Amrik

If Password MIN. LENGTH is set to 8 Means if user a changing a password, and its password length is less then 8 characters user will get below message. $ passwd Changing password for "roltest" roltest's Old password: roltest's New password: 3004-602 The required password characteristics are: a maximum of 8 repeated characters. a minimum of 8 characters in length.

PASSWORD AUTHENTICATION If roltest user password is changed by root then this action gets updated in /etc/security/passwd file at flags stanza. If ADMCHG flag is there this means root has changes the password for user roltest If ADMIN flag is set, then only root can change password for roltest, no one else can. If NOCHECK flag is set, which is default no password change restriction is forced. roltest: password = nbVJtQoUG0KE. lastupdate = 1143741824 flags = ADMCHG How to change this flag using command line. pwdadm command is used to do this task. Change /etc/security/passswd flag dircteive using below command. # pwdadm -f ADMIN roltest To set a password for user susan, a member of the security group enters: # pwdadm roltest Changing password for "roltest" roltest's New password: Enter the new password again: When prompted, the user who invoked the command is prompted for a password before Susan's password can be changed. To query the password status for user susan, a member of the security group enters: # pwdadm -q roltest roltest: lastupdate = 1143743135 flags = ADMIN To change your full name in the /etc/passwd file, type: passwd -f # passwd -f roltest roltest's current gecos: ""

Understanding IBM AIX O.S easily by Amrik

Change (yes) or (no)? > y To?>rtest To use a different shell the next time you log in, type: passwd -s # passwd -s roltest Current available shells: /bin/sh /bin/bsh /bin/csh /bin/ksh /bin/tsh /bin/ksh93 /usr/bin/sh /usr/bin/bsh /usr/bin/csh /usr/bin/ksh /usr/bin/tsh /usr/bin/ksh93 /usr/bin/rksh /usr/bin/rksh93 /usr/sbin/uucp/uucico /usr/sbin/sliplogin /usr/sbin/snappd roltest's current login shell: /usr/bin/ksh Change (yes) or (no)? > y To?>/bin/sh Mkuser command lines To create the davis user account with the default values in the /usr/lib/security/mkuser.default file, type: mkuser davis To create the davis account with davis as an administrator, type: mkuser -a davis Only the root user or users with the UserAdmin authorization can create davis as an administrative user. To create the davis user account and set the su attribute to a value of false, type: mkuser su=false davis chuser command lines To enable user smith to access this system remotely, type: chuser rlogin=true smith To change the expiration date for the davis user account to 8 a.m., 1 May, 1995, type: chuser expires=0501080095 davis To add davis to the groups finance and accounting, type: chuser groups=finance,accounting davis Remove user using rmuser command #rmuser p roltest

Understanding IBM AIX O.S easily by Amrik

-p: -

will remove authetication information from the /etc/security/*

Removing user command, remove the user instance from all this below files, home directory is not removed. /etc/passwd, /etc/security/passwd, /etc/security/group, /etc/security/user, /etc/security/user.roles, /etc/security/lastlog

GROUPS List all groups on system # lsgroup ALL # lsgroup -f -a id users adms finance Nothing else to discuss in groups, since its similar with rest of unix /etc/group. VALIDATING ENVIRONMENT #pwdck command validates the correctness of local authentication information i.e it will check the format, correctness and validity of /etc/passwd and /etc/security/passwd are consisitent with each other, /etc/security/user, /etc/security/login.cfg, if any error found it report and try to fix depend upon user action. -n Reports errors but does not fix them. -p Fixes errors but does not report them. -t Reports errors and asks if they should be fixed. -y Fixes errors and reports them. To verify that all local users have valid passwords, enter: pwdck -y ALL #usrck verifies the validity of users defination. -n -p -t -y Reports errors but does not fix them. Fixes errors but does not report them. Reports errors and asks if they should be fixed. Fixes errors and reports them.

To verify that all the users exist in the user database, and have any errors reported (but not fixed), enter: #usrck -n ALL To delete from the user definitions those users who are not in the user database files, and have any errors reported, enter: #usrck -y ALL

Understanding IBM AIX O.S easily by Amrik

Checks each username entries in /etc/passwd, /etc/security/passwd, /etc/security/user, /etc/security/limits. Checks are also made on /etc/group, /etc/security/group to ensure the user entries. #grpck verify the validity of group. Verifies files in /etc/passwd, /etc/security/user, /etc/group and /etc/security/group are consistent

WORKING WITH SCHEDULING JOBS [ CRON/AT/BATCH ] Started by init from /etc/inittab file. cron:23456789:respawn:/usr/sbin/cron Due to respawn, if cron daemon gets killed, it get automatically started by init by reading the above line in /etc/inittab file. Cron event scheduling depends upon /var/adm/cron/queuedefs. /var/adm/cron/queuedefs file specifies the maximum number of processes per event type to schedule at one time, the nice value of the event type, and how long to wait before retrying to execute a process. Each entry in the queuedefs file is of the form: a Specifies an at command event. b Specifies a batch command event. c Specifies a crontab command event. d Specifies a sync subroutine event. e Specifies a ksh command event. f Specifies a csh command event. Jobs j Specifies the maximum number of jobs the cron daemon can start at one time. The default value is 100. Nice n Specifies the nice value for job execution. The default value is 2. Wait w Specifies the time, in seconds, to wait before attempting to execute the command again. The default value is 60 seconds. To set the crontab command job queue to handle 200 concurrent jobs with a nice value of 10 and a retry in 120 seconds if the fork subroutine fails. Ex: c.200j10n120w EventType.[Jobs j][Nice n][Wait w]

Understanding IBM AIX O.S easily by Amrik

EventType.[Jobs j][Nice n][Wait w] c. 200 j 10 n 120 w

Schedule is defined in the:- /var/spool/cron/crontabs/ when you use crontab e command, by default system with execute vi command like this #vi /var/spool/cron/crontabs/root Depend upon user, last paramater changes i.e if user roltest is executing crontab e then #vi /var/spool/cron/crontabs/roltest file get create, edited or used by cron. /var/adm/cron/cron.allow and /var/adm/cron/cron.deny cron.deny file exist by default, this two files are used to restrict user weather to allow executing cron job or to deny executing cron jobs. If cron.allow file exist, and if its a empty file then no one can execute cron not even root. If cron.allow contain usernames then only listed user are allow to execute cron. If both cron.allow and cron.deny file exist then cron.allow file is used, cron.deny doesnt come in picture because cron will work for only those users whose name is specified in cron.allow for others its denied. If neither cron.allow or cron.deny exist then only root can execute cron jobs. Crontab Format: Minute Hour Date Month Day-of-week (0-6 where 0=Sunday 1=Monday, etc) Command

(0-59) (0-23) (1-31) (1-12)

Safer Method to edit crontab #crontab l > /home/cmsadmin/crontab # vi /home/cmsadmin/crontab Do the changes, save file and exit vi #crontab /home/cmsadmin/crontab

AT and Batch command

Understanding IBM AIX O.S easily by Amrik

S-ar putea să vă placă și