Archive for the 'administração de sistemas' Category

Published by carla on 09 Sep 2008

Aix - Como renomear um filesystem

Receita básica sobre como renomear um filesystem no Aix:

1 - Desmonte o filesystem
2 - Renomeie-o
3 - Monte o filesystem com novo nome

Para renomear utilize o comando chfs:

chfs -m [new filesystem name] [old filesystem name]

Referência:

Man page do comando chfs: http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds1/chfs.htm

Published by carla on 08 Sep 2008

Alguns comandos - Veritas Volume Manager

Segue uma lista com alguns comandos do Veritas Volume Manager, úteis no dia a dia de administração de sistemas com Veritas.

  • Localização (PATH) dos comandos Veritas:

/etc/vx/bin

  • Reconfigurar o Veritas:

# vxdctl enable

  • Listar discos, volumes e status:

# vxdisk list
DEVICE       TYPE      DISK         GROUP        STATUS
EMC1_0       sliced    disk01  diskgroup    online
EMC1_1       sliced    disk02  diskgroup    online
c1t0d0s2     sliced    rootdisk     rootdg       online
c1t1d0s2     sliced    rootmirror   rootdg       online
c1t2d0s2     sliced    -            -            online
c1t3d0s2     sliced    -            -            online

  • Criar um novo volume:

Ex: Criando um volume de 10 GB:

Se não especificar o diskgroup, por default, o volume será criado no rootdg

# vxassist make [volume name] 10240m

Especificando o diskgroup:

# vxassist -g [diskgroup] make [volume name] 10240m

  • Listar informações detalhadas de um volume group:

# vxprint -g [diskgroup] -ht

  • Criar filesystem no Solaris, caso não use o Veritas filesystem:

# newfs /dev/vx/rdsk/[diskgroup]/[volume name]

  • Renomear um volume:

# vxedit -g [diskgroup] rename [old name] [new name]

  • Remover um volume:

# vxassist -g [diskgroup] remove volume [volume name]

  • Aumentar um filesystem (vxfs ou ufs)

Ex: Aumentando em 1 GB

# df -k /filesystem
Filesystem                         Kbytes        used    avail capacity  Mounted on
/dev/vx/dsk/[diskgroup name]/[volume name]    10321884   10166012 52654   100%    /filesystem

# /etc/vx/bin/vxresize -F [filesystem type] -g [disk group] [volume name] +1g

Referências:

  1. 875-3053-10 - VERITAS Volume Manager, Command Line Interface, Administrator’s Guide: http://docs.filibeto.org/products-n-solutions/hardware/docs/pdf/875-3053-10.pdf
  2. Basic VxVM Commands: http://eval.veritas.com/downloads/van/vm_quickref.pdf
  3. vxresize man page: http://www.cuddletech.com/veritas/man/vxresize.m

Published by carla on 11 Aug 2008

AIX - Backup de um VG usando savevg

Caso deseje-se fazer o backup de um VG inteiro, pode-se utilizar o comando savevg no AIX.

Será criada uma imagem do VG, que pode ser restaurada caso necessário.

Antes de fazer o backup via savevg, defina os limites para unlimited, de modo a garantir que o backup seja criado mesmo que o tamanho exceda 2 GB:

ulimit -f unlimited (limite de tamanho de arquivo)
ulimit -d unlimited (limite de tamanho da área de dados)

Execute o comando savevg. Abaixo segue um exemplo com algumas opções:

/usr/bin/savevg  -f/path/nomedoarquivo -i -m -e -X nomedovg

-f: nome do arquivo

-i: cria o arquivo de dados chamando o comando mkvgdata

-m: adiciona as informações de mapa do VG

-e: exclui arquivos definidos no /etc/exclude.nomedovg

-X: expande automaticamente o /tmp caso necessário.

Exemplo:

$ /usr/bin/savevg  -f/mnt/foo-20080811.foovg -i -m -e -X foovg

Creating information file for volume group midwarevg..

Creating list of files to back up.
Backing up 27958 files……………..
27958 of 27958 files (100%)
0512-038 savevg: Backup Completed Successfully.
$

$ ls -l /mnt/fooserver-20080811.foovg
-rw-r—–   1 nobody   nobody   1246566400 Jun 18 14:10 /mnt/foos-20080811.foovg
$

Referência:

Published by carla on 08 Aug 2008

Aix - Como desbloquear e zerar tentativas falhas de login de um usuário

No Aix podemos especificar quantas tentativas de login são permitidas para um usuário antes de travá-lo.

Caso um usuário trave sua conta, é preciso zerar o contador de logins além de destravá-lo para que ele possa logar novamente.

Para fazer isto, você pode usar o comando chsec conforme mostrado a seguir:

- Lista tentativas de login sem sucesso:

# lsuser -f [username] |grep unsuccessful_login_count
unsuccessful_login_count=8

- Listar se a conta está bloqueada:

# lsuser -f [username] |grep account_locked
account_locked=true

- Alterar para zero as tenativas falhas de login:

# chsec -f /etc/security/lastlog -s [username] -a unsuccessful_login_count=0

- Desbloquear o usuário:

# chsec -f /etc/security/lastlog -s [username] -a account_locked=false

- Lista novamente o número de tentativas mal sucessidas e se a conta está desbloqueada:

# lsuser -f [username] |grep unsuccessful_login_count
unsuccessful_login_count=0

# lsuser -f [username] |grep account_locked
account_locked=false

Agora o usuário estará apto a logar novamente. Caso ele não se recorde de sua senha então esta deverá ser trocada com o comando passwd.

Referência:

Comando lsuser: http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/lsuser.htm

Comando chsec: http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds1/chsec.htm

Published by carla on 24 Jul 2008

AWK - Exemplo de uso com if

No exemplo abaixo, usarei o awk para avaliar o valor de uma coluna de dados e caso tenha o valor que eu desejo, imprimirei na tela os campos de meu interesse.

No exemplo abaixo quero avaliar se a data de um arquivo é 2006 e então exibir na tela a data e o nome do arquivo:

Saida do comando “ls -l”

-rw-r—–   1 userfoo   groupfoo  68578 Dec 29 2006  file_foo1.txt
-rw-r—–   1 userfoo   groupfoo  84609 Dec 29 2006  file_foo2.txt
-rw-r—–   1 userfoo   groupfoo  44587 Dec 29 2006  file_foo3.txt

Usando o awk:

# ls -l | awk  ‘{if ($8 == “2006″) print $8 “  ” $9}’

2006  file_foo1.txt
2006  file_foo2.txt
2006  file_foo3.txt

Mais informações sobre o uso do awk: http://www.grymoire.com/Unix/Awk.html

Published by carla on 03 Jul 2008

Listando o espaço livre de um VG (Volume Manager Aix e Veritas)

Para verificar espaço em disco livre num volume group, execute os seguintes comandos, para Veritas e Aix respectivamente:

    Veritas:

    # vxdg -g bootdg free
    DISK DEVICE TAG OFFSET LENGTH FLAGS
    rootdg01 c0t0d0s2 c0t0d0 18837360 51408000 -

    Aix:

    # lsvg rootvg
    VOLUME GROUP: rootvg VG IDENTIFIER: 00011824bd4eef54
    VG STATE: active PP SIZE: 16 megabyte(s)
    VG PERMISSION: read/write TOTAL PPs: 1084 (17344 megabytes)
    MAX LVs: 256 FREE PPs: 376 (6016 megabytes)
    LVs: 20 USED PPs: 708 (11328 megabytes)
    OPEN LVs: 17 QUORUM: 2
    TOTAL PVs: 2 VG DESCRIPTORS: 3
    STALE PVs: 0 STALE PPs: 0
    ACTIVE PVs: 2 AUTO ON: yes
    MAX PPs per PV: 1016 MAX PVs: 32

    Destacado em negrito no output de cada comando, a indicação do espaço livre.

    Referência:

    Published by carla on 27 Jun 2008

    Korn Shell Script

    Post apenas para indicar um documento que achei muito bom e um site sobre Korn Shell Script que gostei também.

    O documento:

    “Korn Shell Syntax - A Reference Guide”

    http://www.context-switch.com/docs/kshrefltr.pdf

    Ele ébásico, mas tem as condições de teste, e acaba sendo uma boa referência para consulta.

    O site:

    http://www.mtxia.com/css/Downloads/Scripts/Korn/index.shtml

    Published by carla on 10 Jun 2008

    Aix - Parâmetros de kernel

    Alguns parâmetros de kernel do Aix:

    Parameters:

    mempools

    Specifies the number of memory pools that the system real memory is split into.

    Memory pools

    The mempools value is used to subdivide the memory into pools. The parameter

    mempools has a range from 1 (one) to, but not more than, the value of the

    number of CPUs in the system. For example, if there are four CPUs in a system,

    then the maximum value of mempools is 4 (four). Setting the value to 0 (zero),

    restores the default number. In some circumstances, such as when most, but not

    all, of the system memory is in use, better performance can be obtained by

    setting this value to 1 (one).

    Reference:

    Aix 5L Performance Tools Handbook (SG24-6039-01)- Page 232

    npskill

    Specifies the number of free paging-space pages at which the operating system begins killing processes. If the npskill threshold is reached, a SIGKILL signal is sent to the youngest process. Processes that are handling SIGDANGER or processes that are using the early page-space allocation (paging space is allocated as soon as memory is requested) are exempt from being killed. The formula to determine the default value of npskill is as follows:

    npskill = maximum (64, number_of_paging_space_pages/128)

    The npskill value must be greater than zero and less than the total number of paging space pages on the system. It can be changed with the command vmo -o npskill=value.

    Purpose:

    Specifies the number of free paging-space pages at which the operating system begins killing processes.

    Values:

    • Default: MAX (64, number of paging space pages/128).
    • Range: 0 to total number of paging space pages on the system .
    • Type: Dynamic

    Diagnosis:

    N/A

    Tuning

    Increase the value if you experience processes being killed because of low paging space.

    Refer To:

    Values for the npswarn and npskill parameters

    npsrpgmax

    Purpose:

    Specifies the number of free paging space blocks at which the Operating System stops freeing disk blocks on pagein of Deferred Page Space Allocation Policy pages.

    Values:

    • Default: MAX(1024, npswarn*2).
    • Range: 0 to total number of paging space blocks in the system.

    Diagnosis:

    N/A

    Tuning:

    N/A

    npsrpgmin

    Purpose:

    Specifies the number of free paging space blocks at which the Operating System starts freeing disk blocks on pagein of Deferred Page Space Allocation Policy pages.

    Values:

    • Default: MAX(768, npswarn+(npswarn/2)).
    • Range: 0 to total number of paging space blocks in the system.

    Diagnosis:

    N/A

    Tuning:

    N/A

    npsscrubmax

    Purpose:

    Specifies the number of free paging space blocks at which the Operating System stops Scrubbing in memory pages to free disk blocks from Deferred Page Space Allocation Policy pages.

    Values:

    • Default: MAX(1024, npsrpgmax).
    • Range: 0 to total number of paging space blocks in the system.

    Diagnosis:

    N/A

    Tuning:

    N/A

    npsscrubmin

    Purpose:

    Specifies the number of free paging space blocks at which the Operating System starts Scrubbing in memory pages to free disk blocks from Deferred Page Space Allocation Policy pages.

    Values:

    • Default: MAX(768, npsrpgmin).
    • Range: 0 to total number of paging space blocks in the system.

    Diagnosis:

    N/A

    Tuning:

    N/A

    npswarn

    Specifies the number of free paging-space pages at which the operating system begins sending the SIGDANGER signal to processes. If the npswarn threshold is reached and a process is handling this signal, the process can choose to ignore it or do some other action such as exit or release memory using the disclaim() subroutine.

    The value of npswarn must be greater than zero and less than the total number of paging-space pages on the system. It can be changed with the command vmo -o npswarn=value.

    Purpose:

    Specifies the number of free paging-space pages at which the operating system begins sending the SIGDANGER signal to processes.

    Values:

    • Default: MAX (512, 4*npskill)
    • Range: 0 to total number of paging space pages on the system.
    • Type: Dynamic

    Diagnosis:

    N/A

    Tuning:

    Increase the value if you experience processes being killed because of low paging space.

    Refer To:

    Values for the npswarn and npskill parameters

    numpsblks

    11-28-02, 01:40

    prog_log :- It is used to find out if the dump was due to a hardware
    problem.

    vmker :- For finnding out free paging space. Nowadays this command is not
    used as with time
    the offset of free_paging_space/total_paging_space has changed.
    The command od
    vmker 16 used to be used to look at total paging space and free paging
    space but
    the field values have changed. It is easier to use the vmm
    command to look at the vmker
    data. The numpsblks field is the number of total paging space
    blocks.
    The psfreeblks is the free paging space blocks.

    Fonte: http://www.dbforums.com/archive/index.php/t-579015.html

    Parameter Description

    http://download-uk.oracle.com/docs/html/A97297_01/appa_aix.htm

    MINFREE The minimum free-list size. If the free-list space in the buffer falls below this size, the system uses page stealing to replenish the free list.

    MAXFREE The maximum free-list size. If the free-list space in the buffer exceeds this size, the system stops using page stealing to replenish the free list.

    MINPERM The minimum number of permanent buffer pages for file I/O.

    MAXPERM The maximum number of permanent buffer pages for file I/O.

    pinnable_frames:

    Memory environment variables Description
    DR_MEM_SIZE_REQUEST=N Size of memory requested in megabytes. N is a decimal value.
    DR_MEM_SIZE_COMPLETED=N Number of megabytes that were successfully added or removed. N is a decimal value.
    DR_FREE_FRAMES=N Number of free frames currently in the system. Each frame is a 4 KB page. N is a 32-bit hexadecimal value.
    DR_PINNABLE_FRAMES=N Total number of pinnable frames currently in the system. Each frame is a 4 KB page. N is a 32-bit hexadecimal value.
    DR_TOTAL_FRAMES=N Total number of frames in the system. Each frame is a 4 KB page. N is a 32-bit hexadecimal value.

    Fonte: Redbook: SG24-7039-02 - Partitioning Implementations for IBMEserver p5 Servers, Pag 166.

    Maxperm: maxperm influences paging behavior. Paging frees memory by copying the “least recently used” memory to disk for temporary storage. Tune maxperm to keep as much of the database in memory as possible when the system pages. The default setting is usually not optimum if the system pages as it favors paging out the database first.

    The initial maxperm setting depends on whether the database filesystem resides on JFS or JFS2. For JFS, I automatically change the default “maxperm/maxclient” as above. For JFS2, I recommend using the defaults, and defer tuning to when the system is running a representative workload. The reason is that AIX classifies JFS and JFS2 memory differently. JFS is controlled by “maxperm”, which is a “soft” limit and more forgiving if set too low. JFS2, on the other hand, is controlled by “maxclient”, which is a “hard” limit. If set incorrectly, performance can be degraded. See “maxclient” section for JFS2.

    When the system is under load, you can optimize the “maxperm” setting as follows. But first a little background. AIX classifies memory either as persistent or working storage. Persistent storage includes file cache, executables, and metadata. Working storage includes the database. Target amount of memory for persistent storage when the system is paging is the “maxperm” setting. (Note if the system is not paging, the maxperm setting is mostly ignored.) The default “maxperm” value of 80% favors paging out the database first, which degrades performance. In addition, the actual persistent memory requirements are typically much lower (20-50%).

    The tuning methodology involves finding the actual persistent memory used when the system is under load (numperm). Then set “maxperm” to 5% below that value.

    maxperm = numperm% - 5%.

    (Note: be sure to set maxclient=maxperm. See “maxclient” below for more info.)

    There are multiple commands for displaying memory usage. Here are two that I use.

    AIX 5.1: “/usr/samples/kernel/vmtune | grep numperm”

    AIX 5.2: “vmstat -v | grep numperm”

    If you don’t have root access to run vmtune, you can use a different approach. Use vmstat “avm” column to estimate the size of the working storage. Calculate numperm% as follows

    numperm% = 100% - “working storage%” = 100% - (avm *100 / total memory)

    Note “avm” is in measured in 4k pages, so you’ll have to convert this number to the same units as total memory.

    maxclient: A subgrouping of persistent memory. As such, “maxclient” is always less than or equal to “maxperm” (I set “maxclient=maxperm”).

    The “maxclient” value sets the maximum amount of memory used by its members: JFS2, NFS, CDROM and Veritas file systems. The “maxclient” value is a “hard” limit, which is always enforced.

    The importance is that JFS2 has a “hard” limit, while JFS does not. It’s better to leave the JFS2 as default until the system can be tuned while running a representative load. Setting “maxclient” too low can degrade JFS2 performance.

    Tune the”maxclient” with the system under load. Use the “maxperm” tuning procedure for setting “maxclient”, and set “maxclient” equal to “maxperm”. If you want to be more precise, you can use the “svmon -G” command to view the amount of memory used by client storage. It’s shown under the “clnt” column (”in use”).

    # svmon -G

    size inuse free pin virtual

    memory 131072 129422 1650 11704 50091

    pg space 131072 4279

    work pers clnt lpage

    pin 11704 0 0 0

    in use 47052 76146 6224 0

    The svmon command also shows the working storage under the “work” column. It all comes together as follows:

    Total memory = free+”working”+”persistent”

    = free+work+(pers+clnt)

    = 1650+47052+(76146+6224) = 1331072

    Reference: http://users.ca.astound.net/baspence/AIXtip/AIX5_Initial_Tuning.htm

    Published by carla on 17 Apr 2008

    Aix - Usuários default de sistema

    As informações a seguir foram escritas num Forum do “LinusQuestions.org” pelo usuário “Harry Seldon“.

    Achei um resumo útil e decidi salvar aqui no “meu” bloco de notas.

    Fonte: http://www.linuxquestions.org/questions/aix-43/aix-default-user-list-612651/

    “I work at a company that gets audited all the time. The ones we’re most commonly asked to remove are guest, lpd, uucp, nuucp (if it’s there) and imnadmin. Here’s a list of accounts I put together about a year ago; most of it is relevant, I think:

    daemon - The daemon user account exists only to own and run system server processes and their associated files. This account guarantees that such processes run with the appropriate file access permissions.

    bin - The bin user account typically owns the executable files for most user commands. This account’s primary purpose is to help distribute the ownership of important system directories and files so that everything is not owned solely by the root and sys user accounts.

    sys - The sys user owns the default mounting point for the Distributed File Service (DFS) cache, which must exist before you can install or configure DFS on a client.

    adm - The adm user account owns the following basic system functions:
    * Diagnostics, the tools for which are stored in the /usr/sbin/perf/diag_tool directory.
    * Accounting, the tools for which are stored in the following directories:
    o /usr/sbin/acct
    o /usr/lib/acct
    o /var/adm
    o /var/adm/acct/fiscal
    o /var/adm/acct/nite
    o /var/adm/acct/sum

    uucp - Owner of hidden files used by uucp protocol. The uucp user account is used for the UNIX-to-UNIX Copy Program, which is a group of commands, programs, and files, present on most AIX systems, that allows the user to communicate with another AIX system over a dedicated line or a telephone line.

    guest - Allows access to users who do not have access to accounts.

    nobody - The nobody user account is used by the Network File System (NFS) to enable remote printing. This account exists so that a program can permit temporary root access to root users

    lpd - Owner of files used by printing subsystem. This account has been disabled.

    imnadm - IMN search engine used for Documentation Library Search.

    lp - Possibly something to do with printing.

    invscout - Surveys the host system for currently installed microcode or Vital Product Data (VPD).

    snapp - The account that manages Snapp, an extensible, XML-based application that provides a menu-driven interface for UNIX system administration tasks on a handheld PDA.

    sshd - The user account for managing the sshd service.”

    Published by carla on 04 Mar 2008

    Solaris - Como checar pacotes pacialmente instalados

    Para checar se há pacotes parcialmente instalados, você deve executar o comando pkginfo com a opção “-p”.

    O sistema irá mostrar os pacotes parcialmente instalados. Caso a saída do comando não retorne nada é porque a instalação de todos os seus pacotes está ok.

    #pkginfo -p

    English version:

    Solaris - How to check partially installed packages

    To check if a Solaris package is partially installed, you should run the command pkginfo, with the option “-p”.

    The system will show only the packages that are partially installed. If there is no partially installed package, nothing will be showed.

    #pkginfo -p

    Next »