Aix 2015

download Aix 2015

of 21

description

aix 2015

Transcript of Aix 2015

  • IX COMMAND GUIDE

    Gua de comandos tiles de AIX a la hora de trabajar sobre el sistema operativo. Contiene informacin sobre comandos para trabajar sobre dispositivos, respaldos, manejo de software instalado, rea de intercambio, monitoreo y otros.

    Dispositivos

    (Devices)

    AIX Boot (sYSTEM

    Boot)

    Administracin de

    Volume Group Manager

    Storage Management

    con Logical Volume

    Manager

    Mirroring

    Volume Group++

    File Systems

    Paging Space

    Backup y Restore

    Comunicaciones

    (TCP/IP)

    Software Management

    Monitor

    +

    Sabores de ls

    Compactar y

    comprimir. Y

    viceversa.

    Bsqueda de paquetes

    de AIX

    Bsqueda de paquetes

    de terceros (RPM)

    Copiar archivos con

    SCP command

    Archivos en un

    filesystem

    Dispositivos

    # smit (menus de administracin bajo CDE, smitty bajo consola y sera

    el usuado en esta pgina)

    # smit -c (smitty bajo consola)

    # lsdev -P -H (lista los devices predefinidos)

    # lsdev -C -s scsi -H (lista los scsi instalados)

    # lsdev -Pc tape (lista los tapes)

    # lsdev -C -H (lista los devices instalados)

    # lsattr -El hdisk0 (lista los atributos de un device instalado)

    # cfgmgr (adiciona nuevos dispositivos predef->instalados)

    # rmdev -dl (remover dispositivos instalados)

    # lsdev -C -H -F (lista los devices instalados incluido la ubicacion

    fisica)

    # lsdev -CH (lista los devices instalados incluido la ubicacion

  • fisica)

    # lscfg -v (lista informacion del vendedor del device)

    # set -o vi (doskey history esc+k esc+n)

    # odmshow (lista atributos)

    # odmget, odmdelete y odmadd (cambia atributos, igual al odmchange)

    # odmget -qname=hdisk0 CuDv (lista atrubutos del device insatalado)

    # odmget -q"name=hdisk0 and attribute=pvid" CuAt (muestra un atributo

    : physical volume indetifier)

    # lsvg -l rootvg (lista los volumenes logicos del volume group rootvg)

    # odmget -qname=rootvg CuDep (identifica los volumenes logicos que

    pertenecen a rootvg)

    # lsdev -Pc disk (lista los devices predefinidos sobre disk)

    # odmget -q"type=osdisk and subclass=scsi" PdDv (lista atributos

    disponibles de un disco subtipo scsi)

    # lsdev -Cs scsi -H (scsi configurados)

    # odmget -qparent=scsi0 CuDv (scsi configurados)

    # smtctl (SMT)

    # lsattr -El proc0 (Configuracin del procesador)

    volver al tope

    AIX Boot

    # bosboot (crea una imagen en CD de la imagen del boot en caso se

    malogre en HDD)

    # bosboot -ad /dev/hdisk0 (reconstruye el boot hacia el hdisk0)

    # shutdown -Fr (reinicia con la nueva imaen boot)

    # chsysstate -m SystemPName -r lpar -n nombLPAR -o shutdown --restart

    (reboot lpar va HMC)

    # bootlist -m normal hdisk0 hdisk1 (altera la lista de booteo)

    # bootlist -m normal -o (muestra la lista de booteo)

    # bootlist -m service -o (muestra la lista de booteo para el modo

    servicio)

    # diag (muestra un menu para seleccionar lista de boteo)

    # lsvg -p rootvg (identifca los discos fisicos que pertencen a rootvg

    ej;hdisk0 blv=hd5)

    # lspv -l hdisk0 (muestra el volumen fisico)

    # lslv -m hd5 (muestra el volumen logico de booteo hd5)

    # lsvg -l rootvg (muestra el volumen group del sistema. se identifica

    el type=boot)

    # lsvg rootvg (para conocer atributos del rootvg entre ellos el vgid

    32 digitos)

    # lspv (lista volumenes fisicos, muestra el identificadir 16 digitos)

    # odmget -q "name=hdisk0 and attribute=pvid" CuAt (muestra el

    identifcador del volumen fisico a 32 digitos)

    Boot grfico se realiza en el Web-based System Manager accesando al

    HMC.

    Se identifica el LPAR (Logical Partition)

    En el menu Operating System se encuentra Shutdown

    AIX Boot++

    AIX Boot process

    Contents of Boot Logical Volume (/dev/hd5)

    How to change the current Boot device order

    Viewing AIX Boot and console Logs

  • Contents of Boot Logical Volume

    * Kernal - Copy of /unix

    * LVM Commands

    * ODM Predefined Structure

    * ODM Customized Structure

    * rc.boot shell script

    Listing and changing the current boot order

    # bootlist -m normal -o # Lists the current bootlist

    # bootlist -m normal cd0 hdisk0 # To set cd0 and hdisk0 as first and

    second boot devices

    # bootlist -m service cd0 rmt0 # To change the bootlist for service

    mode

    Viewing AIX Boot and Console Logs

    Boot and console messages can be used to identify and fix problems.

    These messages are automatically stored on disk by AIX. To view the

    stored messages, use the alog command. Here are a couple examples of

    the alog command:

    alog -L # List the defined log types

    # alog -L

    boot

    bosinst

    nim

    console

    cfg

    dumpsymp

    # alog -o -t boot # View the boot log

    # alog -o -t console # View the console log

    To find out the properties of boot log file

    # alog -L -t boot

    file:size:verbosity

    /var/adm/ras/bootlog:131072:1

    To find out whether a Hard drive is bootable

    # ipl_varyon -i

    PVNAME BOOT DEVICE PVID VOLUME GROUP

    ID

    hdisk0 YES 00c898eb372ea9410000000000000000

    00c898eb00004c00

    hdisk1 YES 00c898eb38483a300000000000000000

    00c898eb00004c00

    hdisk2 NO 00c898bbdd86318c0000000000000000

    00c898bb00004c00

    volver al tope

    System Boot

    # restbase (rc.boot.1)

  • # cfgmgr -f (rc.boot.1)

    # ipl_varyon (rc.boot.2)

    # mergedev (rc.boot.2)

    # cfgmgr -p2 (rc.boot.3)

    # savebase (rc.boot.3)

    System Boot Software

    # lssrc -a | pg (lista subsistemas activos e inoperativos)

    # stopsrc -s syslogd (detiene el subsistema syslogd)

    # lssrc -s syslogd (lista el estado del subsistema syslogd)

    # startsrc -s syslogd (detiene el subsistema syslogd)

    # alog -o -t console | pg (ver el log de la consola)

    # alog -o -t boot | grep "starting disk boot process" (buscando los

    booteos del sistema)

    # lsitab -a | grep alog (lista el/etc/inittab y luego que entradas

    usaron alog)

    # lsvg -l rootvg (lista el tipo de file system sea JFS o JSF2)

    # logform -V jfs2 /dev/hd8 (reformatear el volumen logico del log)

    # fsck -y -V jff2 /dev/hd1 (verifica los discos)

    volver al tope

    Administracin de Volume Group Manager

    # lsvg rootvg (muestra el identificador del volume group)

    # lspv (muestra el identificador del volumen fisico)

    # lslv hd4 (muestra el identificador del logical volume)

    # uname -m (numero de la tarjeta madre)

    # lqueryvg -p hdisk1 -At (muestra un resumen del Volume Group

    Descriptor Area)

    # getlvcb -AT hd2 (muestra un resumen del Logical Volume Control

    Block)

    # odmget -q "name like hdisk?" CuDv (muestra datos de los volumenes

    fisicos)

    # odmget -q "name=hdisk0 and attribute=pvid" CuAt (muestra el atributo

    volumen fisico)

    # odmget -q "value3 like hdisk?" CuDvDr (muestra el atributo major

    numner y minor number)

    # ls -l *dev*hdisk* (lista datos de los discos, entre ellos el major y

    minor number)

    # odmget -q "name=rootvg" CuDv (muestra datos del volume group)

    # odmget -q "name=rootvg" CuAt (muestra datos del volume group)

    # odmget -q "name=hd2" CuDv (muestra datos de los volumenes logicos)

    # odmget -q "name=hd2" CuAt (muestra datos de los volumenes logicos)

    # odmget -q "value3=hd2" CuDvDr (muestra major y minor number de los

    volumenes logicos)

    # odmget -q "dependency=hd2" CuDep (relacion entre volumen logico y

    volume group)

    # varyoffvg homevg (cuando se malogra la ODM que no es rootvg, primero

    se inactiva)

    # exportvg homevg (remueve el volume group)

    # importvg -y homevg hdiskX (recrea la ODM, despues de los cambios de

    bajo nivel, actualiza la ODM y el /etc/filesystems)

    # rvgrecover (script que recostruye el rootvg)

    # redefinevg (verifica inconsistencias de la reconstruccion)

    # synclvodm (resincroniza incosistencias entre tablas de datos)

    # smitty vg (diversas operaciones sobre un volume group)

    # lsvg -o (muestra los volumen group online)

    # lsvg (muestra todos los volume group)

  • # lsvg rootvg (lista informacion del volume group)

    # lsvg -p rootvg (lista informacion de los volumenes fisicos de un

    volume group)

    # lsvg -l rootvg (lista informacion de los volumenes logicos)

    # smitty mkvg (agregar un volume group)

    # smitty vg (menu del volume group)

    # smitty vgsc (colocar caracteristicas de un volume group)

    # smitty chvg (cambiar un volume group)

    # extendvg myvg hdisk6 (amplia un volume group)

    # reducevg myvg hdisk5 (reduce un volume group)

    # varyonvg datavg (activa un volume group. online)

    # varyoffvg datavg (desactiva un volume group. offline)

    # chvg -g datavg (verificar los discos de un volume group en RAID)

    # chvg -b n datavg (apaga la relocacion de bloques defectuosos)

    # chvg -b y datavg (activa la relocacion de bloques defectuosos)

    # smitty lv (menu de volumenes logicos)

    # lslv -l lv00 (muestra las caracteristicas logicas de un volume

    group)

    # lslv -m lv00 (muestra las particiones logicas de un volume group)

    # smitty mklv (agregar un volumen logico)

    # smitty lvsc (definir caracteristicas de un volumen logico)

    # lsvg -o | lsvg -i -l (lista los volumenes logicos por volume group)

    # lslv lv02 (muestra caracteristicas del volumen logico)

    # smitty reorgvg (se realiza despues de cambiar politicas del volume

    group)

    # smitty pv (menu de volumenes fisicos)

    # lspv (lista los volumenes fisicos del sistema)

    # lspv hdisk0 (lista contenidos de un volumen fisico)

    # lspv -l hdisk0 (lista volumenes logicos en un volumen fisico)

    # lspv -p hdisk0 (lista el mapa de particiones de un volumen fisico)

    # migratepv -l lv02 hdisk0 hdisk6 (migra el volumen logico desl disco

    0 al 6)

    volver al tope

    Storage Management con Logical Volume Manager

    # smitty mlv (Crear volumenes logicos espejados

    # mklv -w y!a!p!n (configura la consistencia de escritura de

    espejamiento)

    # syncvg -f -l lv001 (Sincronizar volumen logico espejado despuesde

    una caida)

    # mklvcopy (agregar particiones espejadas a un volumen logico)

    # extendvg ()

    # chvg -Qn (quitar el querun para que funcione el sistema aun despues

    de una caida)

    # smitty jfs (crear journaled file system en un voleme group)

    # lsvg -l datavg (verificar que los LV existan en datavg)

    volver al tope

    Mirroring

    Espejar el rootvg

    # mirrorvg -s (1 se colocan en espejo)

    # syncvg -s (2 sincronizo discos)

    # bosboot -a (3 lo hago booteable)

    # bootlist -m normal hdisk1 hdisk0 (4 primero que busque en hd0 y

  • luego en hd1

    # shutdown -Fr (5 rebooteo para probar)

    # bootinfo -b (6 para saber de cual disco ha booteado)

    # mirrorvg (espejar rootvg con smit)

    # varyong datavg (marca las particiones malogradas)

    Non Quorum VG

    # chvg -Q datavg (quitar el quorum)

    # varyoffvg datavg (cambiar el status)

    # varyonvg datavg (refrescar el status de un disco malogrado)

    # varyonvg -f datavg (refrescar el status en forma forzada)

    Disco espejado se ha caido

    # unmirroring vgName hdiskX quitar las copias del disco

    # reduce vgName hdiskX (retiro el disco del VG)

    # rmdev -l hdiskX -d (remuevo el disco de la ODM)

    # shutdown (conecto un nuevo disco en el sistema)

    # extendvg vgName hdiskX (agrego el disco al volume group)

    # rmdev -l hdiskX -d (habilito las copias)

    Disco no espejado todavia funciona no es el rootvg

    # (conectar un disco a la maquina)

    # extendvg vgName hdiskY (agregar el nuevo disco)

    # migratepv hdiskX hdiskY (migra de un disco a otro)

    # reducevg vgName hdiskX (remuevo un disco)

    # rmdev -l hdiskX -d (remuevo de la ODM)

    Disco no espejado todavia funciona es el rootvg hd5 (boot logical

    volume)

    # (conectar un disco a la maquina)

    # extendvg vgName hdiskY (agregar el nuevo disco)

    # migratepv -l hd5 hdiskX hdiskY (migra de un disco a otro)

    # bosboot -ad /dev/hdiskY

    # chpv -c hdiskX (para que no bootee de hdiskX)

    # bootlist -m normal hdiskY

    # migratepv hdiskX hdiskY (migra de un disco a otro)

    # reducevg vgName hdiskX (remuevo un disco)

    # rmdev -l hdiskX -d (remuevo de la ODM)

    Espejando rootvg

    # lspv (verificar donde se encuentra rootvg)

    # lspv -l hdiskX (mostar los LV de un disco)

    # extebdvg rootvg hdisk2 (Espejar los LV del rootvg)

    # chvg -Qn rootvg (deshabilita el quorum)

    # mirrorvg -s rootvg (espeja)

    # lsg rootvg (muestra informacion del rootvg)

    # syncvg -v rootvg (sincroniza los espejos del rootvg)

    # lsvg rootvg (verificar que se han actualizado todas las particiones)

    # ipl_varyon -i ! grep -v ":" (revisar que discos son booteables)

    # bosboot -a (actualiza el LV del boot)

    # bootlist -m normal hdisk2 hdisk0 (define el orden de booteo)

    # shutdown -Ff (reboot del sistema)

    # bootinfo -b (revisar de donde ha booteado)

    # unmirrorvg rootvg hdisk2 (quitamos un espejo de rootvg)

    # chpv -c hdisk2 (verificar que no bootee de una imagen antigua)

    # lspv -l hdisk2 (verificar que el LV haya sido removido)

    # reducevg rootvg hdisk2 (reomver el hdisk2 del VG)

    # bosboot -ad /dev/hdisk0 (actaulzai el booteo)

  • # bootlist -m normla hdisk0

    # shurdown -Fr

    # bootinfo -b

    volver al tope

    Volume Group++

    Se ha perdido el volume group

    # lspv -l hdiskY (identifico los LV y filesistems de un disco fallado)

    # umount /dev/lv_name (desmonto el file system del disco fallado)

    # smitty rmfs # rmlv lv_name (remuevo los LV y file system del disco

    fallado)

    # reducevg vgName hdiskY (remuevo el disco del volume group)

    # rmdev -l hdiskY -d (remuevo el disco fallado)

    # extendvg vgName hdiskZ (agregar un nuveo disco al volume group)

    # mklv -y lv_name # smit crfs (Recrea los LV y file system del nuevo

    disco)

    # restore -rvqf /dev/rmt0 (restaurar los filesystem de un bakup)

    Se ha perdido un volume group que no es rootvg y se cuenta con un

    backup del VG

    # exportvg vgName (exportar el volume group del sistema)

    (verificar que los /etc/filesystems no referencien al VG exportado)

    # rmdev -l hdiskX -d (remover el disco fallado del ODM y del sistema)

    # restvg -f /dev/rmt0 hdiskY (si se cuenta con un backup disponible)

    Se ha perdido un volume group que no es rootvg y no cuenta con un

    backup del VG

    # exportvg vgName (exportar el volume group del sistema)

    (verificar que los /etc/filesystems no referencien al VG exportado)

    # rmdev -l hdiskX -d (remover el disco fallado del ODM y del sistema)

    # mkvg (Recrear un volume group)

    # mklv (Recrear los volumenes logicos)

    # crfs (Recrear los filesystem)

    # restore -rqvf /dev/rmt0 (restaurar la data de un backup)

    Se ha perdido el rootvg

    (reemplazar el disco fallado)

    (bootear en modo mantenimiento)

    # mksysb (restaurar de un backup)

    # importvg (importar los volume group)

    exportar un volume group

    # umount /dev/lv10 (desmonto los file system del VG)

    # umount /dev/lv11 (desmonto los file system del VG)

    # varyoffvg datavg

    # exportvg datavg (exportar el VG)

    # lsfs (analyzar que el /ect/filesystems no contenga los LV

    desmontados)

    # more /ect/filesystems lsfs (analyzar que el /ect/filesystems no

    contenga los LV desmontados)

    importar un volume group

    # importvg -y myvg hdisk3 (importar el VG)

  • # lsvg -o (verificar que el VG este en ON)

    # lsfs (Verificar el file system)

    # more /ect/filesystems (verificar el file system de los LV)

    # mount (Verificar el file system)

    # mount /dev/lv10 (montar los file system)

    # mount /dev/lv11 (montar los file system)

    # ls /home/lv10 (verificar que no se han perido archivos)

    # ls /home/lv11

    Indicar las caracteriticas de un volumen logico

    # lslv -m mirrorlv (obtener informacion de un LV)

    # rmlv mirrorlv (remover un LV espejado)

    # lspv -p hdisk0 (determinar una region libre en el disco)

    # smitty mklv (crear un volumen fisico no espejado)

    # lspv -p hdisk0 (verificar donde reside un volumen logico)

    # smitty chlv (cambiar la politica fisica del disco)

    # reorgvg rootvg lvtmp1 (reorganizar un LV)

    volver al tope

    Sistema de Archivos File Systems

    # getea fileABC (muestra atributos extendidos)

    # smitty fs (menu de file systems)

    # lsfs (listar fs)

    # mount (ver los montados en el sistema)

    # smitty manfs (manager para el fs)

    # chfs -a size ="-16M" /myfs (juntar un file system tipo JFS2)

    crear un ram disk

    # mkramdisk 4M (crear un disco en ram /dev/rramdisk0)

    # mkfs -V jfs /dev/ramdisk0 (crear un sistema JFS en RAM)

    # mkdir /ramdisk (crear un punto de montaje)

    # mount -V jfs -o nointegrity /dev/ramdisk0 /ramdisk (montar el ram)

    crear un sistema UDF en un DVDRAM

    # udfcreate -d /deve/cd0 (crea un sistema UDF)

    # udflabel -d /dev/cd0 -l testdvd (cambiar el label del UDF)

    # mkdir /dvddisk (crea un punto de montaje)

    # mount -V udfs -o rw /dev/cd0 /dvddisk (montar el sitema UDF)

    # udfcheck -d /dev/cd0 (verifica el file sistem)

    Mas sobre file systems

    # df (lista contendio libre)

    # skulker (borra file obsoletos, en /tmp, *.out, *.hup, archivos core)

    # defragfs filesystem (defragmenta un file system)

    # fsck filesystem (verifica un file system)

    # crfs -v jfs -d aclv -m /home/teamxx/dir1 -A yes -p rw (crear un file

    system JFS en el volumen logico aclv)

    # crfs -v jfs2 -g datavg -a size=1M -m /home/team/dir2 -A yes (crea un

    FS en un VG y automaticamente crea el LV despues de restart)

    # lsvg -o | lsvg -i -l (listar los LV por VG)

    # df -m (listar LV por VG y particones fisicas)

    # chfs -a size=+10 /home/team/dir1 (extiende el punto de montaje

    /home/team/dir en 10 bloques - de 512 bytes)

    # extendlv aclv 1 (extiende el tamao del LV aclv en una particion

    fisica)

    # chfs -a size=+1 /home/team/dir1 (exteinde e tamao del file system

    dentro del LV)

    # chfs -a size=1M /home7team/dir1 (reduce el tamao del FS a 1Mb)

    # unmount /home/team/dir1 (remueve el filesystem - que esta montado en

  • el volumen logico aclv)

    # rmlv -f aclv (remueve el volumen logico)

    # cat /etc/filesystems (revisa los filesystems)

    volver al tope

    Paging Space

    # lsps -a (monitoreo las areas de paginacion)

    # lsattr -El sys0 -a realmem (verificar toda la RAM)

    # cat /ect/swapspaces (mostrar la configuracion interna)

    # smitty mkps (administrar area de paginacion)

    # smitty chps (cambiar el tamao de un area de paginacion)

    # swapoff /dev/paging00 (inactivar)

    # rmps paging00 (remover paginacion inactiva)

    # mkps -s 1 -n -a datavg (agregar un area paging)

    # chps -s 1 paging00 (crecer el paging)

    # chps -d 1 paging00 (decrecer el paging)

    volver al tope

    Backup & Restore

    # smitty sysbackup (backup del rootvg)

    # smitty mksysb (backup del rootvg, se indica donde hacer backup)

    # smitty vgbackup (backup de otros VG que no es el rootvg)

    # smitty savevg (backup un VG a tape o archivo)

    # msysb (restaurar el rootvg)

    # smitty restvg (restaurar otro VG)

    # smitty mkcd (backup rootvg a un CD)

    # smitty savevgcd (backup de otro VG a CD)

    # smitty savevgdvd (backup de un VG a DVD)

    # backup -i -f /dev/mnt0 (backup de un filename)

    # backup -iqvf /dev/mnt0 < listfile.txt (backup de los archivos

    listados en listfile.txt)

    # find /home/user | backup -iqf /dev/rmnt0 (backup de un usuario)

    # find . | backup -iqf /dev/rmnt0 (backup de un directorio)

    # smitty backupfile (backup de un file o directorio)

    # smitty backupfilesys (backup por inodo)

    # restore -Tvf /dev/mnt0 (lista una cinta)

    # restore-xvf /dev/mnt0 /home/user/manual/cap1 (resaturar un archivo)

    # restore -Pa -vf /dev/mnt0 ./ect/passwd (restaura solo lo spermisos)

    # restore -Ta -vf /dev/mnt0 ./ect/passwd (listar solo los permisos)

    Backups & Restore ++

    Backup and Recovery

    Backup rootvg using mksysb

    Backup and restore volume groups using savevg and restvg

    restvg

    backup

    Restore files backed-up using mksysb/backup commands

    Backup rootvg using mksysb

    mksysb

    * Creates an installable image of the root volume group either in

  • a file or on to a bootable tape

    * Bootable tape is created in backup format

    * Can be restored individual files/directories using restore

    command

    mksysb

    -e /excludes files in /etc/exclude.rootvg

    -i to create image.data file

    -v verbose mode

    -X extend /tmp filesystem if necessory for storing boot image

    -i option calls mkszfile command which inturn creats /image.data file.

    The bootable mksysb volume contains four images

    1. Boot image

    2. bosinstall image (image.data, bosinst.data, tapeblksz, etc..)

    3. An empty table of contents

    4. System Backup Image in Back up format

    /bosinst.data file contains answer for questions during installation

    time such as Console name, Installation methode, locale seetings,

    etc.. If there is no /bostinst.data file present, then a sample file

    /usr/lpp/bosinst/bosinst.template is copied as /bosinst.data during

    backup process.

    /image.data file contains logical volume and filesystem information of

    root volume group which is used by BOS install for creating target

    rootvg. If you want to create a custom image.data file, create the

    file using mkszfile, modify the file as per your requirement and call

    the mksysb command without -i option.

    With these two files, it is possible to carry out an un-attended

    installation.

    Examples:

    To create system backup and create an /image.data file

    # mksysb -i /dev/rmt0

    To exclude files and directories stored in /etc/exclude.rootvg file

    # mksysb -i -e /dev/rmt0

    To store the mksysb image to a file called /stage/backp/mksysb.img

    # mksysb /stage/backp/mksysb.img

    Backup or restore VGs using savevg and restvg

    savevg command is used to backup volume groups other than rootvg

    restvg command is used to restore volume groups other than rootvg

    savevg

    -e excludes files/directories being backed in /etc/exclude.

    file

    -i creates /tmp/vgdata//.data file

    -f device or filename on which the image to be stored

    -v verbose mode

  • -X automatically expand /tmp filesystem if required

    -i option calls mkvgdata command which inturn creates

    /tmp/vgdata//.data file

    restvg

    Backing up a filesytem or files

    Restore files

    restore

    -q tells restore commnad that volume is ready

    -t, -T to list the list of files in the backup archive

    -v verbose

    -r restores all files in the filesystem archive

    -x to restore specifig files/directories

    -d to restore all files in a directory if the File parameter

    is a directory

    -s To seek and restore the multiple backup tapes

    To list the names of files in either a file-name or file-system

    archive

    # restore -Tq -f /dev/rmt0

    To list all the files in a mksysb tape backup

    # restore -Tvqs 4 -f /dev/rmt0.1

    To restore an entire file-system archive, enter:

    # restore -rvqdf /dev/rmt0

    To restore a specific file

    # restore -xvqf myhome.bkup system.data

    To restore a specific file "/etc/passwd" from mksysb image file

    "mksysb.host1"

    # restore -xvqdf mksysb.host1 ./etc/passwd

    Extracting data from mksysb tape

    a. Rewind the tape using the command:

    # tctl -f /dev/rmt0 rewind

    b. Move the tape forward to the third tape marker (beginning of

    fourth image):

    # tctl -f /dev/rmt0.1 fsf 3

    c. Restore data:

    # restore -xqvf /dev/rmt0.1 /tmp/my_file

    volver al tope

    Comunicaciones (TCP/IP)

    # lsdev -Cc tcpip (ver el componenete)

    # lsattr -EHl inet0 (ver atributos del componente)

  • # lsdev -Cc if (muestra dispositivos de la clase interfase)

    # lsattr -El en0 (atributos de una interfase, no de una tarjeta)

    # lsdev -Cc adapter (muestra adaptadores de red)

    # lsattr -El ent0 (atributos de la interfase)

    # smitty tcpip (configurar tcpip)}

    # arp -an | pg (relacion de una tarjeta mac address con IP)

    # smitty mkroute (ruteo estatico)

    # route

    # netstat -i (estado de las adaptadores de comunicacion)

    # lsfg (lista todos los adaptadores de red)

    volver al tope

    Software Management

    # lslpp -L all (lista lo instalado)

    # lslpp -Lc | cut -d : -f 2 (List just the filesets on a system)

    # lslpp -Lc | cut -d : -f 2 |sort -df |more

    # lslpp -Lc | wc -l (Cuntos filesets tengo instalados?)

    # installp -s (List all filesets that are applied, and can be

    committed or rejected)

    # lslpp -w /usr/bin/ksh (List the installed fileset that provides

    /usr/bin/ksh)

    # truss -topen -p 274676 (List all file opens for a running PID)

    # lslpp -l (To list all the installed software)

    # lslpp -l bos.net.nfs.client (To display the maintenance level and

    state of a fileset)

    # lslpp -Lc (Lists installed software using ':' as the delimeter)

    # lslpp -f bos.perf (To display the names of all the files of fileset

    bos.perf)

    # lslpp -ha (To list installation history of filesets)

    # lslpp -v (To the filesets that do not have the required

    prerequisites or are not completely installed)

    e.g:

    # lslpp -L openssl

    Fileset Level State Type Description

    (Uninstaller)

    --------------------------------------------------------------------

    --------

    openssl 0.9.8n-1 C R Secure Sockets

    Layer and

    cryptography

    libraries and

    tools (/bin/rpm)

    # lslpp -L devices.fcp.disk.ibm.mpio.rte

    Fileset Level State Type Description

    (Uninstaller)

    --------------------------------------------------------------------

    --------

    lslpp: 0504-132 Fileset devices.fcp.disk.ibm.mpio.rte not installed.

    State codes:

    A -- Applied.

    B -- Broken.

    C -- Committed.

    E -- EFIX Locked.

    O -- Obsolete. (partially migrated to newer version)

  • ? -- Inconsistent State...Run lppchk -v.

    Type codes:

    F -- Installp Fileset

    P -- Product

    C -- Component

    T -- Feature

    R -- RPM Package

    E -- Interim Fix

    APPLIED state

    * Provide opportunity to test the software

    * Enable to go back to the previous version in case of any problem

    * Enable to commit software at a later stage

    * Requires more disk

    * Prevents future re-installation of product

    COMMITED stage

    * Requires less disk space

    * Permits future upgrade

    * Prevents from easily going back to previous version

    Install filesets / software

    installp command is used to install the software. The options are

    -a Install filesets in APPLIIED state

    -c Commit filesets

    -r Reject filesets which are in APPLIED state

    -u Uninstall filesets

    -C Cleanup failed installtion

    -g To Install or Uninstall dependencies

    -x To expand file systems if there is not enough space

    -d Device or directory which contains

    the software

    -f User created file which has a list of

    software to be installed or deleted

    Emaples:

    To list all installable software in media /dev/cd0

    installp [-L|-l] -d /dev/cd0

    To cleanup all failed installtion

    installp -C

    To install bos.net software (apply and commit) package with all pre-

    requisites from directory /tmp/net

    installp -acgx -d /tmp/net bos.net

    To commit teh applied updates

    installp -cgx all

    To remove bos.net package

  • installp -ug bos.net

    instfix coomand is used to install a fix or set of fixes. It is also

    used to find out if a fix is installed on a system.

    To find out whether a Fix is installed or not

    # instfix -i -k

    To list all the fixes that are installed on your system

    # instfix -i -v

    To list filesets which are lesser than the specified maintenance level

    # instfix -ciqk 5100-04_AIX_ML | grep ":-:"

    To install all filesets associated with fix Ix38794 from the tape

    # instfix -k Ix38794 -d /dev/rmt0

    To Display the entire list of fixes present on the media

    # instfix -T -d /dev/cd0

    To confirm the AIX preventive maintenance level on your system

    # instfix -i | grep ML

    All filesets for 6.0.0.0_AIX_ML were found.

    All filesets for 6.1.0.0_AIX_ML were found.

    All filesets for 6.1.0.0_AIX_ML were found.

    All filesets for 6100-01_AIX_ML were found.

    All filesets for 6100-02_AIX_ML were found.

    To verify that all filesets have all required requisites and are

    completely installed

    #lppchk -v

    oslevel command is used to find out the version and maintenance level

    of AIX

    To see the current OS and Maintenance level

    # oslevel

    # oslevel -r - To see the current maintenance level

    # oslevel -s - To see the current service pack level

    # oslevel -l 4.1.2.0 - To determine the file sets that are below

    level 4.1.2.

    # oslevel -g - To determine the file sets that are later than the

    current maintenance level

    # oslevel -rq - To list all known recommended maintenance levels

    on the system

    Updating the software to the latest level

    01. Using smit

    # smit update_all

  • 02. To update all filesets in a system using command line

    a. Create the list of filesets installed

    # lslpp -Lc | awk -F: '{print $2}'| tail -n +2 > /tmp/lslpp

    b. Update the softwares using installp command

    # installp -agxYd /dev/cd0 -e /tmp/ -f /tmp/lslpp

    Another way of updating all the filesets

    # /usr/lib/instl/sm_inst installp_cmd -acgNXY -d

    -f '_update_all'

    For not committing and saving all replaced files

    # /usr/lib/instl/sm_inst installp_cmd -agX -d

    -f '_update_all'

    To list all the installed efixes on a system

    # emgr -l

    To install a efix IY93496.070302.epkg.Z in /mnt directory

    # emgr -e /mnt/IY93496.070302.epkg.Z

    inutoc

    The inutoc command creates the .toc file in Directory. If a .toc file

    already exists, it is recreated with new information. The inutoc

    command adds table of contents entries in the .toc file for every

    installation image in Directory.

    The installp command and the bffcreate command call this command

    automatically upon the creation or use of an installation image in a

    directory without a .toc file

    To create a .toc file for the /tmp/images directory, enter:

    # inutoc /tmp/images

    bffcreate

    The bffcreate command creates an installation image file in backup

    file format (bff) to support software installation operations. It

    creates an installation image file from an installation image file on

    the specified installation media

    To create an installation image file from the bos.net software package

    on the tape in the /dev/rmt0 tape drive and use /var/tmp as the

    working directory, type:

    # bffcreate -d /dev/rmt0.1 -w /var/tmp bos.net

    volver al tope

    Monitor

    TIPS: Standard Use

    nmon

  • vmstat

    iostat

    sar

    topas

    nmon

    svmon

    filemon

    mpstat

    rmss

    netpmon

    truss

    # topas -E (Monitor network throughput for all

    interfaces)

    # topas -P (Show top-like CPU usage by

    process)

    # iostat -F 2 (List I/O stats by file system)

    # svmon -G

    # svmon -P > svmonDEV.log

    # vmstat -v

    # ps -Alo vsz,pcpu,args

    # vmstat -w

    # iostat -d hdiskX 2 (controla el i/o del hdisk64 en un intervalo de

    2seg.)

    # truss -fae -o /tmp/trussDBPROC.out -p PID

    #man truss:

    Description

    The truss command executes a specified command, or attaches to

    listed process IDs, and produces a trace of the system calls, received

    signals, and machine faults a process incurs. Each line of the trace

    output reports either the Fault or Signal name, or the Syscall name

    with parameters and return values. The subroutines defined in system

    libraries are not necessarily the exact system calls made to the

    kernel. The truss command does not report these subroutines, but

    rather, the underlying system calls they make. When possible, system

    call parameters are displayed symbolically using definitions from

    relevant system header files. For path name pointer parameters, truss

    displays the string being pointed to. By default, undefined system

    calls are displayed with their name, all eight possible argments and

    the return value in exadecimal format.

    volver al

    tope

    Otros

    Put a "tail" on the error log

    # errpt -

    c

    List all errors that happened today

    # errpt -s `date +%m%d0000%y`

    #smitty TunIoo (configuracion de i/o de discos)

    volver al tope

  • Sabores

    del ls:

    lsdev lsuser lsattr lssrc lscfg

    Compactar y comprimir. Y viceversa.

    Compactar mltiples archivos o directorios es muy til a la hora de

    transferirlos a otro host o copiarlos.

    La herramienta tar(1) no comprime, sino que archiva mltiples ficheros

    y/o directorios en un solo streamde datos. Originalmente pensada para

    volcados a cinta (tar significa Tape ARchiver), la salida puede

    direccionarse a un archivo (parmetro -f) o, por entrada estndar, a

    otro proceso.

    El complemento ideal para un archivo compactado es la compresin. AIX

    provee la herramienta compress(1)para dicha tarea, pero en este

    ejemplo se utilizar gzip(1), de desarrollo ms reciente y mayor

    potencia.

    Compactar y comprimir:

    Compactar el directorio midirectorio y comprimirlo en el

    archivo midirectorio.tar.gz:

    $ tar cvf - midirectorio | gzip > midirectorio.tar.gz

    Compactar n archivos y comprimirlos:

    $ tar cvf - archivo1 archivo2 archivo3 | gzip > misarchivos.tar.gz

    Descomprimir y descompactar:

    Descomprimir el archivo midirectorio.tar.gz y descompactarlo en el

    directorio actual:

    $ gunzip -c midirectorio.tar.gz | tar xvf -

    El parmetro -v tanto para tar como para gzip o gunzip, ofrece mayor

    verba. No incide en la creacin de los archivos o ficheros.

    Comprimir un .tar:

    $ gzip -9vf classes.20120124.tar

    volver al tope

    Bsqueda de paquetes de AIX

  • Otro sabor de ls nos permite consultar el rbol de paquetes instalados

    en AIX:

    Bsqueda de la versin hacmp instalada:

    $ lslpp -L |grep hacmp

    rsct.basic.hacmp z.x.y.0 C F RSCT Basic Function (HACMP/ES

    rsct.compat.basic.hacmp z.x.y.0 C F RSCT Event Management Basic

    rsct.compat.clients.hacmp z.x.y.0 C F RSCT Event Management Client

    volver al tope

    Bsqueda de paquetes de terceros (RPM)

    La gestin de paquetes RPM (RPM Package Manager, antes Red Hat Package

    Manager) est disponible en AIX desde la versin 4. El software de la

    OpenSource Toolbox de IBM adems de paquetes de teceros compilados

    para AIX se distribuyen en este formato.

    Lista ordenada alfabeticamente de paquetes RPM instalados:

    $ rpm -qa |sort

    AIX-rpm-6.1.1.0-1

    cdrecord-1.9-7

    mkisofs-1.13-4

    rsync-2.6.2-1

    sudo-1.7.2p5-1

    volver al tope

    Copiar archivos con SCP command

    Es til tener a mano (o bien en la memoria) el uso del scp para copia de archivos

    entre servidores.

    SCP: "Secure Copy o SCP es un medio de transferencia segura de archivos entre un

    host local y otro remoto o entre dos hosts remotos."

    $ scp snap.pax.Z remoteUser@hostname:/dir/

    remoteUser@hostname's password:

    snap.pax.Z

    100%

    1003KB 1.0MB/s

    00:00

    $

    volver al tope

    lspath - rmpath - chpath - Tratando Caminos a los

  • discos de SAN

    lspath: Lista el estados de los caminos (path), estos pueden ser:

    Enabled - Missing - Failed -

    lspath Command

    Purpose

    Displays information about paths to an MultiPath I/O (MPIO)

    capable device.

    # lspath

    Enabled hdisk0 vscsi0

    Enabled hdisk1 vscsi0

    Enabled hdisk2 vscsi0

    Enabled hdisk0 vscsi1

    Enabled hdisk1 vscsi1

    Enabled hdisk2 vscsi1

    Enabled hdisk3 vscsi0

    rmpath Command

    Purpose

    Removes from the system a path to an MPIO capable device.

    # smitty mpio

    MPIO Path Management

    Remove Paths

    Remove a Path

    Remove a Path

    Type or select values in entry fields.

    Press Enter AFTER making all desired changes.

    [Entry Fields]

    * Path to Remove [F4] +

    KEEP definition in database yes +

    Path to

    Remove

  • Move cursor to desired item and press

    Enter.

    Enabled hdisk0 0 vscsi0

    830000000000

    Enabled hdisk0 1 vscsi1

    850000000000

    Enabled hdisk1 0 vscsi0

    810000000000

    Enabled hdisk1 1 vscsi1

    810000000000

    Enabled hdisk2 0 vscsi0

    820000000000

    Enabled hdisk2 1 vscsi1

    820000000000

    Enabled hdisk3 0 vscsi0

    840000000000

    F1=Help F2=Refresh F3=Cancel

    F1=Help F2

    F8=Image F10=Exit Enter=Do F4=List

    Esc+5=Reset F6 /=Find n=Find

    Next F8=Image

    F9=Shell F1

    chpath Command

    Purpose

    Changes the operational status of paths to an MultiPath I/O

    (MPIO) capable device, or changes an attribute associated with a path

    to an MPIO capable

    device.

    # chpath -l hdisk3 -p vscsi0 -s disable

    volver al tope

    Archivos en un filesystem

  • Desplegar archivos modificados o creados en las ltimas 24 horas, slo

    en el filesystem /. Se excluyen otros filesystems.

    Pueden excluirse diferentes fs para variar la bsqueda:

    $ find / -ctime -1 |grep -Ev

    "usr|home|tmp|var|admin|proc|opt|software|maniobra|fsaudit|dev"

    /

    /etc

    /etc/security/lastlog

    /etc/security/passwd

    /etc/security/failedlogin

    /etc/perf/daily

    /etc/perf/daily/persistent_local

    /etc/ntp.drift

    /.sh_history

    /mbox

    Buscar en un directorio /directorio/subdirectorio por nombre de

    archivo

    $ find /directorio/subdirectorio -name "*.txt"

    volver al tope