Tuesday, November 30, 2010

Salida de vmstat y su significado

vmstat - informa las estadísticas de memoria virtual del proceso, la memoria virtual en disco, la trampa (trap), y la actividad de la CPU.
El output del vmstat es el siguiente:

[root@bdvdesa2.banvenez.com]:/>vmstat 2 100
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr s1 sd sd sd in sy cs us sy id
0 0 0 47129112 9777528 151 240 920 5 5 0 0 4 0 3 1 11322 16613 9885 13 5 82
1 0 0 43698888 6434416 55 325 185 0 0 0 0 0 0 6 0 20071 21303 14620 31 7 62
1 0 0 43698888 6434832 41 297 16 0 0 0 0 0 0 1 1 20844 16560 13627 33 7 60
0 0 0 43698888 6434632 37 176 0 0 0 0 0 0 0 1 1 20117 20836 14337 34 7 59
1 0 0 43698952 6434664 87 482 0 0 0 0 0 0 0 2 0 20316 17144 12939 32 6 62
3 0 0 43698952 6434648 0 122 0 0 0 0 0 0 0 0 1 21292 46150 20754 42 13 45
2 0 0 43698952 6434632 101 426 0 0 0 0 0 0 0 0 1 20392 11789 11221 58 5 37
0 0 0 43694008 6431928 0 31 0 0 0 0 0 0 0 0 0 20592 21992 15038 28 7 65
0 0 0 43694008 6431912 0 0 0 0 0 0 0 0 0 6 1 20060 7605 11122 7 4 89
0 0 0 43693568 6431344 93 573 0 0 0 0 0 0 0 0 1 20842 16496 12914 8 6 86

Pero que significa cada columna?

procs
r: en la cola de ejecución
b: bloqueado por los recursos de E / S, la paginación, etc
w: intercambiado
memoria: (en Kbytes)
swap: la cantidad de espacio de intercambio disponibles en la actualidad
free: tamaño de la lista libre

page (en unidades por segundo).
re: Página de volver reclama - ver la opción -S de cómo este campo es modificado.
mf: faltas leves - ver la opción-S de cómo este campo es modificado.
pi: kilobytes paged in
po: kilobytes paged out
fr: kilobytes liberados
de: déficit previsto de la memoria a corto plazo (Kbytes)
sr: páginas escaneadas por el algoritmo del reloj

disk (de operaciones por segundo)
Hay ranuras para hasta cuatro discos, etiquetados con una sola letra y número.
La letra indica el tipo de disco (S = SCSI, i = IPI, etc.)
El número es el número de unidad lógica.

faults
in:(non clock) dispositivo de interrupciones
sy: sistema de llamadas
cs: CPU context switches

CPU - desglose del uso de porcentaje de tiempo de CPU.
En multiprocesadores se trata de un un media de todos los procesadores.
us: timpo de usuario
sy: hora del sistema
id: tiempo de inactividad

Monday, November 29, 2010

Standard Solaris Error Codes

Buscando un error en el crontab, encontré la lista de errores estándar de solaris, no es lo que estaba buscando pero un buen tip.

/*
* Error codes
*/

#define EPERM 1 /* Not super-user */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No children */
#define EAGAIN 11 /* Resource temporarily unavailable */
#define ENOMEM 12 /* Not enough core */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Mount device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Inappropriate ioctl for device */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#define EDOM 33 /* Math arg out of domain of func */
#define ERANGE 34 /* Math result not representable */
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier removed */
#define ECHRNG 37 /* Channel number out of range */
#define EL2NSYNC 38 /* Level 2 not synchronized */
#define EL3HLT 39 /* Level 3 halted */
#define EL3RST 40 /* Level 3 reset */
#define ELNRNG 41 /* Link number out of range */
#define EUNATCH 42 /* Protocol driver not attached */
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
#define EDEADLK 45 /* Deadlock condition. */
#define ENOLCK 46 /* No record locks available. */
#define ECANCELED 47 /* Operation canceled */
#define ENOTSUP 48 /* Operation not supported */

/* Filesystem Quotas */
#define EDQUOT 49 /* Disc quota exceeded */

/* Convergent Error Returns */
#define EBADE 50 /* invalid exchange */
#define EBADR 51 /* invalid request descriptor */
#define EXFULL 52 /* exchange full */
#define ENOANO 53 /* no anode */
#define EBADRQC 54 /* invalid request code */
#define EBADSLT 55 /* invalid slot */
#define EDEADLOCK 56 /* file locking deadlock error */

#define EBFONT 57 /* bad font file fmt */

/* Interprocess Robust Locks */
#define EOWNERDEAD 58 /* process died with the lock */
#define ENOTRECOVERABLE 59 /* lock is not recoverable */

/* stream problems */
#define ENOSTR 60 /* Device not a stream */
#define ENODATA 61 /* no data (for no delay io) */
#define ETIME 62 /* timer expired */
#define ENOSR 63 /* out of streams resources */

#define ENONET 64 /* Machine is not on the network */
#define ENOPKG 65 /* Package not installed */
#define EREMOTE 66 /* The object is remote */
#define ENOLINK 67 /* the link has been severed */
#define EADV 68 /* advertise error */
#define ESRMNT 69 /* srmount error */

#define ECOMM 70 /* Communication error on send */
#define EPROTO 71 /* Protocol error */

/* Interprocess Robust Locks */
#define ELOCKUNMAPPED 72 /* locked lock was unmapped */

#define ENOTACTIVE 73 /* Facility is not active */
#define EMULTIHOP 74 /* multihop attempted */
#define EBADMSG 77 /* trying to read unreadable message */
#define ENAMETOOLONG 78 /* path name is too long */
#define EOVERFLOW 79 /* value too large to be stored in data type */
#define ENOTUNIQ 80 /* given log. name not unique */
#define EBADFD 81 /* f.d. invalid for this operation */
#define EREMCHG 82 /* Remote address changed */

/* shared library problems */
#define ELIBACC 83 /* Can't access a needed shared lib. */
#define ELIBBAD 84 /* Accessing a corrupted shared lib. */
#define ELIBSCN 85 /* .lib section in a.out corrupted. */
#define ELIBMAX 86 /* Attempting to link in too many libs. */
#define ELIBEXEC 87 /* Attempting to exec a shared library. */
#define EILSEQ 88 /* Illegal byte sequence. */
#define ENOSYS 89 /* Unsupported file system operation */
#define ELOOP 90 /* Symbolic link loop */
#define ERESTART 91 /* Restartable system call */
#define ESTRPIPE 92 /* if pipe/FIFO, don't sleep in stream head */
#define ENOTEMPTY 93 /* directory not empty */
#define EUSERS 94 /* Too many users (for UFS) */

/* BSD Networking Software */
/* argument errors */
#define ENOTSOCK 95 /* Socket operation on non-socket */
#define EDESTADDRREQ 96 /* Destination address required */
#define EMSGSIZE 97 /* Message too long */
#define EPROTOTYPE 98 /* Protocol wrong type for socket */
#define ENOPROTOOPT 99 /* Protocol not available */
#define EPROTONOSUPPORT 120 /* Protocol not supported */
#define ESOCKTNOSUPPORT 121 /* Socket type not supported */
#define EOPNOTSUPP 122 /* Operation not supported on socket */
#define EPFNOSUPPORT 123 /* Protocol family not supported */
#define EAFNOSUPPORT 124 /* Address family not supported by */
/* protocol family */
#define EADDRINUSE 125 /* Address already in use */
#define EADDRNOTAVAIL 126 /* Can't assign requested address */
/* operational errors */
#define ENETDOWN 127 /* Network is down */
#define ENETUNREACH 128 /* Network is unreachable */
#define ENETRESET 129 /* Network dropped connection because */
/* of reset */
#define ECONNABORTED 130 /* Software caused connection abort */
#define ECONNRESET 131 /* Connection reset by peer */
#define ENOBUFS 132 /* No buffer space available */
#define EISCONN 133 /* Socket is already connected */
#define ENOTCONN 134 /* Socket is not connected */
/* XENIX has 135 - 142 */
#define ESHUTDOWN 143 /* Can't send after socket shutdown */
#define ETOOMANYREFS 144 /* Too many references: can't splice */
#define ETIMEDOUT 145 /* Connection timed out */
#define ECONNREFUSED 146 /* Connection refused */
#define EHOSTDOWN 147 /* Host is down */
#define EHOSTUNREACH 148 /* No route to host */
#define EWOULDBLOCK EAGAIN
#define EALREADY 149 /* operation already in progress */
#define EINPROGRESS 150 /* operation now in progress */

/* SUN Network File System */
#define ESTALE 151 /* Stale NFS file handle */

Monday, November 22, 2010

Listar el contentido de un archivo tar o tar.gz

GNU / tar es un programa de archivado diseñado para almacenar y extraer archivos y su extensión es tar. Los archivos tar pueden ser sin comprimir o comprimidos. Si en algún momento necesitas listar el contenido de un tar lo puedes hacer con el siguiente comando.

Listar el contenido de un archivo tar
usa el siguiente comando
$ tar -tvf archivo.tar

Listar el contenido de un archivo tar.gz
usa el siguiente comando
$ tar -tvf archivo.tar.gz

Listar el contenido de un archivo tar.bz2
usa el siguiente comando
$ tar -tvf archivo.tar.bz2

Monday, October 25, 2010

Como Instalar una Zona Whole Root en Solaris 10

Una zona es un entorno virtual del sistema operativo creado en una única instancia del sistema operativo Solaris.
La creación de zonas en solaris viene por defecto como "sparse", la cual tiene los directorios /usr, /sbin, /lib y /platform en forma de solo lectura. Pero en ciertas ocaciones, necesitamos que la zona tenga esos directorios como propios y no compartidos desde la zona global.

1.- El primer paso es crear el ZFS filesystem para la zona.

[root@intalio]:/ > zfs create zfs1/bdvbmc

[root@intalio]:/ > zfs list

NAME            USED  AVAIL  REFER  MOUNTPOINT

zfs1           34.9G  99.0G  29.5K  /zfs1

zfs1/bdvbmc    80.5K  99.0G  80.5K  /zfs1/bdvbmc

zfs1/intaliod  14.1G  99.0G  14.1G  /zfs1/intaliod

zfs1/intaliop  10.2G  99.0G  10.2G  /zfs1/intaliop

zfs1/intalioq  9.48G  99.0G  9.48G  /zfs1/intalioq

zfs1/zones     1.13G  99.0G  1.13G  /export/zones

2.- Para poder instalar la zona es necesario darle la siguiente perisología al filesystem.

[root@intalio]:/ > chmod 700 /zfs1/bdvbmc

3.- Validando las zonas que tenemos actualmente.

[root@intalio]:/ > zoneadm list -vi

ID NAME             STATUS     PATH                           BRAND    IP

0 global           running    /                              native   shared

1 intaliod         running    /zfs1/intaliod                 native   shared

2 wz-template      running    /export/zones/wz-template      native   shared

3 intalioq         running    /zfs1/intalioq                 native   excl

4 intaliop         running    /zfs1/intaliop                 native   shared

4.- Procedemos a configurar la zona con el comando zonecfg.

[root@intalio]:/ > zonecfg -z bdvbmc

bdvbmc: No such zone configured

Use 'create' to begin configuring a new zone.

zonecfg:bdvbmc> create

zonecfg:bdvbmc> set zonepath=/zfs1/bdvbmc

zonecfg:bdvbmc> set autoboot=true

zonecfg:bdvbmc> add net

zonecfg:bdvbmc:net> set physical=aggr1

zonecfg:bdvbmc:net> set address=180.183.194.69

zonecfg:bdvbmc:net> end

zonecfg:bdvbmc> remove inherit-pkg-dir dir=/usr

zonecfg:bdvbmc> remove inherit-pkg-dir dir=/sbin

zonecfg:bdvbmc> remove inherit-pkg-dir dir=/lib

zonecfg:bdvbmc> remove inherit-pkg-dir dir=/platform

zonecfg:bdvbmc> info

zonename: bdvbmc

zonepath: /zfs1/bdvbmc

brand: native

autoboot: true

bootargs:

pool:

limitpriv:

scheduling-class:

ip-type: shared

net:

address: 180.183.194.69

physical: aggr1

defrouter not specified

zonecfg:bdvbmc> verify

zonecfg:bdvbmc> commit

zonecfg:bdvbmc> exit

la diferencia entre el "sparse zone" y el "whole root" son los siguientes parámetros.
zonecfg:bdvbmc> remove inherit-pkg-dir dir=/usr
zonecfg:bdvbmc> remove inherit-pkg-dir dir=/sbin
zonecfg:bdvbmc> remove inherit-pkg-dir dir=/lib
zonecfg:bdvbmc> remove inherit-pkg-dir dir=/platform

5.- Instalamos La zona.

[root@intalio]:/ > zoneadm -z bdvbmc install

Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <150903> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1283> packages on the zone.
Initialized <1283> packages on zone.
Zone  is initialized.
Installation of <4> packages was skipped.
The file  contains a log of the zone installation.

6.- Arrancamos la zona.


[root@intalio]:/ > zoneadm -z bdvbmc boot

7.- Entramos a la consola para terminar el proceso de instalación


[root@intalio]:/ > zlogin -C bdvbmc