viernes, 28 de noviembre de 2008

multi-boot solaris x86

#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
# Solaris 32bits
title Solaris 10 10/08 s10x_u6wos_07b X86 32b
findroot (rootfs0,3,a)
kernel /boot/multiboot kernel/unix
module /platform/i86pc/boot_archive
#---------------------END BOOTADM--------------------
title Solaris 10 10/08 s10x_u6wos_07b X86 64b
findroot (rootfs0,3,a)
kernel /platform/i86pc/multiboot
module /platform/i86pc/boot_archive
#---------------------END BOOTADM--------------------
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris failsafe
findroot (rootfs0,3,a)
kernel /boot/multiboot kernel/unix -s
module /boot/x86.miniroot-safe
#---------------------END BOOTADM--------------------

title Ubuntu 8.10, kernel 2.6.27-7-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.27-7-generic root=/dev/sda1 ro quiet splash
initrd /boot/initrd.img-2.6.27-7-generic

Procedure to add a swap file

a) Login as the root user

b) Type following command to create 512MB swap file (1024 * 512MB = 524288 block size):
# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

c) Set up a Linux swap area:
# mkswap /swapfile1

d) Activate /swapfile1 swap space immediately:
# swapon /swapfile1

e) To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:
# vi /etc/fstab

Append following line:
/swapfile1 swap swap defaults 0 0

So next time Linux comes up after reboot, it enables the new swap file for you automatically.

g) How do I verify swap is activated or not?
Simply use free command:
$ free -m

profile solaris 10

PATH=$PATH:/usr/sbin:/opt/csw/bin:/usr/sfw/bin:/usr/ccs/bin:/usr/local/sbin:/usr/local/bin
LIBPATH=$LIBPATH:/opt/csw/lib:/usr/sfw/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBPATH
export PATH LD_LIBRARY_PATH LIBPATH

miércoles, 19 de noviembre de 2008

zone clone

# Bajar la zona que se desea clonar
zlogin CT1NSZSOPVA003 init 0

# Validar que la zona ya esta en shutdown
zoneadm list -cv

# Exportart la configuracion de la zona y salvarla con el nombre de la nueva zona que se desea crear
zonecfg -z CT1NSZSOPVA003 export -f /root/cfg/CT1LOGZSOPVA001.cfg

# Modificar parametros con el zonepath, Direcciones IP y demas que se requieran en la nueva zona.
vi /root/cfg/CT1LOGZSOPVA001.cfg

# Crear la nueva zona apartir de archivo de configuracion modificado.
zonecfg -z CT1LOGZSOPVA001 -f /root/cfg/CT1LOGZSOPVA001.cfg

# Clonar la zona
zoneadm -z CT1LOGZSOPVA001 clone CT1NSZSOPVA003

# Validar que la nueva zona esta en estado "Installed"
zoneadm list -cv

# Hacer boot de la nueva zona
zoneadm -z CT1LOGZSOPVA001 boot

# Validar que la nueva zona esta running
zoneadm list -cv

# Hacer la configuracion Inicial de la zona.
zlogin -C CT1LOGZSOPVA001

martes, 11 de noviembre de 2008

MP3 in Ubuntu

sudo apt-get install audacious

sábado, 8 de noviembre de 2008

File Descriptors

A file descriptor is a handle created by a process when a file is opened. There is a limit to the amount of file descriptors per process. The default Solaris file descriptor limit is 64.

If the file descriptor limit is exceeded for a process, you may see the following errors:

"Too Many Open Files"
"Err#24 EMFILE" (in truss output)

To display a process' current file descriptor limit, run /usr/proc/bin/pfiles pid | grep rlimit on Solaris systems.

Display system file descriptor settings:
ulimit -Hn (hard limit, cannot be exceeded)
ulimit -Sn / ulimit -n (soft limit may be increased to hard limit value)

Increasing file descriptor settings for child processes (example):
$ ulimit -Hn
1024
$ ulimit -Sn
64
$ ulimit -Sn 1024
$ ulimit -Sn
1024

Solaris kernel parameters:
rlim_fd_cur: soft limit

It may be dangerous to set this value higher than 256 due to limitations with the stdio library. If programs require more file descriptors, they should use setrlimit directly.

rlim_fd_max: hard limit

It may be dangerous to set this value higher than 1024 due to limitations with select. If programs require more file descriptors, they should use setrlimit directly.

To count number of open file descriptors:

#!/bin/bash
var=`ps -fea | grep named | grep -v pts | awk '{ print $2 }'`
for i in $var; do
npfiles=`/usr/proc/bin/pfiles -n $i | tail +3 | wc -l` ;
echo "Number of Open File Descriptors per named Process: PID=$i : Num OPFD=$npfiles";
done


http://www.princeton.edu/%7Eunix/Solaris/troubleshoot/filedesc.html



SOLUTION: Using FD_SETSIZE to allow application to use more than 1024 file descriptors

The application core dumped after attempting to access more file descriptors than allowed by the 32-bit library.

From the manpage for select(3C) :

"The default value for FD_SETSIZE (currently 1024) is larger than the default limit on the number of open files. To accommodate 32-bit applications that wish to use a larger number of open files with select(), it is possible to increase this size at compile time by providing a larger definition of FD_SETSIZE before the inclusion of.

The maximum supported size for FD_SETSIZE is 65536. The default value is already 65536 for 64-bit applications."

And from /usr/include/sys/select.h :

#ifndef FD_SETSIZE
#ifdef _LP64
#define FD_SETSIZE 65536
#else
#define FD_SETSIZE 1024
#endif /* _LP64 */
#elif FD_SETSIZE > 1024 && !defined(_LP64)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#pragma redefine_extname select select_large_fdset
#else /* __PRAGMA_REDEFINE_EXTNAME */
#define select select_large_fdset
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* FD_SETSIZE */

On Solaris[TM] 7, 8, 9, and 10 one can over come the 1024 32-bit library file descriptors limit by redefining the maximum allowed library limit and recompiling the source code with the following lines added.

        #define FD_SETSIZE 65535
#include

The FD_SETSIZE is the library file descriptor limit. After adjusting the library limit, it is necessary to adjust the system limit of file descriptors. This can be done by adding the following lines to the etc/system file and then rebooting.

        set rlim_fd_cur 1024
set rlim_fd_max 65535

To adjust the current soft limit of allowable system file descriptors above 1024 for an application without adjusting the system soft limit, one should use the "ulimit -n [limit]" or "limit descriptors [limit]" commands before starting applications that require more than 1024 file descriptors.

The value can not exceed the maximum in the table below.

default soft limit | default hard limit | max for stdio | max for select()

Solaris[TM] 2.4-2.6 64 1024 256 1024

Solaris[TM] 7 (32-bit) 64 1024 256 65535 (with recompile)

Solaris[TM] 7 (64-bit) 64 1024 256 65535

Solaris[TM] 8 (32-bit) 256 1024 256 65535 (with recompile)

Solaris[TM] 8 (64-bit) 256 1024 256 65535

Solaris[TM] 9 (32-bit) 256 65535 256 65535 (with recompile)

Solaris[TM] 9 (64-bit) 256 65535 256 65535

Solaris[TM] 10 (32-bit) 256 65535 256 65535 (with recompile)

Solaris[TM] 10 (64-bit) 256 65535 256 65535

Please note that for applications that use the Berkeley stdio.h interface (i.e. fopen/fclose/fread/fwrite, etc), the maximum number of open file descriptors per process is 256.

With the exception of databases and WebServers, most applications never need more than 256 open file descriptors. Also starting with Solaris[TM] 7, the plimit(1) command can be used to adjust the soft and hard limits of a running process.

plimit -n ,

The poll() system call has the number of file descriptors being polled passed in as an argument, so it has none of the above limitations.

File Descriptors

A file descriptor is a handle created by a process when a file is opened. There is a limit to the amount of file descriptors per process. The default Solaris file descriptor limit is 64.

If the file descriptor limit is exceeded for a process, you may see the following errors:

"Too Many Open Files"
"Err#24 EMFILE" (in truss output)

To display a process' current file descriptor limit, run /usr/proc/bin/pfiles pid | grep rlimit on Solaris systems.

Display system file descriptor settings:
ulimit -Hn (hard limit, cannot be exceeded)
ulimit -Sn / ulimit -n (soft limit may be increased to hard limit value)

Increasing file descriptor settings for child processes (example):
$ ulimit -Hn
1024
$ ulimit -Sn
64
$ ulimit -Sn 1024
$ ulimit -Sn
1024

Solaris kernel parameters:
rlim_fd_cur: soft limit

It may be dangerous to set this value higher than 256 due to limitations with the stdio library. If programs require more file descriptors, they should use setrlimit directly.

rlim_fd_max: hard limit

It may be dangerous to set this value higher than 1024 due to limitations with select. If programs require more file descriptors, they should use setrlimit directly.

http://www.princeton.edu/%7Eunix/Solaris/troubleshoot/filedesc.html