Aix Details

download Aix Details

of 46

description

aix

Transcript of Aix Details

  • 5/21/2018 Aix Details

    1/46

    PHYSICAL VOLUME (PV) Represents a hard disk (hdisk0).PHYSICAL PARTITION (PP) The smallest allocation unit in the LVM. All PPs withina VG are the same size, usually 4 or 8 MB.VOLUME GROUP (VG) A set of one or more PVs which form a single storage pool. You can define multiple VGs on each AIX system.LOGICAL VOLUME (LV) One or more PPs. A file system resides on top of an LV.Only one LV is mapped to a file system. A LV can't span across a VG. Up to 255 L

    Vs in a VGLOGICAL PARITITION (LP) One or more PPs. LP represents a mirrored copy of a PP.Up to two copies of a PP can be mirrored resulting in a LP count of three (2 mirrors plus original).Volume Group Descriptor Area (VGDA) Information about all the LVs and PVs within a VG. The first 64K of a PV is reserved for this area - defined in .

    The VGDA consists of BOOTRECORD: - first 512 bytes. Allows the Read Only System (ROS) to boot system BAD BLK DIRECTORY - found in LVM RECORD - found in

    Volume Group Status Area (VGSA) Information about which PPs that are stale and which PVs are missing within a VG. The LVM and SCSI driver reserves somewhere between 7-10% of the available disk space for LVM maps, etc.Physical Volume ID(PVID) The PVID is an amalgamation 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 con?gurator 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.Quorum Quorum is a sort of sanitycheck that LVM uses to resolve possible data con?iction and prevent data corruption. Quorum

    is a method by which 51% or more quorum votes must be available to a volume group before LVM actions can continue.Quorum is issued to a disk in a volume group according to how the disk was created within the volume group. When avolume group consists of one disk, there are two VGDAs on that disk. Thus, this single disk volume group has a quorumvote of 2. When another disk is added to the volume group with an extendvg, then this new disk gets one VGDA, but theoriginal, ?rst disk still retains the two VGDAs. When the volume group has been extended to three disks, the third diskgets the spare VGDA sitting on the ?rst 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.Volume Group ID (VGID) Just as the PVID is a soft serial number for a disk, theVGID is the soft serial number for the volume group. It is this serialnumber, not the volume groups ascii name, which all low level LVM commands reference. Additionally, it is the basis forthe LVIDs created on that VGID.Logical Volume Control Block (LVCB) The logical volume control block (lvcb)consists of the ?rst 512 bytes of a logical volume. This area holds importantinformation such as the creation date of the logical volume, information about mirrored copies, and possible mount pointsin a journaled ?lesystem.Logical Volume ID (LVID) The LVID is the soft serial number used to represent the logical volume to the LVM libraries and low level commands. The

    LVID is created from the VGID of the volume group, a decimal point, and a numberwhich represents the order which thelogical volume was created on the volume group.

  • 5/21/2018 Aix Details

    2/46

    Directories and FilesToolsdiagnostic diag - used to hot swap the diskcfgmgr - used mak sure the new disk is seen

    # to add new disk from the scsi0 controller

    cfgmgr -l scsi0Create/Remove hard disk cfgmgr -l scsi0mkdev -c disk -l rmdev -dl Physical VolumesDisplay lspvlspv (detailed)lspv -l (list logical volumes)lspv -p (physical partition usage)PVID chdev -l -a pv=yeschdev -l -a pv=clear

    Note: PVID's are automatically added when the disk is placed into a vgAdding chdev -l -a pv=yes (new)chpv -v a (adds back the removed disk)Removing chpv -v r change physical attributes chpv -a y (changes allocatable state to YES)chpv -a n (changes allocatable state to NO)Moving migratepv Volume GroupsDisplay lsvglsvg (detailed)lsvg -l (list all logical volumes in goup)lsvg -p (list all physical volumes in group)

    lsvg -o (lists all varied on)lsvg -M (lists assicated disks and state)

    ## Details volume group info for the hard disklqueryvg -Atp lqueryvg -p -v (Determine the VG ID# on disk)lqueryvg -p -L (Show all the LV ID#/names in the VG on disk)lqueryvg -p -P (Show all the PV ID# that reside in the VGon disk)Varyon varyonvg varyonvg -f (force)

    varyonvg -s (maintenance mode can use VG commands but lv 's cannot be openedfor i/o access)varyoffvg Note: the varyon command activiates the volume goup which means it is availablefor useODM related ## Determine if the ODM and VGDA are correct (in sync)getlvodm -u

    ## tries to resync VGDA, LV control blocks and ODMsynclvodm

    ## If the message 0516-366 lsvg: Volume group is locked is ever seenputlvodm -K `gtlvodm -v `

    Creating mkvg -y -s

    mkvg -y datavg -s 4 hdisk1

  • 5/21/2018 Aix Details

    3/46

    Note: the PP size will be the size of the physical partition size you want 4MB,8MBExtending extendvg reducing reducevg -d

    ## removes the PVID from the VGDA when a disk has vanished without using the red

    ucevg commandreducevg Removing varyoffvg exportvg

    Note: the export command nukes everything regardingthe volume goup in the ODM and /etc/filesystemsChecking ## check to see if underlying disk has grown in sizechvg -g Note: use this command if you are using SAN LUN's that have increased in sizechange volume attributes ## auto vary on a volume at system startchvg -a y

    # Turns on/off quorum checking on a volume groupchvg -Q [y|n] Renaming varyoffvg lsvg -p (obtain disk names)exportvg import -y varyonvg mount -aImporting importvg -y importvg (will use rootvg as default vg)Exporting varyoffvg exportvg

    Note: if the volume has an active paging space this must be turned off beforeLogical VolumesDisplay lslv lslv -l (list all physical volumes in logical volume)lslv -m (list ppartition mapping)

    ## Display lv control block informationgetlvcb -AT Creating mklv ## Create a mirrored named logical volume

    mklv -y -c Extending extendlv

  • 5/21/2018 Aix Details

    4/46

    syncvg -v syncvg -l mirror any unmirrored volumes mirrorvg change volume attributes ## Enable the bad-block relocation policy

    chlv -b [y|n] renaming chlv -n

    Miscellaneous ## Initialises an LV for use as an JFSloglogform Filesystemsdisplay lsfslsfs -q (detailed)

    Note: use the '-q' to see if the logical volume size is bigger than the filesystem sizecreate ## create new filesystem, -A means to mount after restartcrfs -v jfs -d -m -A yes

    ## Create logical volume, filesystem, mountpoint, add entry to /etc/filesystems

    at the specified sizecrfs -v jfs2 -g -m -a size=

  • 5/21/2018 Aix Details

    5/46

    Complete VG, LV and FS with mirroring example ## Create the volume groupmkvg -s 256 -y datavg hdisk2## Create the jfs2 log logical volume and initialize it this for the volume groupmklv -t jfs2log -y dataloglv datavg 1logform /dev/dataloglv

    ## Create the logical volumemklv -t jfs2 -y data01lv datavg 8

    ## Create the filesystems that will use the logical volumecrfs -v jfs -d data01lv -m /data01 -A yes

    ## Add an additional hard disk to the volume groupextendvg datavg hdisk3

    ## Now mirror both the volume group log logical volume and the logical volumemklvcopy dataloglv 2mklvcopy data01lv 2

    ## Make sure everything is sync'ed both the log and the logical volumesyncvg -v datavg

    ## Make sure everything is OKlsvg -l datavg

    ## a quick way to perform the above in two stepsmklv -c 2 -t jfs2 -y data02lv datavg 8crfs -v jfs -d data02lv -m /data02 -A yes

    ## mount everything and checkmount -a

    Replaced failed mirror drive ## break the mirror (two ways to do this)rmlvcopy 1 unmirrorvg ## remove the disk from the vgreducevg ## remove the hdisk from ODMrmdev -dl

    ## physically replace the diskdiag -> function select -> task selection -> hot plug task -> scsi and scsi raidhot plug manager -> replace/remove a device attached to an scsi hot swap enclosure device -> select disk and follow instructions

    ## configure new disk an check the new number (hopefully the same)cfgmgr -vlsdev -Cc ## add back to volume groupextendvg ## create mirror (two ways to do this)mklvcopy 2 mirrorvg

    ## sync mirrorsyncvg -l

    ## If this is the rootvg there are additonal steps to takebosboot -ad /dev/bootlist -m normal

  • 5/21/2018 Aix Details

    6/46

    bootlist -m normal -oAccidently remove a mirrored disk or SAN LUN disappeared off the network## This procedure places back a mirror disk that you have accidently pulled or that a SAN LUN disappeared off the network## and its states is classed as "missing"

    ## see that the disk is in a missing state (see PV state column), also see stale

    volumeslsvg -p lsvg -M

    ## To make the disk active again we use the varyonvg commandvaryonvg

    ## see that the disk is in a active state (see PV state column)lsvg -p

    ## Now re-sync the volumes in that volume groupsyncvg -v

    ## Make sure that no volumes are stalelsvg -M

    ## Determine if the ODM and VGDA are correct (in sync)getlvodm -u System data managed by ODM includes: Device configuration informationo Predefined: Devices that AIX has drivers for or knows about, but are notcurrently installed or active.o Defined: Logical devices or drivers which don't map directly to a physical device. This includes network configuration, LVM configuration, and installedsoftware information.

    o Available: A physical hardware device which is installed, configured, and in use. Display information for SMIT (menus, selectors, and dialogs) Vital product data for installation and update procedures Communications configuration information System resource informationODM on the filesystemODM spreads its files over the filesystem. These three directories are all usedfor storing files related to ODM: /usr/lib/objrepos /usr/share/lib/objrepos /etc/objrepos

    You can see which one is the default by checking the ODMDIR variable on a system:# echo $ODMDIR/etc/objreposIf you list all the files in this directory you'll see quite a list:/etc/objrepos>lsATM_PVC CuDvDr FRUB PDiagTask SRCextmeth errnotifyCDiagAtt CuPath FRUB_SRC PDiagTask.vc SRCnotify historyCDiagAtt.vc CuPath.vc FRUs PdAt SRCodmlock history.vcCDiagDev CuPathAt FRUs_src PdAt.vc SRCsubsv

    r inventoryConfig_Rules CuPathAt.vc MenuGoal PdAtXtd SRCsubsys inventory.vc

  • 5/21/2018 Aix Details

    7/46

    CuAt CuVPD PDiagAtt PdAtXtd.vc SWservAt lppCuAt.vc CuWxt PDiagAtt.vc PdCn SWservAt.vc lpp.vcCuData DAVars PDiagDev PdDv TMInput

    productCuData.vc DSMOptions PDiagDev.vc PdDv.vc config_l

    ock product.vcCuDep DSMOptions.vc PDiagRes PdPathAt crypto_moduleCuDv DSMenu PDiagRes.vc PdPathAt.vc crypto_module.vcThere are two main sets of files, explained here:The Pd* FilesThe first set of files that you'll need to understand are the Pd* files, which contain the predefined system objects. The entries in these files are loaded fromthe installation tape; under normal use, they should not be edited.PdDvThe Predefined Device object class file contains an entry for every known device

    on the system. It includes definitions for all of the configurable printers, expansion cards, device drivers, logical volumes, volume groups, and many more.PdAtThe Predefined Attribute object class file contains device-dependent informationnot found in the PdDv file but relevant to device configuration. These attributes become the default values if they are not modified. Modified attributes are written to the CuAt. The uniquetype field actually consists of the first three entries in the PdDv: type, class, and subclass. These entries are used to link theattributes to the specified device. This mechanism ensures a unique name for each device.PdCnThe Predefined Connection object class file contains information about how devices physically connect to the system.

    The Cu* FilesThe second set of files to understand are the Cu* files, which contain the customized system objects.CuAtThe Customize Attribute files contain non-default values for the specified device. The default values are kept in the PdAt file. Both files must be searched tofind all of a device's attributes. A defined ethernet adapter entry would look like that in the PdAt file; otherwise the entry would not exist.CuDepThe Customize Dependency object class file contains logical dependencies betweendevices. The file does not contain customized dependencies between two physicaldevices. If present, these would be in the CuDv file.

    CuDvThe Customize Device object class file contains physical dependencies.CuDvDrThe Customized Device Driver object class file is managed through special deviceconfiguration library routines to guarantee atomic changes.CuVPDThe Customized Vital Product Data object class contains customized data recordedon the topology disk for use by IBM Customer Engineers.ODM CommandsThis warning is from the IBM Redbook:Note: ODM commands should be used only when traditional methods ofsystem maintenance, such as SMIT, are ineffective. For a beginningsystem administrator, it is recommended that you perform additional

    reading and exercises before using these commands. Incorrect use ofthese commands may result in a disabled system. The ODM commandsare described here for introductory purposes.

  • 5/21/2018 Aix Details

    8/46

    Command Explainationodmadd Adds objects to an object class. The odmadd command takes an ASCII stanza file as input and populates object classes with objects found in the stanza file.odmchange Changes specific objects in a specified object class.odmcreate Creates empty object classes. The odmcreate command takes an ASCII file describing object classes as input and produces C language .h and .c fil

    es to be used by the application accessing objects in those object classes.odmdelete Removes objects from an object class.odmdrop Removes an entire object class.odmget Retrieves objects from object classes and puts the object information into odmadd command format.odmshow Displays the description of an object class. The odmshow commandtakes an object class name as input and puts the object class information intoodmcreate command format.ODM ErrorsThe error we got I mentioned before: sudo smitty chgsys changing:

    o Maximum number of PROCESSES allowed per userWhen you try this you'll get the error:chdev: 0514-518 Cannot access the CuDv object class in the device configuration database.This is because of the variable ODMDIR. When you want to change the device sys0(which is what you're doing) you need access to the CuDv database. The system can find the database by the variable ODMDIR. Although the user has this variable,you perform smitty as being root without the variables. A workaround for this problem is to change directory to the value of ODMDIR (in my case /etc/objrepos)and run the command from there. Smitty will look in the current directory for the CuDv database and will find it there.Physical Volumes (PVs)Physical volumes are a wrapper of sorts that is placed around a disk drive to al

    low it to be managed. A PV normally consists of 1 distinct physical disk. But inthe case of a RAID controller, a PV consists of an entire "logical" disk, as presented to the system by the RAID controller.Volume Groups (VGs)A pool of storage, consisting of one or more physical volumes. A volume group may span multiple physical disks. A volume group can be thought of as a logical disk. Storage is allocated to one or more logical volumes, which can grow or shrink in size.Logical Volumes (LVs)If VGs can be thought of as disks, Logical Volumes can be thought of as partitions or slices on those disks. An LV is the object that filesystems, raw partitions, and paging space is built upon. Logical volumes can be expanded or moved from

    one PV to another on the fly while the LV is in use.Logical volumes cannot be reduced in size. If a LV must be shrunken, you will need to back up the data, remove the LV, create a new smaller LV, and then restorethe data.JFSThe Journaled File System has several advantages over the BSD and UFS filesystems used in other Unixes. One disadvantage of UFS and BSD file systems is the possibility of file system corruption in the event of a system crash or power failure. This corruption can occur when files or directories are created or removed, but the system crashes before the information can be written to disk. This can lead to unreferenced files, missing file blocks, or file blocks belonging to multiple files.This problem is much reduced in JFS file systems through the use of a log volume

    for file systems. While cached data can still be lost if the system crashes before it is synced to disk, file system changes such as inode and block allocationand freeing are logged to disk right away. In the event of a system crash, this

  • 5/21/2018 Aix Details

    9/46

    log file is replayed prior to bringing a file system back on-line. This allowsthe file system structure to be intact even after a crash. This log replay process is much much quicker than the traditional fsck process. In a UFS file system,all block allocation must be verified, which takes multiple passes. Multi-gigabyte file systems can take tens of minutes to fsck. File systems in the hundredsof gigabytes can take hours to fsck if corrupted.In contrast, JFS logs can be replayed in tens of seconds, even for large file sy

    stems. This is because only small log has to be processed rather than entire disks.JFS file systems still may occasionally need to be fsck'd, but the is a much rarer occurrenceCreation of Filesystem:The crfs command creates a file system on a logical volume within a previously created volume group.

    A new logical volume is created for the file system unless the name of an existing logical volume is specified using the -d. An entry for the file system is putinto the /etc/filesystems file.Commands

    ##With an existing logical volume:# crfs -v jfs2 -d -m -A yes

    -v vfs type (Specifies the virtual file system type)

    -d Specifies the device name of a device or logical volume on which to make the file system. -m Specifies the mount point, which is the directory where the file system will be made available -A Specifies whether the file system is mounted at each system restart: yes:File system is automatically mounted at system restart. no:File system is not mounted at system restart (default value).

    Note: start of changeThe crfs command accesses the first letter for the auto mount -A option.end of change

    ## Create logical volume, filesystem, mountpoint, add entry to /etc/filesystemsat the specified size

    # crfs -v jfs2 -g -m -a size=

  • 5/21/2018 Aix Details

    10/46

    umountall: Unmounts groups of dismountable devices or filesystems ( applicable to v7.1)3) List Filesystems:To list filesysem use "lsfs" or "mount"

    lsfs Lists all filesystems in the /etc/filesystems entry

    lsfs -a To list all filesystems (default)

    lsfs -q (detailed)

    lsfs -q List all filesystems with detailed info (shows size of FS and LV in it.so we can check whether size of LV=size os FS)

    lsfs -l Specify the output in list format

    lsfs -c Specify the output in column format

    lsfs -v jfs Lists all jfs filesystems

    mount (to list all mounted filesystems)

    mount ( to list the mounted filesysem)

    Note: use the '-q' to see if the logical volume size is bigger than the filesystem size4) Display Filesystem usage:To display information about all mounted file systems, enter: dfCommand Examples1) If your system has the /, /usr, /site, and /usr/venus file systems mounted, the output from the df command resembles the following:

    df

    Filesystem 512-blocks Free %Used Iused %Iused Mounted on/dev/hd0 19368 9976 48% 4714 5% //dev/hd1 24212 4808 80% 5031 19% /usr/dev/hd2 9744 9352 4% 1900 4% /site/dev/hd3 3868 3856 0% 986 0% /usr/venus

    2) To display information about /test file system in 1024-byte blocks, enter:

    df -k /test

    Filesystem 1024 blocks Free %Used Iused %Iused Mounted on/dev/lv11 16384 15824 4% 18 1% /tmp/ravi1

    This displays the file system statistics in 1024-byte disk blocks.

    3) To display information about /test file system in MB blocks, enter:df -m /test

    Filesystem MB blocks Free %Used Iused %Iused Mounted on/dev/lv11 16.00 15.46 4% 18 1% /tmp/ravi1

    This displays file system statistics in MB disk blocks rounded off to nearest 2nd decimal digit.

    4) To display information about the /test file system in GB blocks, enter:

  • 5/21/2018 Aix Details

    11/46

    df -g /test

    Filesystem GB blocks Free %Used Iused %Iused Mounted on/dev/lv11 0.02 0.02 0% 18 1% /tmp/ravi1

    This displays file system statistics in GB disk blocks rounded off to nearest 2nd decimal digit.

    5) Resize Filesystems:chfs -a size= Command Exampleschfs -a size=1G /var (specific size, can be used to increase and decrease)chfs -a size=+1G /var (increase by 1GB)chfs -a size=-1GB /var (reduce by 1GB)

    Note1:This will automatically increase or decrease the underlying logical volumeas well.Note2:You can't reduce jfs filesystem6) Modify/Change Filesystems:Command Examples

    ## Change the mountpoint

    chfs -m chfs -m /test /new ==>Change the mount point from /test to /new

    ## Do not mount after a restart

    chfs -A no ## Mount read-only

    chfs -p ro ## Remvoe attribute of a filesystem

    Remove account attribute of /test.(from /etc/filesystems file)

    chfs -d account /testchfs -a options='rw' /shadow ==> shows with lsfs rw (I think rw is the deafaultanyway)

    7) Remove Filesystems:Command Examplesrmfs rmfs -r /test ==>Deletes FS /test its mount point and associated LV

    Note1: You need to unmount the filesyem before removing.Note2: if all filesystems have been removed from a logical volume then the logical volume is removed as well.8) Freeze File System:If you don't want your file system to perform any writes for a period of time, maybe due to an admin task like a split copy or a backup, you can freeze the filesystem. After the admin tasks are completed, you can thaw the file system.chfs -a freeze= chfs -a freeze=off 9) Split mirrored copy of filesystem:chfs -a splitcopy= -a copy=2 chfs -a splitcopy=/backup -a copy=2 /testfs

    This will mount the 2nd copy of mirrored filesystem testfs to /backup in read-only mode for backup purpose10) defrag fielsystem:

  • 5/21/2018 Aix Details

    12/46

    The defragfs command can be used to improve or report the status of contiguous space within a file system.Command Examplesdefragfs /test ==>To defragment the file system /testdefragfs -q /test ==>Display the current defrag status of the file system

    For example, to defragment the file system /home, use the following command:

    defragfs /home

    Here is an example output:

    # defragfs /homeDefragmenting device /dev/hd1. Please wait.

    Total allocation groups : 32Allocation groups skipped - entirely free : 26Allocation groups defragmented : 6defragfs completed successfully.

    Total allocation groups : 32Allocation groups skipped - entirely free : 26Allocation groups that are candidates for defragmenting : 6Average number of free runs in candidate allocation groups : 1#11) fuser & filesystem:Command Examplesfuser /etc/passwd lists the process numbers of local processes using the /etc/passwd file

    fuser -cux /var shows which processes are using the given filesystem

    fuser -cuxk /var it will kill the above processes

    fuser -dV /tmp shows deleted files (inode) with process ids which were open by aprocess (so its space could not be freed up)

    (-V: verbose will show the size of the files as well)if we rm a file, while it is opened by a process its space will not free up.solution: kill the process, wait for the process to finish or reboot the system12) Checking and Repairing:Command Examplesfsck [-y|-n] (check a filesystem)

    fsck -p lt;fs> (restores primary superblock from backup copy if corrupt)

    fsck -y n /dev/lv00 ==>To check the filesystem associated to /dev/lv00 assumingresponse "yes"13) Miscellaneous Filesystem Commands:Command Examplesskulker ==> cleans up file systems by removing unwanted or obsolete files

    fileplace ==> displays the placement of file blocks within logical orphysical volumes, it will show if a file fragmentedFile system resides on a logical volume. So the size of the file system would bein multiples of logical partitions. Every logical partition would be pointing to a physical partition.

    An individual file within a file system would be allocated data blocks which isusually 4 KB in size. In traditional UNIX systems the data block size was 512 bytes.

  • 5/21/2018 Aix Details

    13/46

    The first very important component of a file system is called the superblock. The superblock contains information about the file system in terms of the name ofthe file system, its size, number of inodes in the file system, etc.The superblock information is very critical and will be utilized by the system whenever the file system has to be mounted and accessed. If the superblock goes corrupt, then the file system will not be able to be mounted also. So a backup co

    py of the superblock is always written in block 31.Right after the superblock are the inodes. Inodescontains information of files like file permissions, file type, size, owner, group, created/modified date and time and they also contain the pointers to data block.Data block contain data. Indirect data block maintain addresses to the actual data block.Explanation:This is the structure of the inodes. Each file on your system is represented bya single inode. The inode for a file contains information about the file in terms of>Inode number for the file>Ownership

    >Access Permissions>Type of the file>Creation, modification and access times>Number of links to the file>Size>Addresses of data blocks on disk.

    Use can use the command ls with the option i to look at the contents of the inodefor that file.Explanation:In AIX the filesystemis broken into blocks called as data blocks. These data blocks by default are 4 kb in size i.e. 4096 bytes in size.

    Lets imagine you have a file called file1 which is about 1900 bytes. To store this file in the filesystem, you will require a data block (4 kb). That means file1 occupies 1900 bytes of the data block and the rest of the space in the 4 kb data block is empty. But even though rest of the space is empty, this space cannotbe utilized by the file system to allocate it any other file. So in these circumstances, potentially you could have more amount of unused or wasted space.

    Here is where we can get an intro to the concept of Fragmentation.

    Fragmentation is a concept wherein a single data block can be broken logically into smaller fragments of size ranging from 512 bytes to 4 kb. Lets say I choosea fragment size of 1kb, that means the data block of 4 kb size is broken into 4

    fragments.This would ensure that if there was a small file lets say about 1900 bytes, to store this particular file, I would potentially use up only 2 fragmentsof the data block and the other two fragments can be allocated to files if necessary. Thus reducing the amount of unused and wasted space in your filesystems.Number of bytes per inode

    For how many number of bytes should a inode be generated ?for example: nbpi=4096 would create an inode for every 4096 bytes.

    Explanation:In a Journaled File System, when ever a file is created, its respective inode also has to be created. The inode maintains details about the file. In earlier ver

    sions of JFs, the number of inodes created for a file system was fixed and it was generated for every 4 KB of disk space of that file system. That means 1024 inodes would be generated. If the data block size also remains at 4 KB, these many

  • 5/21/2018 Aix Details

    14/46

    inodes was actually enough to cater to the needs of the file system.

    But since fragmentation came into picture, wherein instead of sticking to 4 KB data block size, the data block was able to be fragmented in smaller sizes lets say 1024 ie1KB, the need for more number of inodes also increased since there would be potentially more smaller files in the file system. Here is where the nbpivalue (number of bytes per inode) can be reduced/changed to suit the requirement

    s. So now nbpi=1024 would mean, please create a inode for every 1024 bytes of the space allocated to this file system.Explanation:

    Allocation group size concept increases the efficiency of the file system. Allocation group is nothing but a logical grouping of related datablocks and the inode into a single group to increase the speed at which the data can be accessed within a filesystem.

    The following small table gives you the Allocation Group Size and its respectivenbpi values that are supported:Allocation Group Size NBPI

    8 MB 512,1024,2048,4096,8192,1638416 MB 1024,2048,4096,8192,16384,3276832 MB 2048,4096,8192,16384,32768,6553664 MB 4096,8192,16384,32768,65536,131072Explanation:Compressed file system save disk space by allowing a logical block to be storedon the disk in units or fragments smaller than the full block size of 4096 bytes.

    Data compression allows all logical blocks of any sized file to be stored as oneor more contiguous fragments. On an average, data compression saves disk spaceby about a factor of 2. There is no support for compression with JFS2 file system.

    Recommendations: The root file system must not be compressed. Compression of the/usr file system is not recommended.Large File Enabled File Systems

    File = 132 MB

    (1024 * 4 KB blocks) + (1024 * 128 KB blocks) = 132 MB4 MB + 128 MB = 132 MB

    Explanation:

    Before discussing the Large File Enabled File System, Lets take a normal scenario of a file of size 140 MB. The default block size for this file system is 4 KB.That means, to store a file of 140 MB size in 4 KB blocks we would require 140MB /4 KB = 35840 number of data blocks. That means to read this file the systemhas to perform 35840 I/O operations.

    With Large File Enabled File System, the first 4 MB of the file will be allocated in 4 KB blocks and the rest of it will be allocated in 128 KB blocks. That means for the same file which is 140 MB in size, first 4 MB will be allocated using4 KB blocks (4MB / 4 KB = 1024 blocks) and rest of the file is 136 MB will be allocated in 128 KB block ( 136 MB / 128 KB=1088 blocks). Totally in a Large FileEnabled File System to allocate this file of 140 MB only 1024+1088 ie 2112 data

    blocks will be required and this calculation itself is an indication how a Large File Enabled File System can bring in performance. ( Only 2112 I/O operationsare required to read the file instead of 35840 blocks.

  • 5/21/2018 Aix Details

    15/46

    Explanation:

    Jfslogs are kept in /dev/hd8. The journal logs are circular logs. The size of the journal log is 1 PP size. The jfslog is used to ensure file system integrity by writing all metadata information to the jfslog immediately.In journal log, only inode and indirect data block information is stored and not

    the actual data block.There is also a new feature called inline log that is introduced with JFS2. Thisinline log allows you to log directly to the file system.Explanation:

    JFS2 (Enhanced JournaledFile System)Is a new file system introduced in AIX5.1. The base for JFS2 is JFS file system.At present JFS2 is the only standard file system supported on Itanium based platform.

    Extent Based Allocation:JFS2 uses extent based allocation. An extent is an address length pair, which id

    entifies the starting block address and the length of the extent in blocks. Thisallows multiple adjacent blocks to be addressed. The advantage of extend basedallocation are high performance and large file size.

    In JFS2 the inodes are created dynamically i.e. on fly whereas in JFS there wasa fixed number of inodes that was getting created during the creation of the file system. An inode in JFS2 file system is of size 512 bytes when compared to theJFS inode size of 128 bytes.

    Migration issues: JFS and JFS2 can co-exist on the same system. But to migrate aJFS into JFS2, take the backup of data on the JFS file system, create a new JFS2 file system, restore the JFS file system backup on the new JFS2 file system.

    Physical Volumes are nothing but the hard disks. These physical volumes belong to a volume group.

    Physical Partitions (PP) is the smallest allocatableunit on your physical volume. These physical partitions should be the same size across the entire Volume Group. However, since there can be multiple Volume Groups on a single system, eachvolume group can have different PP size. The PP size can be in the range 1-1024MB.

    Default number of PPs per Physical Volume is 1016 but can be increased to suit your requirements.Explanation:

    The command lspv which stands for list all physical volumes in the system, internally uses the undocumented command getlvodm C to list the physical volumes in the system.

    The lspv command without any parameter can be used to list the physical volume name, the PV identifier, and the Volume Group name that it belongs to.

    The command lspv gives the status information, number of PPs, PP size,to which volume group it belongs to, free PPs and its distribution in terms of intra policy etc.Explanation:The command lspv l hdisk0 lists all the logical volumes present on a physical vol

    ume. The output of the command would give information about the LV name, numberof LPs, number of PPs, Its distribution and its mount point.Listing physical Partition map for a Physical Volume

  • 5/21/2018 Aix Details

    16/46

    Explanation:

    The command lspv p pvname lists all the logical volumes on a disk and they physical partitions to which its logical partitions are mapped.

    The output of the command would display, the PP number, its STATE ie whether its free or used up, intra region where the PP is situated, LV name, type of the LV and mount point.Add/Move contents of a physical volume

    Add a disk -> Can be done using SMIT or by cfgmgr when the system boots up.To move the contents of a physical volume# migratepv l lv00 hdisk0 hdisk1

    Explanation in detail:

    To add a physical volume to the system, you can use the Add a Disk option from the fixed disks menu under Devices main menu in SMIT.

    Once the disk is added to the system, it has to be made part of a volume group so that you can start using the disk.

    Another method of adding a disk to the system is, power off the system, add thenew disk physically to the system. Power On the system during which the programcalled cfgmgr will be invoked to configure the newly added disk.Once the new disk is added, if you want to migrate a existing logical volume from old disk to the new one, you can use the command called migratepv.

    The syntax for migratepv command is# migratepv l lv00 hdisk0 hdisk1I.e. l option to specify the logical volume name that you are planning to migratefollowed by the source hard disk name and the destination hard disk name.Documenting the Disk Storage

    List of the disks on the system (PVID and volume group):# lspvList the volume groups:# lsvgList what logical volumes are contained in each volume group:

    # lsvg -l vgnameList the logical volumes on each disk:# lspv -l pvnameLogical Track Group (LTG) Size

    LTG is the maximum transfer size of a logical volume

    Prior to AIX 5L V5.3:Default LTG size is 128 KBLTG size can be changed by the -Lflag on the chvgor mkvgcommand

    In AIX 5L V5.3 and above:

    AIX 5L V5.3 dynamically sets the LTG size (calculated at each volume group activation)LTG size can be changed with the command: varyonvg -M

  • 5/21/2018 Aix Details

    17/46

    The mkvg -Lflag is no longer supportedThe chvg -Lflag has no effect on volume groups created in AIX 5L V5.3Enable variable LTG on old volume groups using chvg -L 0

    To display the LTG size of a disk, use the command:# /usr/sbin/lquerypv -M

    LTG (Logical Track Group) size is the maximum allowed transfer size for disk I/Ooperations. In the earlier versions of AIX, the LTG size that was supported was128 kb. Many hard disks now a days support larger sizes of transfer rate. So totake the advantage of these larger transfer rate you can change the LTG size tothe size iesupported by the disks.# /usr/sbin/lquerypv M hdisk0

    256 . -> the LTG size of the hdisk0 is 256. So the LTG size of the volume groupcan be changed to this

    value.

    You can set the LTG size while creating the volume group ie while using the mkvgcommand or after thecreation of the volume group using chvg command .

    In AIX version 5.1 and above, the following values for the logical track group size is supported:a.128 kbb.256 kbc.512 kb

    1024 kbHOT SPARE: Is a disk or group of disks used to replace a failing disk. LVM marksa physical volume missing due to write failures and then it starts the migration of data to the hot spare disk.

    For incorporating Hot Spare in the LVM, logical volumes must be mirrored, All logical partitions on hot spare disks must be unallocated and hot spare disks musthave at least equal capacity to the smallest disk already in the volume group.

    Hot Spare Policy:y(lower case) -> automatically migrates partitions from one disk to one spare. The smallest spare which is enough to substitute for the failing disk will be use

    d.Y (upper case) -> automatically migrates partitions from a failing disk, but might use the complete pool of hot spares.n-> No automatic migration occurs. This is the default value.r -> Removes all disks from the pool of hot spare disks.

    Hot spare synchronizing policyy -> automatically attempts to synchronize the stale partitions.n -> Will not automatically attempt to synchronize. This is the default

    E.g.: chpvhyhdisk1-> marks hdisk1 as a hot spare. chvghysytestvg-> sets automatic migration policy and automatic synchroniz

    ing policy.

    Extending and Reducing Volume Groups

  • 5/21/2018 Aix Details

    18/46

    Note: Will not retain current disk contentsActivate/Deactivate a Volume Group

    To activate a volume group:# varyonvg oravg

    To deactivate a volume group# varyoffvg oravg

    Explanation:

    The command varyonvg can be used to activate a volume group that is not activated at system startup.There is also an option with varyonvg i.e. f option. This option can be used to force a volume group to get activated. This may be needed if you have lost the quorum, but still want to varyon the VG.

    The command varyoffvg can be used to deactivate a volume group. No logical Volumes should be open when you run this command.

    NOTE: Its not possible to varyoffvg the rootvg.

    Importing a Volume Group

    If you have a volume group on a removable disk that you want to access on another system, you must export the volume group from the current system using the exportvg command. This command removes the volume group related information from the system (i.e. from the ODM). To export a volume group it should be inactive.

    To access the exported volume group on another system it has to imported into the other system by using the importvg command.

    Explanation:Mirroring is when a logical partition maps to more than one physical partition of the same volume group.

    Ideally each copy must reside on a separate disk but this restriction can be removed.

    There are various mirroring scheduling policies:a.Parallel policy: Read: On each read, the system checks whether the primary is

    busy. If its not busy, the read is initiated on the primary, otherwise from secondary. Write: Initiated concurrently.b. Parallel/Sequential: Read: Always reads on primary copy. Write: Initiated concurrently.c. Parallel/Round robin: Read: Alternates between copies, resulting in equal utilization. Write: Initiated concurrently.d. Sequential: Read: Always reads on primary copy. Write: initiated serially, first to the primary and thento secondary diskMWC ( Mirror Write Consistency)

    Explanation:

    MWC (Mirror Write Consistency) ensures data consistency on logical volumes in ca

  • 5/21/2018 Aix Details

    19/46

    se of system crashes during the mirrored writes.

    There are two methods of MWC :a.Active Method: Consistency is achieved by logging when a write occurs. LVM makes an update to the MWC log that identifies what areas of the disk are being updated before performing the write of the data. This actually results in a performance degradation during random writes.

    b.Passive Method: Introduced with AIX version 5.1. Passive method reduces the problem of having to update the MWC log on the disk. This method logs that the logical volume has been opened but does not log writes. If the system crashes, thenthe LVM starts a forced synchronization of the entire logical volume when the system restarts.

    You can set MWCfor a logical volume by using the option wwith either the mklvcommand or with the chlv command. The various options to set for the MWC option(-w)are:

    a.y or a (Yes or Active) Each write is logged to MWC log. Default value setting.

    b.P ( Passive)Use the passive method.c.n (No)There is no MWC, if there is a crash, then the mirrored LVs are in inconsistent state.Striping

    Normal flow of data blocks when a logical volume is spread across physical volumes:The layout of stripe units when a logical volume is set up to stripe:

    Consecutive stripe units are created on different physical volumesStriping increases read/write sequential throughput by evenly distributing stripeunits among disks

    Stripe unit size is specified at creation timeStriped Columns

    Explanation:

    Striping is a technique for spreading the data in a logical volume across several hard disks such that I/O capacity of all disk drives can be simultaneously used.

    In a non striped logical volume, data is accessed using the addresses to the data blocks within the physical partitions.

    In a striped logical volume, the data is accessed using the addresses of the stripe units (data of a striped logical volume is broken into units called stripe units). The size of the stripe unit is usually specified during the creation timeand it could range form 4 kb to 128 kb.

    To implement striping at your size, at least two physical volumes are required.Recommendation is that the number of physical partitions allocated to a stripedlogical volume must be able to be evenly distributed among the disks.Intra-physical volume allocation policy:

    Inter-physical volume allocation policy:

    Maximum number of physical volumes to use Range of physical volumes to useExplanation:

  • 5/21/2018 Aix Details

    20/46

    Intra physical volume allocation policy specifies where on the physical volume the partitions will be allocated to the logical volume. The choices could be inner edge, inner middle, centre, outer middle and outer edge areas. Usually the centre area generally was the area with the best performance on older disks but maynot be true with the newer disks. You may have to go through the documentationfor the hard disks to come to a conclusion.

    Inter physical volume allocation policy specifies how many physical volumes canbe used to contain the physical partitions of the logical volume. It also specifies the range of volumes used i.e. minimum ( allocate partitions on one physicalvolume or as many as there are (maximum).

    Objectives for the module

    1. Under the Logical Volume Manager and related Concepts like

    Volume GroupsPhysical VolumeLogical VolumePhysical PartitionsLogical Partitions

    2. Understand File systems and Logical Volumes

    Logical Volume Manager Components

    Volume group (VG)Physical volume (PV)Physical partition (PP)Logical volume (LV)Logical partition (LP)

    PHYSICAL STORAGE

    Volume Groups

    Volume Groups (VG): Is a collection of related hard disks. By default when AIX is installed, you will have one volume group created on your system called rootvg.The VG where data is stored is called as datavg

    A hard disk can belong to only one volume group at any given point of time. If required, later you can create volume groups if necessary or you can also add thenew hard disk to the existing volume group i.e. rootvg. But suggested is to isolate the rootvg as far as possible. There can be up to 255 VGs per system.

    Physical Volumes (PV): Are nothing but hard disks. Any hard disk at any given point of time can belong to only one volume group. Every hard disk would be givena unique name i.e. the logical device name and the entry for the same would be m

  • 5/21/2018 Aix Details

    21/46

    ade in the /dev directory.

    Physical Partitions (PP): A physical partition is the basic unit of disk space allocation in AIX. By default the PP size is 4MB and by default there can be maximum 1016 PPs in a physical volume.

    Since now a days most of the hard disks are size wise larger than 4 GB, the calculation of 4 MB pp size and max 1016 PPs per PV may not serve the purpose. Hereis where we can think about changing the default PP size from 4 MB to a higher size. PP sizes can range from 1 to 1024 MB. There is also another mechanism to solve this problem. Instead of sticking to the default number of PP per PV as 1016, even this value can be changed to 2032, 4064 and so forth.

    PP size in a volume group should be of the same size and the PP size cannot be changed dynamically.Physical Storage Volume(VOLUME GROUPS)

    There are three types of volume groups that you can create in AIX 5.3 or 6.1.

    A Normal Volume Group, a Big Volume Group and scalable Volume Group.

    1. Normal Volume Group: By default whenever you use SMIT or mkvg command, you create a normal volume group.2. Big Volume Group: This volume group was introduced in AIX ver4.3.2. A big volume group should be created using mkvg B command.3. Scalable VG: In 5.3 and above versions of AIX IBM has added one new VG knownas Scalable volume group.

    Whenever you create a volume group either using smitor high level command by default the max number of PPs on a PV is fixed at 1016. If you want to change thisvalue ie increase it, lets say to 2032 then you may have to use the option called t (called t factor) to change it. You can supply the t factor as 2 that means multiply the default value ie 1016 with 2 there by increasing the max number of PP per PV to 2032. But please remember that if you increase the max number of PPper PV then the maximum number of PV per VG decreases.

    Example: # mkvgt 2

    Would means to multiply default value 1016 by 2 so that the new maximum number of PP per PV is 2032 and not 1016.

    Volume Groups differences chart:

    How volume group look like: in terms of rootvg and datavg-

    Why create new volume groups?Separate user data from operating system filesDisaster recovery

    Data portabilityData integrity and security

  • 5/21/2018 Aix Details

    22/46

    Note: For Scalable VG you can have upto 1024 PVs and there is no limit for PPs per PV in this Volume group. There can be now 4096 LVs in Scalable VG. To createa Scalable VG use option S with mkvg command i.e#mkvg-S Hdisk#

    Volume Group Descriptor Area VGDA

    Volume Group Descriptor Area (VGDA): The VGDA is an area of the disk which maintains information about the entire VG. It contains information about number of logical volumes, list of physical volumes in the VG etc. There will be at least 1VGDA on each physical volume and some physical volumes may also have more than 1VGDA.

    Quorum: Quorum is equal to 51% or more of the VGDAs available. A quorum of VGDAis needed to activate the volume group and make it available for use and to ensure data integrity.

    Quorum is required whenever you need to varyonthe VG (activate) the VG. If the quorum is not available, the system administrator can force a volume group to activate without the quorum but is not recommended.Uses of Logical Volumes

    A logical volume may contain one of the following, and only one at a time:Journaled (JFS) or enhanced journaled file system (JFS2)Journal log (/dev/hd8)Paging space (/dev/hd6)Boot logical volume (/dev/hd5)

    Dump deviceNothing (raw logical volume)

    Examples of JFS/JFS2 logical volumes:/dev/hd1/home/dev/hd2/usr/dev/hd3/tmp/dev/hd4//dev/hd9var/var/dev/hd10opt/opt/dev/lv00/myfilesystem)

    What is JFS/JFS2 above? Read further for what is JFS.

    The logical volume can contain one of the following on them:

    a.File system: Logical volumes can be used to maintain data on them. That meansbefore storing data on them you need to apply a file system over it which helpsyou to arrange and manage your files and directories. You can choose either journaled file system (JFS) or Enhanced Journaled File System (JFS2) as your file system. The native files system in AIX is JFS. These file systems use database journaling techniques to maintain consistency of data.

    b.Paging Space: The logical volume can also be used as secondary ram area or pag

    ing space which is used by the Virtual memory manager service on your system tostore inactive memory pages of your processes. The default paging space logicalvolume in AIX is /dev/hd6.

  • 5/21/2018 Aix Details

    23/46

    c.Journal Log: The logical volume can also be used to store the journal logs ofthe other files systems. The default logical volume where the journal logs are maintained is in the logical volume /dev/hd8.

    d.Raw: Raw device is nothing but an empty logical volume. Certain applications like database related packages may require these raw logical volumes.

    File System Structure in AIX:

    A bit of explanation needs to be done here.. it goes like this.. read on:

    a. /hd4 : / (root)- It is the top level in the hierarchical structure of the file tree. It contains all files and directories that are critically required for system operations. It also contains files, directories and programs that are required for boot process.

    b. hd2 : /usrOperating system commands, libraries and application programs. Thecontents of this file system can be shared across the network.

    c.hd9var: /varVariable spool and log files. The files in this file system ievarvary considerably depending on the system activity.

    d./hd1: /homeAll users home directories which contain the user data and files arestored here.

    e.hd3: /tmpGlobal notepad for the system. Its a file system or space accessible for all users for temporary files and work space. Should be cleared and cleaned ona regular basis.

    f./proc: /procSpecial file system to support threads, or light weight processes.This file system doesnt contain any user files./etc/filesystems:

    To go to this screen use the command #cd /etc/filesystems

    The file /etc/filesystemsmaintains details of the all the filesystemson your AIXmachine. This file is made up of stanza, wherein each stanza maintains detailsabout a single file system.

    The various attributes in these stanzas could be:

    a.check: Used by the fsckcommand to determine the default file systems to be checked. This option can have values TRUE or FALSE.

    b.dev:identifies the logical device name of the logical volume on which the filesystem resides.

    c.Mount: used by the mount command to determine whether a file system should bemounted by default or not. Valid values could be TRUE, FALSE or automatic ( filesystems should be mounted during system startup).

    d.type: used to group together related file systems for easy handling.

    e.vfs:specifies the type of mount. i.e. virtual file system to mount.

  • 5/21/2018 Aix Details

    24/46

    f.vol: specifies a label for a file system.

    g.log: device to which log data is to be written.

    Mount:

    Mount: connects file systems to the directory hierarchy.

    File systems are associated with logical volumes.

    When you mount a file system, the logical volume and the contents of it is connected to a directory in the tree structure

    mount /dev/mylv /home/user9.

    Explanation:

    A file system has to be mounted, i.e. connected to a directory structure if youwant to use it. The command called mount can be used to do it. You can also unmount the file system by using the umount command or even using SMIT.If you want a particular file system to be mounted during system startup, you can do it by modifying the /etc/filesystems by using the options mount=automatic ormount=true.Mounting Over an Empty Directory

    Mounting Over Files

    Listing File systems

    You can use the command lsfs to get a list of all the file systems.

    The output in the above visual shows details about the file system. The variousattributes of the output are:a.Name of the file systemb.Node Name, which is only valid if the file system is a Network file system.c.Mount Point for the file system.d.Virtual File System (jfs, jfs2 or cdrfs)

    e.Size of the file systemf.Mount options if any, like ro(read only) or rw(read-write)g.Auto, automatic mounting during system startup or not.

    You can also use the fastpath #smit fs to get the same details.

    Listing Logical Volumes

    You can use the command lsvgl to get a list of all the logical volumesin a particular volume group.

    The output would show you details of the logical volumes, volume group wise.

    The output would show you:

  • 5/21/2018 Aix Details

    25/46

    a.Logical volume name.b.Type of the logical volume i.e. regular file system (jfs,jfs2) or journal logor paging space , boot etcc.Number of Logical partitions in the logical volumed.Number of Physical Partitions in the logical volume.e.How many physical volumes has the logical volume spread to.f.State of the logical volume i.e. open/closed/synchronized.

    g.Mount point.

    Understanding Devices

    Logical devices: These are also called special files. The users and applicationsuse the logical devices which are the links to the physical devices.

    Physical devices: Actual device connected to the system.

    Device Drivers: Device drivers are software that resides in the kernel that controls the activities and the data that is sent to the devices.

    /dev directory: The directory which contains all of the logical devices that canbe directly accessed by the user.

    Ports: The physical connectors/adapters in the system which allowattachment of many different devices are called ports. Portsare not only a connection point but they are also programmable by the system sof

    tware.

    /dev directory contents

    You can get the above output when you execute the command# lsl /dev

    In the output above, you can see that there are basically two types of devices,a.Block devices (b)Block devices use buffering to provide a block by block access to the device andits data.b. Character devices (c )Character devices are also called raw devices and are stream-oriented i.e. sequential access which provides no buffering.

    Usually in the fifth field where we see the size of the file, for a logical device we see a pair of values (for eg19,2). The first value is called the major num

    ber and the second value is called the minor number. Major number usually specifies the type of the device that we are working with and the appropriate device driver in the kernel that has to be used to work with the device and the minor nu

  • 5/21/2018 Aix Details

    26/46

    mber refers to the behavior of the device i.e. particular device of that particular major type.

    Predefined and Customized Devices

    The predefined and Customized devices are the two databases that are maintainedby the AIX system in the Object Data Manager (ODM).

    The predefined devices database has information about all the supported deviceson your AIX system. The customized devices database has information about all configured devices on your system.

    The two states in which the devices could be in the customized devices databasesare,Defined and Available.

    If you want to use a particular device, it has to be in the available state.

    Listing All predefined and Customized Devices

    The list of commands to list the predefined and customized devices are here..

    lsdev P H-> displays all predefined devices (supported devices)lsdev Pc disk-> displays all predefined devices of class type disklsdev C H-> displays all customized devices (configured devices)lsattr EH l sys0-> display all effective attributes of the logical device sys0

    Devices are classified by class, type and subclass where the Classindicates whatthe device does, Typeindicates what model it is, and subclassindicates how it canbe attached to the system.

    The command lsdev can be used to list the devices.

    There are various options available with this command, like:a. P -> show the devices from the predefined devices database. (show the supported devices)b. -H -> Show a heading along with the outputc. -C -> Show the devices from the customized devices database (show the configu

    red devices)d. -c -> class of the device like disk, tape.

  • 5/21/2018 Aix Details

    27/46

    lsattr command can be used to list the attributes for a particular device. Thiscommand comes with lots of options like :--E -> show only the Effective attributes.-l -> To specify the logical device name.

    Device States

    The states of the devices are as follows:Undefined: The device is a supported device on the AIX system. Its present in the predefined devices database.

    Defined: The device is present in the customized/configured devices database and

    the logical device files have been created but at present is un-available for use.

    Available: The device information resides in the customized devices database andthe device if fully configured and is ready for use.

    When the device is for the first time configured by the cfgmgr command, its putinto the available state. When you run the command rmdevl over a available deviceit slips into Defined stage. When you run the command rmdevdl over a defined oran available device, it slips into undefined state. Though there is no recognizable state called Undefined, it means that the device is just a supported device on

    your system and is still not configured to work.

    How cfgmgr works

    Cfgmgr(Configuration Manager) command configures all self-configuring devices. While configuring the devices, cfgmgr checks whether the device is a supported device on your AIX system by checking the Predefined database ie PdDv. Once it knows that the information of the device is found in the pre-defined devices database, it uses the information to complete entries into the customized devices database is CuDv. It also loads the appropriate device driver into the AIX kernel and makes the logical device entries under the /dev directory.

    Most of the devices are self-configurable except for devices which are connectedvia parallel or serial ports like printers, ASCII terminals, modems etc.

    Working with Devices

  • 5/21/2018 Aix Details

    28/46

    You can use the fastpath #smit devices to manage the configuration information about the devices.

    Here you have all the options to configure the devices like Terminals, printersand plotters, console, hard disks, CDROMs etc.

    Device Addressing

    The location code for a device is information about where exactly is that devices

    connection in your machine.

    Its a path from the adapter, through the bus and to the device

    Location code is made up of 4 fields of information

    As a system administrator some times it becomes necessary to have a good understanding of where exactly is a particular device connected to the system. This maybe necessary during some troubleshooting scenarios.

    The location code would be referred to on the LED whenever there is a hardware failure, making it easy for the administrator to figure out which device has actually failed.

    The location code as mentioned above consists of up to 4 fields of information.Certain devices when listed could only show two pairs, that means this device isjust an adapter. If a devices location code is made up of four pairs of values then its a physical device attached to an adapter.

    Location code for a non scsi deviceAB-CD-EF-GH

    AB 00 -> devices attached to the processor 01 -> devices attached to the ISA bus 04 -> devices attached to the PCI busCD 01-99 -> pluggable cardsA-Z,0 -> integrated adapter cards

    EF --> Connector IDGH -> Port identifier, FRU for the device

  • 5/21/2018 Aix Details

    29/46

    ISA Industry Standard Architecture. These are the bus types. These bus types areused in the RS/6000 to connect devices like the diskette and the keyboard.

    PCI Peripheral Component Interconnect. These are the industry standard buses which are used by RS/6000 to connect other devices.

    Integrated adapter cards have electronics for that particular card/adapter builtit and integrated in the system planar thus making it impossible to shift to amuch better card if need arises. Whereas the advantage of a plug in card is thatthey are easily removable if there is a newer card available with newer features because the electronics of that card is inbuilt in the card itself.

    Example: Non-scsi location code:

    The picture is an example of a location code for a non-scsi device. The AIX System has a 128 port Async adapter card with 2 ports on it. To those ports are connected RANs(Remote Async Nodes) which looks like a hub with 16 ports on it. The ASCII terminals are connected to these ports of the RAN.

    In the example we have an ASCII terminal connected to one of the ports of the RAN ie port number 11 on the 1stRAN connected to the second port of the 128 port Async adapter card. The adapter is a plug in adapter card connected to a PCI bus

    (04) and in the slot 5 (05). So the entire location code for the device would be04 -05-21-11

    i.e. on the PCI bus(04) , in the slot number 5 (05), on the port number 2 (2) and RAN number 1 (1) and port number 11 (11) the ASCII terminal is connected.

    Location Code Format for SCSI Devices

    AB-CD-EF-G,H

    AB-CD - Identifies the bus and the adapter location Same as with non-SCSI devicesEF - For a single SCSI bus - 00 For a dual SCSI bus: Internal bus - 00 External bus - 01G,H G= SCSI address (SCSI ID) of the device H= Logical unit number of the device

    Example: scsi Location code

  • 5/21/2018 Aix Details

    30/46

    The above picture is an example of location code for a scsi device. There is a scsi adapter card plugged into your system on the PCI bus slot number 01. The scsi adapter itself has the scsi id 7 assigned to it. To this scsi adapter, there is an external scsi tape drive attached. The external scsi tape drive is assigned5 as the scsi id (either by using a jumper setting or by using a dip switch). So the location code for the external tape drive would be 04-01-00-5,0. That is o

    n the scsi adapter whose address is 04-01, there is a scsi device attached to the single scsi bus (00) whose scsi id is 5 and no Logical Unit Number (LUN) (0).

    Example 2: Location Code Example for SCSI Device

    SCSI Devices (Disk, Tape, CD-ROM)

    Listing Device Physical Locations

    CuDv Customized Devices# lsdev -C -H -F "name status physloc location description"

    How to add a ASCII terminal

    Most of the devices are self-configurable device which can be directly configure

    d by the cfgmgr. Devices which get attached to the parallel port or the serial port like the printer, ASCII terminals, modems etc are not self configurable devices, so they have to configured separately.

    The picture above shows an example of how to configure/add a ASCII terminal to your AIX system.

    You can use the fastpath# smit tty to add /configure a ASCII terminal on your system.Choose the option Add a tty-> you may have to select the terminal type is rs232 or rs422. rs232 is the mostcommon tty type

    -> now you may have to select the parent adapter name ie where exactly is the terminal attached ie serial port 1 (sa0) or serial port 2 (sa1) etc.

    Adding a terminal

    In this final dialog panel to add a terminal, the only mandatory field for you to enter is the port number. Enter the port number and you can add the ASCII terminal on your system.

    Documenting Hardware Configuration

    lsdev -CHProvides name, status, location, and description of devices

  • 5/21/2018 Aix Details

    31/46

    lscfg -vProvides details of all devices including manufacturer, type and model number andpart numbers

    lsattr -El sys0Provides attributes for the name device (for example, sys0)Run command for all devices

    getconf -aProvides the values of all system configuration variables

    AIX Basics- Prerequisite

    AIX short for Advanced Interactive eXecutive was first entered into the market by IBM in February 1990. AIX is an implementation of Unix derived from both AT&TUnix System V and 4.3 BSD. AIX offers the Korn (ksh) shell, Bourne (sh) and C (csh) shells however defaults to the Korn shell. AIX primarily designed for medium

    to large scale servers and mainframes. However, it can also be used in workstations. It supports standard peripherals like Supports standard peripherals: PCI Slots, SCSI, PS/2 keyboard and mouse, Ethernet.

    Levels Of AIXThe AIX system is functionally organized at three levels:- The kernel, which schedules tasks and manages storage;- The shell, which connects and interprets users' commands, calls programs frommemory, and executes them; and- The tools and applications that offer additional functionality to the operating system.

    The Kernel

    The heart of the operating system, the kernel controls the hardware and turns part of the system on and off at the programmers command. If you ask the computer to list (ls) all the files in a directory, the kernel tells the computer to readall the files in that directory from the disk and display them on your screen. The kernel itself does not interact directly with the user, but rather interactswith the shell and other programs as well as with the hardware devices on the system, including the processor (also called the central processing unit or CPU),memory and disk drives. The kernel is the first part of the operating system toload into memory during booting (i.e., system startup), and it remains there forthe entire duration of the computer session because its services are required continuously. Thus it is important for it to be as small as possible while stillproviding all the essential services needed by the other parts of the operating

    system and by the various application programs.When a computer crashes, it actually means the kernel has crashed. If only a single program has crashed but the rest of the system remains in operation, then the kernel itself has not crashed. The kernel provides basic services for all other parts of the operating system, typically including memory management, processmanagement, file management and I/O (input/output) management (i.e., accessing the peripheral devices). These services are requested by other parts of the operating system or by application programs through a specified set of program interfaces referred to as system calls.

    Logical Volume Manager (LVM)LVM is a disk management mechanism that is significantly different from traditional UNIX partitioning schemes. The LVM maps data between logical and physical st

    orage, allowing data to be discontiguous, span multiple disks, flexible and dynamically expanded. One advantage is the ability to allocate additional space to afile system without the need to rebuild the disk. The LVM controls physical dis

  • 5/21/2018 Aix Details

    32/46

    k resources by providing a simplified logical view of the available storage space.

    Volume Group, Filesystems and Logical VolumesThe logical storage structure that is the most common is called the volume group(VG). In AIX, storage allocation is performed at the volume group level. Data cannot span volume groups. When the AIX operating system is first installed, a vo

    lume group called rootvg is created. The rootvg contains the base operating system files for AIX.Each individual disk drive is logically represented by a physical volume (PV). Each physical volume consists of a number of partitions called physical partitions (PP). The physical partitions are grouped into something called a logical volume that contains logical partitions. The logical volume, in turn, belongs to a volume group. Logical volumes contain the file systems (like the Journaling FileSystem or JFS).All of the logical volumes use JFS to store data. This file system uses databasejournaling techniques to maintain its structural consistency. This prevents damage to the file system when the system is halted abnormally. Other file systemsthat you might encounter on AIX may include JFS2, NFS (Network File System), and

    AFS (Andrew File System). The term file system is also used to describe the hierarchical structure (file tree) of files and directories.

    The ShellThe shell is a command interpreter that allows an end user to type in commands to communicate to the AIX system. By default, when a user logins, a shell processis started. The default AIX shell is /usr/bin/ksh, which is the Korn Shell, unless and until specified while creating a user. Other available shells are:- /bin/bsh the Bourne shell- /bin/csh the C-shell- /bin/sh the Standard shell

    Using the System

    Logging in and outAfter bootup, the RS/6000 displays a login prompt on what looks like a character-based terminal, where you can enter your username and password to get into thesystem. Logging in to the RS/6000 follows the typical UNIX login process: The getty process provides the login screen. If a user enters an id at this getty login prompt, getty starts the login process to validate the user. AIX's login program checks not only /etc/passwd, which contains user names, but also a shadow password file, /etc/security/passwd, which contains the encrypted passwords of eachof the users. login then starts a login shell as defined in /etc/passwd for theuser, which by default is the KornShell (ksh). ksh then reads the user's .profile.If you are in an X Window session, stopping it by choosing End Session on the Ro

    ot Menu will usually log you out. However, if your system displays an ASCII screen with a command line prompt (usually a "$" prompt) after you stop X, then youhave to take the additional step of closing the shell by typing either the exitcommand or the logout commands.

    The date, cal, who and finger commandsThe datecommand displays or set the date or time for a particular system. If thecommand is run without any flag, it displays the current date and time to standard output.The calcommand displays a calendar of the specified year or month.The whocommand displays information about all users currently on the local system. The information displayed when running the command is login name, tty, date and time of login. Typing who am i or who am I displays your login name, tty, date

    and time you logged in. If the user is logged in from a remote machine, then the host name of that machine is displayed as well.The fingercommand displays information about the users currently logged in to a h

  • 5/21/2018 Aix Details

    33/46

    ost.

    Sending and receiving mailYou can use the mailprogram to create, send, reply, and forward messages to otherusers or to send ASCII files to other users. An ASCII file may, for example, bea document you have written using a preferred editor or a source file for a program. The mail program provides a line-oriented editor for creating messages. Th

    is editor enables you to enter each line of the message, press the Enter key toget a new line, and enter more text. When you create mail with the mail editor,the date: and from: fields are automatically completed by the system. You have the option to complete the subject: and cc: fields. These fields are similar to the body of a standard business letter. Other editors can only be used by using the editor subcommands. You can send messages and files to a user on your local system, on your network, or to a user on another connected network. The recipientdoes not need to be logged onto the system when you send the information. Mailis sent to a user's address. The address, containing the login name and system name, directs the delivery of the mail message.

    The write and wall commands

    The writecommand opens a line of communication to send messages to other users onthe system in real time.The wallcommand writes a message to all users that are logged in.

    Talk with another userThe talkcommand is used to converse with another user. It allows two users on thesame host or on different hosts to have an interactive conversation.

    The clear, echo and banner commandsThe clearcommand clears the terminal screen.The echocommand writes character strings to standard output.The bannercommand writes ASCII character strings in large letters to standard output.

    The wc commandThe wccommand counts the number of lines, words, bytes, or characters in a file.

    Files and directoriesWhat is a File?A file is a collection of letters, numbers and special characters: it may be a program, a database, a dissertation, a reading list, a simple letter etc. Sometimes you may import a file from elsewhere, for example from another computer. If you want to enter your own text or data, you will start by creating a file.InodesIn AIX, each file system contains a superblock, inodes, and data blocks. Each fi

    le has an inode containing information such as file size and time of last modification. The inodes of small files also contain the addresses of all disk blocksthat comprise the file data. A large file can use too many data blocks for an inode to directly address. In such a case, the inode points instead to one or morelevels of indirect blocks that are deep enough to hold all of the data block addresses.File system structureA file system is a hierarchical structure (file tree) of files and directories.This type of structure resembles an inverted tree with the roots at the top andthe branches at the bottom. This file tree uses directories to organize data andprograms into groups, allowing the management of many directories and files atone time. The basic type of file system is called the Journaled File System (JFS). This file system uses database journaling techniques to maintain its structur

    al consistency. This prevents damage to the file system when the system is halted abnormally.Where am I?

  • 5/21/2018 Aix Details

    34/46

    In order to know which directory you are currently located in, you can run the command pwdand it will display the full path where you are residing. The pwdis theacronym for Present Working Directory.Changing your current directoryThe command used to change a directory from the existing one is cd. It sets the current working directory of a process.Creating and removing directories

    The directories can be created using the command mkdirand can be removed using the command rmdir.Listing directoriesThe command ls -ldis used for listing the directories.Long listing of filesThe ls -lcommand will give the long listing of the files.The touch commandThe touchcommand updates the access and modification times of each file specifiedby the file parameter of each directory. If you specify a file that does not exist, the touch command creates the file.File PermissionsOverview

    The file permissions determine who can read and modify the information stored inyour files. They are your primary method for protecting the data that you storeon your system.Changing Permissions using the Symbolic notationTo specify a mode in symbolic form, you must specify three sets of flags. The first set of flags specifies who is granted or denied the specified permissions, as: ufor File Owner, gfor Group pertaining to the files group and ofor All OthersThe second set of flags specifies whether the permissions are to be removed, applied, or set: -Removes specified permissions, +Applies specified permissions, =Clrs the selected permission field and sets it to the permission specified.The third set of flags specifies the permissions that are to be removed, applied, or set: rfor Read Permission, wfor Write Permission, xfor Execute Permission.Changing Permissions using the Octal notation

    The chmod command also permits you to use octal notation for the mode. The numeric mode is the sum of one or more of the following values:4000: Sets user ID on execution, 2000: Sets group ID on execution, 1000: Sets the link permission to directories or sets the save-text attribute for files, 0400: Permits read by owner, 0200: Permits write by owner, 0100: Permits execute orsearch by owner, 0040: Permits read by group, 0020: Permits write by group, 0010: Permits execute or search by group, 0004: Permits read by others, 0002: Permits write by others and finally 0001: Permits execute or search by others.

    The vi EditiorStarting the vi EditorThe Visual Editor (vi) is a screen editor that comes with the AIX operating syst

    em. The vi program is used to create and edit text files. When you edit a file,vi makes a copy of the file to a memory buffer. This way, if any unwanted changes are made, the original file is not destroyed. When your work is completeed, you must remeber to save the buffer which contains your changes. The visual editorhas two modes of operation: text input mode and command mode. The vi editor canbe executed by issuing the command vi . When editing a file, vi places a tilde (~) as the first character of lines past the end of your file. These lines are not part of your file, and are for display purposes only.Adding textThe text can be added into a file by opening the file and pressing the ikey on the keyboard for inserting the text. You can use the xkey to delete an alphabet andddto remove a line. After adding the text, press the Esckey and save the file.Exiting the Editor

    You can exit the editor either by saving the text or without saving the text. After pressing the Esckey, you need to press :followed by wq!to save and exit or juq!to exit without save.

  • 5/21/2018 Aix Details

    35/46

    Cursor MovementThere are over forty commands that can be used to move the cursor throughout thefile. The basic keys used are up, down, rightand leftarrow keys on the keyboardve the cursor to the required place.Deleting textIn order to delete text, you need to take the cursor to the alphabet or word youwant to delete and hit the xkey till the text is deleted. If you would like to d

    elete the whole line, you can move to cursor to that line and press the key dtwice as dd. This will delete the whole line.Searching for text patternTo search a pattern in the vi screen, you open the file and click on the /key. The /is entered at the bottom of your screen, where you can add the word to searchand hit enter. You can hit the nkey to search for the same word elsewhere is thefile.Shell BasicsThe ShellThe shell is a command interpreter that allows an end user to type in commands to communicate to the AIX system. By default, when a user logins, a shell processis started. The default AIX shell is /usr/bin/ksh.

    Metacharacters and WildcardsWildcard characters provide a convenient way to specify multiple file names or directory names. The wildcard characters are asterisk (*) and question mark (?).Use the * to match any sequence or string of characters. The *means any characters, including no characters. For example, if you have the following files in yourdirectory:1test 2test afile1 afile2 bfile1 file file1 file10 file2 file3and you want to refer to only to the files that begin with file, you would use:file*The files selected would be: file file1 file10 file2 file3Use the ? to match any one character. The ? means any single character.To refer to only the files that starts with file and end with a single character, use:

    file?The files selected would be: file1 file2 file3The metacharacters are open and close square brackets ([ ]), hyphen (-), and exclamation mark (!). To refer to only the files that end in 1 or 2, use:*file[12]The files selected would be: afile1 afile2 file1 file2To refer only to the files that start with any number, use:[0123456789]* or [0-9]*The files selected would be: 1test 2testTo refer only to the files that don't begin with an a, use:[!a]*The files selected would be: 1test 2test bfile1 file file1 file10 file2 file3

    Character Substitution in file namesThe shell performs file name substitution by scanning each command word specified by the Word variable for certain characters. If a command word includes the *), ? or [ characters, and the -f flag has not been set, the shell regards the word as a pattern. The shell replaces the word with file names, sorted according tothe collating sequence in effect in the current locale, that match that pattern. If the shell does not find a file name to match the pattern, it does not change the word.Input and Output RedirectionThe AIX operating system allows you to manipulate the input and output (I/O) ofdata to and from your system by using specific I/O commands and symbols. You cancontrol input by specifying the location from which to gather data. For example, you can specify to read input while data is entered on the keyboard (standard

    input) or to read input from a file. You can control output by specifying whereto display or store data. You can specify to write output data to the screen (standard output) or to write it to a file. Because AIX is a multitasking operating

  • 5/21/2018 Aix Details

    36/46

    system, it is designed to handle processes in combination with each other. There are different ways this can be performed. Few of them are listed below.a. Standard input, standard output, and standard error filesb. Standard output redirectionc. Redirecting output to a filed. Redirecting output to append to a filee. Standard input redirection

    f. Discarding output with the /dev/null fileg. Standard error and other output redirectionCreating file with catType the command# cat > name_of_fileThen, type in the required text and press enter to start a new line. When finished typing, enter Ctrl-d. This stops the cat command and returns you to the system prompt.Pipes and FiltersYou can connect two or more commands so that the standard output of one commandis used as the standard input of another command. A set of commands connected this way is known as a pipeline. The connection that joins the commands is known a

    s a pipe. Pipes are useful because they let you tie many single-purpose commandsinto one powerful command. You can direct the output from one command to becomethe input for another command using a pipeline. The commands are connected by apipe (|) symbol.When a command takes its input from another command, modifies it, and sends itsresults to standard output, it is known as a filter. Filters can be used alone,but they are especially useful in pipelines. The most common filters are sort, more and pg.

    ProcessesWhat is a process?The process is the entity that the operating system uses to control the use of system resources. AIX introduces the use of threads to control processor-time con

    sumption, but most of the system management tools still require the administrator to refer to the process in which a thread is running, rather than to the thread itself.Some processes run from system boot to shutdown, but most processes come and gorapidly, as tasks start and complete. At times, a process can die a premature, say, due to a crash of a system or application or a particular task.Parent and Child ProcessesEach new process is the spawn of an existing process. Further, each new process,called a child" process, is a clone of its "parent" process, at least for an instant, until the child continues execution independently.Monitoring and Terminating ProcessesA process can be monitored using the command ps. It gives the output with the ID a

    ssociated to the process along with the time stamp and date when the process wasstarted.When a process terminates, by calling the exit subroutine either explicitly or implicitly, all threads within the process are terminated. Neither the cleanup handlers nor the thread-specific data destructors are called. The reason for thisbehavior is that there is no state to leave clean and no thread-specific storageto reclaim, because the whole process terminates, including all the threads, and all the process storage is reclaimed, including all thread-specific storage.DaemonsA daemon is defined to be a process that is intended to run in the backgroundwithout a controlling terminal. That is, the life span of thedaemon process does not depend on the life span of a terminal session, the daemon life span does not depend on any control key sequences ge

    nerated from a terminal session, and a daemon does not interact withusers through a terminal. A daemon can be started by the init process,the System Resource Controller, the inetd process, or a shell.

  • 5/21/2018 Aix Details

    37/46

    AIX UtilitiesSystem Management Interface ToolThe AIX System Management Interface Tool (SMIT) provides an alternative to the typical method of using complex command syntax, valid parameter values, and custom shell path names for managing and maintaining your operating system configuration. SMIT offers the following features:

    a. Two modes of operationb. An interactive, menu-driven user interfacec. User assistanced. System management activity logginge. Fast paths to system management tasksf. User-added SMIT screens

    The find commandThe find command recursively searches the directory tree for each specified Pathparameter, seeking files that match a Boolean expression written using the terms given in the following text. When the find command is recursively descending directory structures, it will not descend into directories that are symbolically

    linked into the current hierarchy. The output from the find command depends on the terms specified by the Expression parameter.The grep commandThe grep command search for the pattern specified by the Pattern parameter and then writes each matching line to standard output. The grep command uses a compact non-deterministic algorithm. The grep command displays the name of the file containing the matched line if you specify more than one name in the File parameter. Characters with special meaning to the shell ($, *, [, |, ^, (, ), \ ) must be in quotation marks when they appear in the Pattern parameter. When the Patternparameter is not a simple string, you usually must enclose the entire pattern in single quotation marks. In an expression such as [a-z], the - (minus sign) cmlspecifies a range, according to the current collating sequence. A collating sequence may define equivalence classes for use in character ranges.

    The sort commandThe sort command sorts lines in the files specified by the File parameter and writes the result to standard output. If the File parameter specifies more than one file, the sort

    command concatenates the files and sorts them as one file. A - (minus sign) in place of a file name specifies standard input. If you do not specify any file names, the command sorts standard input. An output file can be specified with the -o flag. If no flags are specified, the sort command sorts entire lines of the input file based upon the collation order of the current locale.

    The xargs commandThe xargs command constructs parameter lists and runs commands. The xargs command limits the command line length.

    The which and whereis commandsThe which command takes a list of program names and looks for the files that runwhen these names are given as