Posted on 2009/04/02 15:07
Filed Under Study/Programming

Migrating Solaris Applications to Linux

The consequence of the increasing popularity of Linux is that companies are enthusiastic in migrating their existing applications and development environments to Linux. An application following the standards will be easier to port than a non-conformant application. Since Linux and Solaris share the common API sets of the UNIX system, migrating from Solaris to Linux is a easier path than from an operating system with different API sets such as the Microsoft Windows platform.

This chapter provides an outline on the advantages of doing such a migration and the path that can be taken. In addition to providing the toolsets that can be used in the process of migration, some standard issues with the porting is also discussed.

Issues with Porting

Porting applications from a Solaris platform to Linux platform may be considered an easy task because of the application level protability provided GNU C libraries of the Linux platform. In most cases, the application can be ported by simply recompiling the program. But if the code has any system or hardware dependent constructs then some modification is needed for carrying out a complete porting. The complexity of such a porting effort is directly proportional to the amount of system and hardware dependent code. If the application uses only standard language constructs and does not take platform considerations, then such an application will be less complicated to port. If the application uses non-POSIX constructs or platform specific optimizations, then the porting will be harder. Typically, a Java application falls in the first category and a non-POSIX C program falls in the second category. Some of the issues with porting are explained in the following sections.

Byte Ordering

Byte orderin, or endianness, is the property of a data element that refers to how its bytes are stored or addressed in memory. This property is determined by the CPU architecture of the platform. There are two endianness, big endian and little endian.

Big Endian

In this type of byte ordering the most significant byte is stored at the lowest storage address, for example, the MSB is stored in the leftmost position. Sun SPARC, HP Precision, and the IBM PPC use this type of ordering.

Example 1. Big Endian Ordering

Data: 0x33445566
Storage:
Byte 0 Byte 1 Byte 2 Byte 3
33(MSB) 44 55 66

Little endian

In this type of byte ordering the least significant byte(LSB) is stored at the lowest storage address, for example, the MSB is stored in the rightmost position. Intel and DEC architectures use this ordering.

Example 2. Little Endian Ordering

Data: 0x33445566
Storage:
Byte 0 Byte 1 Byte 2 Byte 3
66 (LSB) 55 44 33

Byte Ordering and Union Data Structure

The byte ordering discussed in the previous sections will become an issue in porting if the code uses union data structure. Union is a data structure to manipulate different types of data in the same storage area. It is completely the compilers responsibility to manage the size and alignment of the data stored in that storage area. For example, consider the following union:

Example 3. Union Data Structure

     union char_int {
     	char a[4];
     	int i;
     }char_int;

Consider the following code that uses the above union:

Example 4. Union Data Structure Code

     //define an instance variable of the union
     union char_int cint;
     //define a variable to hold the computation result
     int result;
     //assign a value to the union using the integer variable
     cint.i = 0x10394500;
     //divide the constant 100 with MSB i.e. first byte.
     result = 100/a[0];

The previous example uses the knowledge of byte ordering to retrieve the most significant byte of the integer data. While this code will work properly with big-endian architecture, when it is ported to little-endian machine, the code will fail because of a divide by zero error. To have a portable code, either the byte ordering information should not be used inside the code or the byte information has to be defined as conditional compilation parameters.

Example 5. Code

     //Portability code added
     #ifdef BIGENDIAN
     const int MSBBYTE=0;
     #else
     const int MSBBYTE=3;
     #endif
     
     //define an instance variable of the union
     union char_int cint;
     //define a variable to hold the computation result
     int result;
     //assign a value to the union using the integer variable
     cint.i = 0x10394500;
     //divide the constant 100 with MSB i.e. first byte.
     result = 100/a[MSBBYTE];

Byte ordering may also cause problems with network data transfer. Most of the modern network protocols take the endianness into account. These protocols use the External Data Representation (XDR) ordering to transfer data. Data from different source environments are converted to this representation while starting a transfer. Data will convert back to the native representation of the target environment at the finish of transfer. Distributed applications that do raw data transfers should also account for the endianness. The standard C library provides many routines to do this conversion. APIs such as the following, provide a means of platform independence while doing the network transfer:

  • ntohl() - converts unsigned int from XDR to native
  • ntohs() - converts unsigned int from XDR to native
  • htonl() - converts unsigned int from native to XDR
  • htons() - converts unsigned short from native to XDR

Signal Handling

Signals are the means to notify a process or thread the occurrence of an event. In case of signal handling, Linux supports most of the signals supported by UNIX Systems such as SVR4 and the BSD implementations. However, there are some exceptions that need to be considered.

  • SIGEMT represents hardware fault is not supported
  • SIGINFO represents keyboard information requests and is supported
  • SIGSYS represents invalid system call is not supported.
  • SIGABRT and SIGIOT are identical.
  • SIGIO, SIGPOLL, and SIGURG are identical.
  • SIGBUS is defined as SIGUNUSED because there is no "bus error"' in Linux platform.

The following table lists various signals and their meaning in both Solaris as well as Linux environments. This table can be used to verify if the signals used in the code has a different semantics in Linux.

Table 1. Semantics of Signals in Solaris and Linux

SIGNAL Solaris Linux
SIGHUP Terminate Ignore
SIGINT Terminate Ignore
SIGQUIT Terminate, core Terminate, core
SIGILL Terminate, core Terminate, core
SIGTRAP Terminate, core Ignore
SIGABRT Terminate, core Terminate, core
SIGEMT Terminate, core Not supported on Linux
SIGFPE Terminate, core Terminate, core
SIGKILL Terminate Terminate
SIGBUS Terminate, core Terminate, core
SIGSEGV Terminate, core Terminate, core
SIGSYS Terminate, core Not supported on Linux
SIGPIPE Terminate Ignore
SIGALRM Terminate Ignore
SIGTERM Terminate Terminate
SIGUSR1 Terminate Ignore
SIGUSR2 Terminate Ignore
SIGCHLD Ignore Ignore
SIGPWR Ignore Ignore
SIGWINCH Ignore Process stop
SIGURG Ignore Ignore
SIGPOLL Terminate Not supported on Linux
SIGSTOP Process stop Process stop
SIGSTP Process stop Process stop
SIGCONT Ignore Ignore
SIGTTIN Process stop Process stop
SIGTTOU Process stop Process stop
SIGVTALRM Terminate Terminate, core
SIGPROF Terminate Ignore
SIGXCPU Terminate, core Terminate, core
SIGXFSZ Terminate, core Terminate, core
SIGWAITING Ignore Not supported on Linux
SIGLWP Ignore Not supported on Linux
SIGFREEZE Ignore Not supported on Linux
SIGTHAW Ignore Not supported on Linux
SIGCANCEL Ignore Not supported on Linux
SIGRTMIN Terminate Not supported on Linux
SIGTRMAX Terminate Not supported on Linux
Note: This table is also available in the Technical guide for porting applications from Solaris to Linux, Version 1.0

Runtime Libraries

A Linker is responsible for linking the executables with the shared libraries. Though both the environments follow the same method for linking, there are some subtle differences. Linux maintains two different set of libraries, system libraries and user libraries. Solaris has only one set of libraries.

Table 2. Runtime library differences between Solaris and Linux

Function Solaris Linux
Runtime Linker /usr/lib/ld.so.1 /lib/ld-linux.so.1
Runtime Linker configurator Crle ldconfig


File Systems

Migrating data from one file system to another can be accomplished by either data migration tools or data can be transferred over the network. Data transferring is the most time consuming of the two. Linux has support for about thirty different file systems. In Solaris the predominant file system is UFS, in Linux it is EXT2. Linux has support for many different file systems such as: adfs, affs, autofs, coda, coherent, cramfs, devpts, efs, ext, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, and xiafs. The following table gives some filesystem differences between Linux and Solaris:

Table 3. Filesystem differences between Solaris and Linux

File System Solaris Linux
Common file system UFS EXT2/EXT3
Journaling file systems Veritas EXT3, REISERFS
File system for reading CDs HSFS ISO9660
System information PROCFS PROC
MSDOS file system PCFS MSDOS or VFAT


Threads

Solaris provides a threading model under which all processes are based on threads called light weight process (LWP). In Solaris a process will be associated with one or more LWP. In the case of Linux all threads are based on process and each thread will be mapped to a process.

Solaris not only supports the native threading model but also the POSIX threading model; POSIX threads are also supported on Linux. If the application uses Solaris native thread model then the application needs a lot of rework before it can be ported. If an application has nonstandard proprietary functions, then a Solaris Thread Library (STL) available on Linux can be used to ease the migration of that application. This library set provides the Solaris thread interfaces built upon the POSIX thread library. [1]

Absolute addresses

Applications that use hard-coded addresses might be difficult to port. Some applications use mmap() call for page fixing. Since each platform has its own way of handling the program stack, heap, system libraries, and so on, such a call to mmap with a hard-coded address might result in a segment violation.

For instance, some addressing schemes ignore the high-order bits. So a hard-coded address of 0x80000000 might get translated to 0x00000000 and cause unintentional results. It is desirable to eliminate the usage of hard-coded addresses inside the code. If the application mandates the use of hard-coded addresses, then it has to be changed to use only an allowed memory range, which you can obtain from /proc/<application_pid>/map.

Padding

When a structure or an aggregate data type is used in the code, each platform has its own way of laying out the constituent elements. This arrangement is dependant on structure, architectural limitation, efficiency, and compiler. Most of the process architectures cannot read data from odd addresses. Architectures such as PowerPC are inefficient in reading the data if it starts at an address not divisible by four. So for efficiency purposes, compilers add the so-called pad bytes. The function of these bytes is just to maintain the byte alignment so that the code can perform efficiently.

Example 6. Pad Bytes

struct struct1{
DATA2 d1; 	// Data of size 2 bytes
DATA4 d2; 	// Data of size 4 bytes
}struct1;

For a 4-byte alignment platform, the compiler would lay out the previous structure in the following table:

Table 4. 4-byte alignment

d10 d11 P P
d20 d21 d22 d23
... ... ... ...

Where P is padding, d10, d11 are bytes of d1, and d20-3 are bytes of d2.

In Table 5, the data structure occupies 8 bytes because of the padding. For a platform that does not need any alignment, the compiler would lay out the same structure differently.

Table 5. 8-byte alignment

d10 d11 d20 d21
d22 d23 ... ...
... ... ... ...

Where d10, d11 are bytes of d1, and d20-3 are bytes of d2.

In Table 5, the data structure occupies only 6 bytes. When using functions such as sizeof() to measure the size of the structure, this behavior has to be taken into account while porting. Most compilers provide options for disabling or enabling byte alignment (including padding) that can be used as per requirement. But disabling alignment will usually result in performance degradation.

Toolset

C/C++ Resources

On the Linux platform, the developmental tools are mostly the GNU Compiler Collection (GCC). GCC includes tools for both C and C++. GNU tools are also available for Solaris (Solaris GNU tools: www.sunfreeware.com). All the Solaris applications can be first compiled with the GNU versions instead of the proprietary Solaris versions. However, the construct differences between the Solaris make utility and the GNU make utility (gmake) have to be resolved. The respective documentations can be used for this purpose. Once makefiles are made to work with gmake, rebuild the application. The errors thrown from a dry run with this makefile can be classified into command-line option errors and code errors. Command-line option errors are easy to resolve using the following table that contains the common options for the C compilers on Solaris and the GNU GCC. For additional options the respective compiler manual should be used.

Table 6. Differences between options for Sun Workshop and GCC

Sun Workshop GCC Description
-# -v Turns on verbose mode, showing each component as it is invoked.
-Xa -ansi Specifies compliance with the ANSI/ISO standard. The GCC supports all ISO C89 programs. You can use '-std' to specify the particular version of ISO C.
-xinline -finline-functions Inlines only those functions specified.
-xa -ax Generates extra code to write profile information for basic blocks, which will record the number of times each basic block is executed.
-xspace -O0 Does not optimize.
-xunroll= -funroll_loops Performs the optimization of loop unrolling only for loops in which the number of iterations can be determined at compile time or run time.
-xtarget = name -b=machine The argument machine specifies the target machine for compilation. In addition, each of these target machine types can have its own special options, starting with 'm', to choose among various hardware models or configurations.
-xo -O, -O1, -O2, -O3, -Os Controls various sorts of optimizations.
-O Same as above Controls various sorts of optimizations.
-xmaxopt   Ensures that GCC does not use #pragma.
-xnolib -nostdlib Does not link any libraries by default.
-fsingle -fsingle-precision-constant Treats floating point constant as single precision constant instead of implicitly converting it to double precision.
-C -C Tells the preprocessor not to discard comments. Used with the '-E' option.
-xtrigraphs -trigraphs Supports ISO C trigraphs.
-E -E Preprocess all C source files specified and outputs that result to standard output or to the specified output file.
-xM -M Runs only the preprocessor on the named C programs, requesting that it generate makefile dependencies and send the result to the standard output.
-xpg -pg Generates extra code to write profile information suitable for the analysis program gprof.
-c -c Directs the compiler to suppress linking with ld and to produce the .o file for each source file.
-o -o Names the output file.
-S -S Directs cc to produce an assembly source file but not to assemble the program.
-xtemp TMPDIR Specifies the directory to use for temporary files if the TMPDIR environment is set.
-xhelp=f -help Displays online help information.
-xtime -time Reports the CPU time taken by each subprocess in the compilation sequence.
-w -q Suppresses compiler warnings.
-erroff= %none -W Displays the warning messages.
-errwarn -Werror Makes all warnings into errors.

Table 6: From Technical guide for porting applications from Solaris to Linux, version 1.0

Command-line option errors could also be thrown from the linkers (in the case code compilation was successful). The most common options of the SPARCworks linker and the functionality of the GNU linker are as follows:

Table 7. Differences between options in SPARCworks and GNU

Solaris Workshop gld Option Description
-a -static Enables the default behavior in the static mode and prevents linking with the shared libraries. The linker is creating executable and undefined symbols causing error messages. GNU ld has the option -static that also enables this behavior.
-b   Achieves the equivalent of the GNU linker by not compiling the source code with the option -fPIC/-fpic.
-g -g Produces debugging information in the operating system native format.
-m (-M) Prints a linker map. The -M option prints something comparable but with a different format and slightly different content.
-s -S/-s Achieves the equivalent of the -s option by using -S with the GNU linker, which removes only the debugging information.
-h name -soname name Sets name as the shared object name. With the GNU linker, the option -soname must be used.
-o filename -o filename Places output in a file. This applies regardless of the type of output being produced. The default is to put an executable file in a.out
-L directory -Ldir Adds directory dir to the list of directories.
-R path -rpath path Specifies the search direction to the runtime linker. The GNU linker uses the option -rpath.

Table 7: From Technical guide for porting applications from Solaris to Linux, version 1.0

The code-related error messages and warnings are mainly due to the difference in constructs and APIs semantics between the compilers. These errors should be resolved by referring to the compiler manuals.

(출처:http://ldn.linuxfoundation.org/article/migrating-solaris-applications-linux-0)

2009/04/02 15:07 2009/04/02 15:07

Posted on 2009/03/20 06:04
Filed Under Study/Solaris

ifconfig ce0:1 plumb <ip> up
ifconfig ce0:1 down
ifconfig ce0:1 unplumb

아.. 역시 난 리눅스가 좋아.
솔라리스는 초본가봐;

2009/03/20 06:04 2009/03/20 06:04
TAG :

Posted on 2009/02/12 11:47
Filed Under Study/Solaris

까먹지 말자는 차원에서 펌......
-------------------------------------------------------------------------------

웹서버를 위한 솔라리스 파라미터 튜닝


File Descriptor, TCP 파라미터 튜닝

 

                            2006.6 김범수


1. File Descriptor


File Descriptor는 주로 각 소켓 커넥션(Socket Connection)으로 사용되는데 File Descriptor의 제한에 의해 영향을 받는 경우는 보통 소켓을 부적절하게 사용하는 경우이지만, 그 외에도 다음과 같은 에러가 발생하기도 한다.

-Too many open files

-Broken pipe

-ClassNotFound

물론 Broken pipe 에러는 다양한 경우에 발생하는 에러이지만 File Descriptor의 제한으로 인해 발생할 수 있다. 소켓 이외에 디스크로부터 클래스를 얻어 로드하는 경우 File Descriptor가 사용되는데, 부족하면 해당 시스템에 클래스가 존재하고도 ClassNotFound와 같은 에러가 표시되기도 한다.

다음의 예는 솔라리스에서 File Descriptor를 설정하는 예이다.


-ulimit 커맨드를 사용해 File Descriptor을 확인한다.

-ulimit 커맨드를 사용해 현재 프로세서에서의 Descriptor의 제한을 일시적으로 변경한다. 

  csh 경우)

      limit descriptors 1024

  sh, ksh 경우)

      ulimit -n 1024

-File Descriptor의 값을 영구적으로 설정하기 위해 /etc/system 파일에 다음을 설정한다.

      set rlim_fd_max= 최대값을 설정한다.

      set rlim_fd_cur = 디폴트값을 설정한다.


※ 현재 웹서버 1024로 설정



2. TCP 파라미터


※TCP 파라미터를 적용함에 있어 ndd 명령어를 사용하며 재부팅후에도 계속 같은 설정값을 사용하고자 한다면 /etc/rc2.d/S69inet 에 값을 설정한다.


▼ tcp_time_wait_interval

-커넥션이 종료됐을 때 TIME_WAIT 상태로 머물게 되는 시간을 설정

디폴트는 4분(240000ms)으로 짦은 시간에 많은 클라이언트가 접속을 하면 네트워크 성능  에 영향을 줄 수 있기 때문에 1분(60000ms) 정도로 변경할 것을 추천한다.


▼ ICQ: tcp_conn_req_max_q0  ,  CCQ: tcp_conn_req_max_q

-솔라리스에는 클라이언트의 리퀘스트를 3웨이 핸드세이크(3-way handshake)를 통해 받는  다. 여기에는 ICQ(Incomplete Connec tions Queue), CCQ(Completed Connections Queue)가 있는데, ICQ는 시스템에 전달되는 모든 SYN 패킷을 저장한다.

즉 처음으로 커넥션을 시도하는 리퀘스트(Request)는 일단은 여기에 머물고, 3웨이 핸드세이크를 통해 완벽하게 established 상태가 되지 않은 모든 커넥션에 대한 내용도 바로 이 큐(Queue)에 저장되는 것이다.

CCQ는 3웨이 핸드세이크를 통해 커넥션이 성립된 것들이 저장되는 큐다. 즉 CCQ에서 대기하면서 다시 accept를 호출 하는 것을 기다리고 accept된 것들은 큐에서 사라진다.

모든 큐는 설정된 값(기본 128개)에 의해 제한을 받는데 어떤 이유에서든 CCQ에서 지워지지 않고, 큐가 꽉 차면 커널은 더 이상의 커넥션을 받지 않는다.

타임아웃(Timeout) 값은 큐에 저장된 SYN 세그먼트에 의해 결정되며, 큐에 저장된 SYN 패킷에 대해 ACK가 수신되지 않는 경우(SYN_RCVD 상태)에는 시간이 경과되고 그 결과 그냥 패킷이 지워진다. 결과적으로 클라이언트가 아무리 SYN를 보내도 이러한 커넥션은 ICQ에 머물게 되며 3웨이 핸드세이크를 하지 않으므로 CCQ로 넘어가지 않는다. 이런 이유로 인해 두 개의 큐 설정 값은 WAs 서버의 성능에 큰 영향을 주게 된다.

     

tcp_conn_req_max_q0 

tcp_conn_req_max_q

기본 1024

기본 128

권장1024 이상

권장 128 이상

 


▼ tcp_ip_abort_cinterval 

-연결에 대한 제한 시간을 중단(Abort Timeout)합니다.즉, 3-Way 핸드셰이크 방식에서

사용되는 중단 타이머(Abort Timer)입니다.

기본값은 3분(180000ms)입니다. 1분 권장


▼ tcp_ip_abort_interval

-연결된 후에 사용되는 중단 시간 간격(Abort Interval)으로, 연결된 동안의 중단 제한

시간(Abort Timeout)입니다. 즉, RESET 세그먼트가 보내지기 전에 연결이 설정된 상태

에서 TCP가 재전송되는 최대 시간입니다.

기본값은 8분(480000ms)입니다. 1분 권장

※ 메일서버가 설정된 서버에서는 값을 5분 이하로 줄이지 말것 아래와 같은 에러가 발생

   sendmail: SYSERR: collect: read timeout on connection from


▼ tcp_keepalive_interval

-서버 애플리케이션에서 KEEPALIVES가 설정되어 있고 응답하지 않은 연결이 계속 활성화

된 경우 검사하는 간격을 지정합니다.

tcp_keepalive_interval에 설정된 시간이 지나면 프로브(probe)가 보내지고 연결이

해제되어 응답하는 클라이언트가 없는 상태인 tcp_ip_abort_interval에 설정된 시간이

될 때까지 tcp_keepalive_interval에 프로브가 다시 보내집니다.

기본값은 7200000밀리초(2시간)입니다.


▼ tcp_xmit_hiwat

-이 매개 변수는 연결된 상태에서 보낼 때 사용되는 버퍼 공간의 기본값을 지정합니다.

즉, UNACK 데이터를 보낼 때 할당되는 버퍼 공간의 크기입니다. 대부분의 경우

tcp_xmit_hiwat값과 tcp_recv_hiwat의 값은 같습니다. 기본값은 8192바이트(8K)입니다.


▼ tcp_recv_hiwat

-이 매개 변수는 연결된 동안 사용되는 수신 버퍼 공간의 기본값을 지정합니다. 즉,

수신된 데이터에 대해 할당되는 버퍼 공간의 크기로 사용 가능한 최대 크기를

Receive Window에 알려줍니다. 대부분의 경우 tcp_recv_hiwat 값과 tcp_xmit_hiwat

값은 같습니다. 기본값은 8192바이트(8K)입니다.


▼ tcp_rexmit_interval_max

-재전송을 위한 최대 시간 간격입니다. 두 번 연속되는 전송 과정에서의 최대 대기

시간의 간격입니다.

기본값은 60000밀리초(1분)에서 240000밀리초(240초)로 변경되었습니다


▼ tcp_rexmit_interval_min

-재전송을 위한 최소 시간 간격입니다.

즉, 첫 번째 재전송 후 최소 대기 시간의 간격입니다.

기본값은 200밀리초입니다.












※ 현재 /etc/rc2.d/S69inet 에 설정된 내용

/usr/sbin/ndd -set /dev/tcp tcp_conn_req_max_q 8192

/usr/sbin/ndd -set /dev/tcp tcp_conn_req_max_q0 8192

/usr/sbin/ndd -set /dev/tcp tcp_ip_abort_cinterval 60000

/usr/sbin/ndd -set /dev/tcp tcp_ip_abort_interval 60000

/usr/sbin/ndd -set /dev/tcp tcp_keepalive_interval 10000

/usr/sbin/ndd -set /dev/tcp tcp_time_wait_interval 7000

/usr/sbin/ndd -set /dev/tcp tcp_xmit_hiwat 65536

/usr/sbin/ndd -set /dev/tcp tcp_recv_hiwat 65536

/usr/sbin/ndd -set /dev/tcp tcp_fin_wait_2_flush_interval 70000

/usr/sbin/ndd -set /dev/tcp tcp_rexmit_interval_max 60000

/usr/sbin/ndd -set /dev/tcp tcp_rexmit_interval_min 200

2009/02/12 11:47 2009/02/12 11:47
TAG :

Posted on 2008/11/02 06:43
Filed Under Study/Solaris


NAME
    isainfo - describe instruction set architectures


EXAMPLES
    Example 1: Invoking isainfo on a 32-bit IA platform

    example% isainfo -v
    32-bit i386 applications

    example% isainfo -k
    i386

    Example 2: Invoking isainfo on a system running  the  32-bit
    operating system on a 64-bit SPARC processor

    example% isainfo -n
    sparc

    example% isainfo -v
    32-bit sparc applications

    example% isainfo -kv
    32-bit sparc kernel modules

    Example 3: Invoking isainfo on the  same  hardware  platform
    (that  is,  a  64-bit  SPARC  processor)  running the 64-bit
    operating system

    example% isainfo
    sparcv9 sparc

    example% isainfo -n
    sparcv9

    example% isainfo -v
    64-bit sparcv9 applications
    32-bit sparc applications

    example% isainfo -vk
    64-bit sparcv9 kernel modules

2008/11/02 06:43 2008/11/02 06:43
TAG :

Posted on 2007/10/12 10:47
Filed Under Study/Solaris


#cpu 정보 확인 방법
리눅스 : cat /proc/cpuinfo|grep processor|wc -l
솔라리스 : psrinfo -v|grep "Status of processor"|wc -l
IBM-AIX : lsdev -C|grep Process|wc –l
HP/UX : ioscan -C processor | grep processor | wc -l

#cpu idle상태 및 메모리 사용 확인
vmstat 1 : 계속 체크하겠다.
sar 1 10000 : 1초간격 10000번 체크하겠다.

# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
      0. c0t0d0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>
         /sbus@2,0/SUNW,socal@d,10000/sf@0,0/ssd@w210000203739c086,0
      1. c0t1d0 <drive type unknown>
         /sbus@2,0/SUNW,socal@d,10000/sf@0,0/ssd@w210000203739051b,0
      2. c0t2d0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>
         /sbus@2,0/SUNW,socal@d,10000/sf@0,0/ssd@w2100002037391ceb,0

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

# uname -a


SunOS library 5.7 Generic_106541-16 sun4u sparc SUNW,Ultra-Enterprise


# df -k


파일시스템           K바이트    사용    가용   용량    설치지점
/proc                      0       0       0     0%    /proc
/dev/dsk/c0t0d0s0    8140465 4607087 3451974    58%    /
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c0t0d0s6    3602618 2534046 1032546    72%    /user1
/dev/dsk/c0t0d0s7    3602618 2998867  567725    85%    /user2
swap                 2157096     424 2156672     1%    /tmp

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


# prtdiag


시스템 구성:  선 마이크로시스템즈  sun4u 5-slot Sun Enterprise E3500
시스템 시계 주파수: 100 MHz
메모리 크기: 1024Mb

========================= CPUs =========================

                   Run   Ecache   CPU    CPU
Brd  CPU   Module   MHz     MB    Impl.   Mask
---  ---  -------  -----  ------  ------  ----
3     6     0      400     8.0   US-II    10.0
3     7     1      400     8.0   US-II    10.0


========================= Memory =========================

                                             Intrlv.  Intrlv.
Brd   Bank   MB    Status   Condition  Speed   Factor   With
---  -----  ----  -------  ----------  -----  -------  -------
3     0    1024   Active      OK       60ns    1-way

========================= IO 카드 =========================

    Bus   Freq
Brd  Type  MHz   Slot  Name                              Model
---  ----  ----  ----  --------------------------------  ----------------------
1   SBus   25     1   cgsix                             SUNW,501-2253       
1   SBus   25     2   network                           SUNW,sbus-gem       
1   SBus   25     3   SUNW,hme                                              
1   SBus   25     3   SUNW,fas/sd (block)                                   
1   SBus   25    13   SUNW,socal/sf (scsi-3)            501-3060            

시스템에 실패된 것 없음
===========================

No System Faults found
======================



# dmesg
2005년 7월 21일 목요일 오후 02시 58분 34초
Jun 25 14:37:02 library unix: sbus1 at root: UPA 0x3 0x0 ...
Jun 25 14:37:02 library unix: sbus1 is /sbus@3,0
Jun 25 14:37:02 library unix: ID[SUNWssa.socal.driver.1010] socal0: Downloading host adapter, fw date code: @(#)Thu May  4 18:52:02 2000
Jun 25 14:37:02 library unix: socal0 at sbus0: SBus0 slot 0xd offset 0x10000 Onboard device sparc9 ipl 3
Jun 25 14:37:02 library unix: socal0 is /sbus@2,0/SUNW,socal@d,10000
Jun 25 14:37:02 library unix: sf0 at socal0: socal_port 0
Jun 25 14:37:02 library unix: sf0 is /sbus@2,0/SUNW,socal@d,10000/sf@0,0
Jun 25 14:37:03 library unix: sf1 at socal0: socal_port 1
Jun 25 14:37:03 library unix: sf1 is /sbus@2,0/SUNW,socal@d,10000/sf@1,0


# prtconf
System Configuration:  Sun Microsystems  sun4u
Memory size: 1024 Megabytes
System Peripherals (Software Nodes):

SUNW,Ultra-Enterprise
   packages (driver not attached)
       terminal-emulator (driver not attached)
       deblocker (driver not attached)
       obp-tftp (driver not attached)
       disk-label (driver not attached)
       ufs-file-system (driver not attached)
   chosen (driver not attached)
   openprom (driver not attached)
       client-services (driver not attached)
   options, instance #0
   aliases (driver not attached)
   memory (driver not attached)
   virtual-memory (driver not attached)
   central, instance #0
       fhc, instance #2
           eeprom (driver not attached)
           zs, instance #0
           zs, instance #1
           clock-board, instance #0
   fhc, instance #0
       ac, instance #0
       simm-status, instance #0
       environment, instance #0
       sram, instance #0
       flashprom (driver not attached)
   SUNW,UltraSPARC-II (driver not attached)
   SUNW,UltraSPARC-II (driver not attached)
   sbus, instance #0
       SUNW,socal, instance #0
           sf (driver not attached)
               ssd (driver not attached)
           sf (driver not attached)
               ssd (driver not attached)
           sf, instance #0
               ssd, instance #0
               ssd, instance #1
               ssd, instance #2
           sf, instance #1
       cgsix, instance #0
       network (driver not attached)
   fhc, instance #1
       ac, instance #1
       environment, instance #1
       flashprom (driver not attached)
       eeprom (driver not attached)
       sbus-speed (driver not attached)
   counter-timer (driver not attached)
   sbus, instance #1
       SUNW,hme, instance #0
       SUNW,fas, instance #0
           sd (driver not attached)
           st (driver not attached)
           sd, instance #0 (driver not attached)
           sd, instance #1 (driver not attached)
           sd, instance #2 (driver not attached)
           sd, instance #3 (driver not attached)
           sd, instance #4 (driver not attached)
           sd, instance #5 (driver not attached)
           sd, instance #6
           sd, instance #7 (driver not attached)
           sd, instance #8 (driver not attached)
           sd, instance #9 (driver not attached)
           sd, instance #10 (driver not attached)
           sd, instance #11 (driver not attached)
           sd, instance #12 (driver not attached)
           sd, instance #13 (driver not attached)
           sd, instance #14 (driver not attached)
           st, instance #0 (driver not attached)
           st, instance #1 (driver not attached)
           st, instance #2 (driver not attached)
           st, instance #3 (driver not attached)
           st, instance #4 (driver not attached)
           st, instance #5
           st, instance #6 (driver not attached)
   counter-timer (driver not attached)
   pseudo, instance #0

2007/10/12 10:47 2007/10/12 10:47

Posted on 2007/10/12 10:30
Filed Under Study/Solaris

SUNOS 공통


1>    인터페이스 정보 및 설정방법

인터페이스 확인시 -> #ifconfig –a

인터페이스 아이피 할당 -> ifconfig hme0 inet 192.168.10.1 netmask 255.255.255.0 up


2>    CPU IDLE 타임 보는 방법

#vmstat 1


3>    디폴트 라우팅 및 라우팅테이블 넣는 방법 및 확인 방법


#route add net default 10.1.1.1 1

#route add net 200.1.1.0 –netmask 255.255.255.0 10.2.2.1 1

#netstat –rnv


4>    네트워크 트래픽 및 상태 보는 방법

#netstat –i 1


5>    가동시간 보는방법

#uptime


6>    dmesg보는 방법

#dmesg | more


7>    프로세스 보는 방법

#ps –ef | more

#/usr/ucb/ps aux | more


8>    리부팅 방법

#sync

#reboot


9>    시스템정보보는 방법

#showrev

#uname –a

#hosted

#hostname

#prtconf

#psrinfo

#prtmem


10>메모리 및 CPU를 많이 차지하는 프로세스 보는 방법


#prstat

#/usr/ucb/ps aux more

#ps -ef -o pcpu -o comm | sort –nr


11> 디스크 파티션 보는 방법

#df -k


12> 디스크 정보 보는 방법

#format


13> snoop사용하는 방법

#snoop –d hme0 192.168.1.1 à 192.168.1.1을 가진 패킷 모니터링

#snoop –d hme0 | grep 192.168.1.1 à 위와같음

#snoop –d hme0 from 192.168.1.1 to 10.10.10.1 à 192.168.1.1 에서 10.10.10.1번으로 가는 패킷 모니터링

#snoop –d hme0 from 192.168.1.1

#snoop –d hme0 to 192.169.1.1

#snoop –v(verbose mode 패킷 감시)

#snoop –V(summary mode 패킷 감시)

#snoop –d hme0 192.168.1.1 –o test.txt(모니터링한 패킷을 저장)

#snoop –i test.txt(저장파일을 읽어들일 때 사용)


14> find명령어 사용법

#find . -name "*.html" è 특정 문자열 검색

#find . -mtime –5 * è 특정일동안 변경된 파일 찾기(5일동안 수정된 파일 검색)

#find . -mtime +30 * è 30일동안 수정되지 않은 파일 검색

# find /  -mount -size +10000k è file size가 10m이상이 파일 검색


15>ndd 명령어 사용법

#ndd –get /dev/ip \?

#ndd –get /dev/hme \?

#ndd –get /dev/ip ip_forwarding

#ndd –get /dev/hme link_mode link_speed linkstatus



16> shared memory삭제하는 방법

shared  memory를 차지하고 있는 프로세스 보기

#ipcs –am


프로세스 삭제하기

#ipcrm –m [ID]


17> core파일 보는 방법

/var/crash/”hostname”밑의 core파일 보는방법(crash core)

# adb -k unix.0 vmcore.0

$<msgbuf


#iscda unix.0 vmcore.0


system core파일 보는법

#pstack core파일


#crash –d core파일


18> tar 명령어 사용하는 방법

tar cvf conf.tar * è 압축하는 방법

tar xvf conf.tar è 압축한거 푸는 방법


19> file size확인 하는 방법

#du -k


20> core file 없애는 방법

find / -name core -exec rm {} \;


21> 시스템 커널정보 보는 명령어

#isainfo –v


22> ln명령어 사용법

ln –s /opt/SECUREWORKS/3.0/logs/spool /opt/SECUREWORKS/3.0/spool


è 이 예는 3.0/spool을 logs/spool로 링크를 걸어 놓은 것이고 하는 방법은

logs밑에 spool디렉토리를 만든 위처럼 명령어를 치면된다 위 명령어를 실행하기전에

3.0밑에 spool이라는 디렉토리가 없어야 함 이 디렉토리는 위 명령어를 치면 자동으로 생김 


23> binary file 보는 명령어

#strings


24> netstat 명령어 사용법

netstat –rnv è 라우팅

netstat –np è ARP테에블

netstat –ak iprb0 è 인터페이스 정보

netstat –i 1 è 실시간 패킷 모니터링

netstat –I hme0 1 è 인터페이스별 실시간 패킷 모니터링


25> spool에 쌓인 대량의 파일 지우는 방법

지우려고 하는 디렉토리로 이동

# find ./ -name “MI*” -exec rm {} \;

# find ./ -name “MD*” -exec rm {} \;


26> SUN OS에서 NTP설정하는 방법

1. /etc/inet/ntp.client를 /etc/inet/ntp.conf로 copy한 후  다음과 같이 설정합니다.


만약, NTP 서버가 172.17.17.17 이라면...



  # cp /etc/inet/ntp.clinet /etc/inet/ntp.conf



# @(#)ntp.client        1.2     96/11/06 SMI

#

# /etc/inet/ntp.client

#

# An example file that could be copied over to /etc/inet/ntp.conf; it

# provides a configuration for a host that passively waits for a server

# to provide NTP packets on the ntp multicast net.

#


#multicastclient 224.0.1.1

server 172.17.17.17



27> 백업하는 방법

full backupdㄹ 할 때 :

#ufsdump 0ucf /dev/rmt/0

복구시키는 방법

#ufsrestore if /dev/rmt/0


28> 이더넷(ethernet) 디바이스의 종류



이더넷 디바이스의 종류

sparc >>>>>>>>>>>>>>>>>>>>>>>>>

bge SUNW,bge Gigabit Ethernet driver for Broadcom BCM5704
ce Cassini Gigabit-Ethernet device driver
dman SUNW,dman Sun Fire 15K management network device driver
dmfe Davicom Fast Ethernet driver for Davicom DM9102A
eri eri Fast-Ethernet device driver
ge GEM Gigabit-Ethernet device driver
hme SUNW,hme Fast-Ethernet device driver
idn inter-domain network device driver
le Am7990 (LANCE) Ethernet device driver
qfe SUNW,qfe Quad Fast-Ethernet device driver
scman SUNW,scman Sun Fire 15K management network device driver

i386pc >>>>>>>>>>>>>>>>>>>>>>>>>>

sk98sol SysKonnect Gigabit Ethernet SK-98xx device driver
spwr SMC EtherPower II 10/100 (9432) Ethernet device driver
dnet Ethernet driver for DEC 21040, 21041, 21140 Ethernet cards
e1000g Intel Gigabit, 82542, 82543, 82544, 82540 based NICs
elx 3COM EtherLink III Ethernet device driver
elxl 3Com Ethernet device driver
ieef Intel Ethernet device driver
iprb Intel 82557, 82558, 82559 controlled NICs
pcn AMD PCnet Ethernet controller device driver


29>프로세스 FULL 정보 보기

ps -ef | grep <process name>
은 80자로 프로세서 정보만 볼수 있다

프로세서 모든 정보를 보기 위해 다음과 같이 사용한다.
/usr/ucb/ps -auxww | grep <process name>
Gives the full listing of the process (long listing)


30>프로세스 FULL리스트 보기


/usr/ucb/ps –auxww | more


31>  솔라리스 로그정보 파일 위치

/var/adm/message~

/var/adm/utmpx

/var/adm/wtmpx

/var/log/syslog

/var/adm/sulog


31>mtu 설정하기

# ifconfig hme0 129.46.66.2 netmask 255.255.255.0 mtu 256


32>hostname바꾸기

A.       /etc/hosts

2. /etc/nodename

3. /etc/hostname.xx0 ---> ethernet card의 종류에 따라
네임이 틀립니다.
예) hostname.le0
hostname.hme0
hostname.eri0

4. /etc/net/ticlts/hosts

5. /etc/net/ticots/hosts

6. /etc/net/ticotsord/hosts


33>솔라리스 X86 serial(com1)으로 콘솔 사용후 다시 모니터와 키보드로 바꾸려면


eeprom input-device=ttya
eeprom output-device=ttya
eeprom ttya-mode=9600,8,N,1,-

ttya는 COM1 이고 ttyb는 COM2 입니다.

설정사항은

/boot/solaris/bootenv.rc에서 확인할수 있습니다.


다시 원래대로 바꾸려면


eeprom input-device=keyboard

eeprom output-device=screen


34>cron 사용하기

1. cron 명령은 지정된 날짜와 시간에 일정 작업을 주기적으로 수행하기 위해 사용되며 각 사용자별 로 /var/spool/cron/crontabs 디렉토리에 사용자 ID와 같은 이름의 crontab 화일을 만들어 cron job을 지정할 수 있다.

cron 명령은 시스템이 부팅되면서 /etc/rc2.d/S75cron 스크립트에 의해서 daemon 형태로 수행된다.

2. 각 사용자 별로 crontab 화일을 만드는 방법은 아래와 같이 "crontab -e" 명령을 실행하면 된다.

% crontab -e

위 와 같이 명령을 실행하면 "vi" editor mode로 들어가 crontab 화일을 수정할수 있게 되는데, 만약 "vi" mode로 들어가지 않으면 "EDITOR" 환경변수를 vi로 변경 후 crontab 명령을 다시 수행한다.

2.1 csh을 사용하는 경우

% setenv EDITOR vi
% crontab -e

2.2 sh이나 ksh을 사용하는 경우

$ EDITOR=vi
$ export EDITOR
$ crontab -e

3. crontab 화일의 내용을 정의 하는 format은 아래와 같다.

분 시 일 월 요일 실행할 명령

분 : 0-59
시 : 0-23
일 : 1-31
월 : 1-12
요일 : 0-6( 0: 일요일)

예) 매주 일요일 오전 3:15에 /var 디렉토리에 있는 core 화일을 지우는 작업

15 3 * * 0 find /var -name core 2>/dev/null | xargs rm -f

매월 1일 오후 6시에 시스템 down message 보내기

0 18 1 * * wall "System Will be down"

4. /etc/cron.d/cron.allow 화일이나 /etc/cron.d/cron.deny 화일을 이용하여 시스템 관리자는 각 사용자별로 crontab 화일에 대한 access 권한을 제한 할 수 있다.

4.1 crontab을 access 할 수 있는 사용자

- /etc/cron.d/cron.allow 화일이 존재하는 경우, 그 화일 안에 지정된 사용자

- /etc/cron.d/cron.allow 화일이 없는 경우, /etc/cron.d/cron.deny 화일안에 지정되지 않은 사용자

4.2 crontab을 access 할 수 없는 사용자

- /etc/cron.d/cron.allow 화일이 존재하는 경우, 그 화일 않에 지정되지 않은 사용자

- /etc/cron.d/cron.allow 화일이 없는 경우, /etc/cron.d/cron.deny 화일에 지정된 사용자

- /etc/cron.d/cron.allow와 /etc/cron.d/cron.deny 화일이 모두 없는 경우,
root를 제외한 모든 사용자

4.3 OS가 설치되면 기본적으로 /etc/cron.d/cron.deny이 생성되고 그 안에 아래의 사용자들이 지정된다.

daemon
bin
smtp
nuucp
listen
nobody
noaccess

/etc/cron.d/cron.allow와 /etc/cron.d/cron.deny 화일에 사용자를 지정할 때는 위와 같이 한줄에 한명씩 사용자를 지정한다.

5. cron에 관련된 환경은 /etc/default/cron 화일에 정의 할 수 있다.

% cat /etc/default/cron

CRONLOG=YES
PATH=/usr/bin:/usr/ucb:


SUNOS-SPARC


1> 인터페이스 속도 조절 방법


/etc/system 파일에서 변경법

set dev/

set hme:hme_adv_autoneg_cap=0

set hme:hme_adv_100T4_cap=0

set hme:hme_adv_100fdx_cap=1
set hme:hme_adv_100hdx_cap=0

set hme:hme_adv_10fdx_cap=0

set hme:hme_adv_10hdx_cap=0


명령어로 바꾸는 방법


ndd –set /dev/hme instance 1

ndd -set /dev/hme adv_autoneg_cap 0

ndd -set /dev/hme adv_100T4_cap 0
ndd -set /dev/hme adv_100fdx_cap 1
ndd -set /dev/hme adv_100hdx_cap 0
ndd -set /dev/hme adv_10fdx_cap 0

ndd -set /dev/hme adv_10hdx_cap 0






SUNOS-X86


1> 인터페이스 속도 조절 방법

/kernel/drv/iprb.conf


모든인터페이스 속도 동일 지정

full-duplex=1;

speed=100;


각각의 인터페이스 선택하여 속도 지정

ForceSpeedDuplex=5,4,3;

(출처 : http://blog.naver.com/junerai?Redirect=Log&logNo=120040558875)

2007/10/12 10:30 2007/10/12 10:30
TAG : ,

Posted on 2007/10/12 10:28
Filed Under Study/Solaris

- SPARC 계열의 시스템장비가 사용하는 네트워크 인터페이스

scman  => SUNW,scman Sun Fire 15K management network device driver


bge  => SUNW,bge Gigabit Ethernet driver for Broadcom BCM5704

ce => Cassini Gigabit-Ethernet device driver

dman => SUNW,dman Sun Fire 15K management network device driver
dmfe => Davicom Fast Ethernet driver for Davicom DM9102A
eri => eri Fast-Ethernet device driver
ge => GEM Gigabit-Ethernet device driver
hme => SUNW,hme Fast-Ethernet device driver
idn => inter-domain network device driver
le => Am7990 (LANCE) Ethernet device driver
qfe => SUNW,qfe Quad Fast-Ethernet device driver
- X86계열의 시스템 장비가 사용하는 네트워크 인터페이스
 
spwr => SMC EtherPower II 10/100 (9432) Ethernet device driver
dnet => Ethernet driver for DEC 21040, 21041, 21140 Ethernet cards
e1000g => Intel Gigabit, 82542, 82543, 82544, 82540 based NICs
elx => 3COM EtherLink III Ethernet device driver
elxl  => 3Com Ethernet device driver
ieef => Intel Ethernet device driver
iprb => Intel 82557, 82558, 82559 controlled NICs
pcn => AMD PCnet Ethernet controller device driver
sk98sol => SysKonnect Gigabit Ethernet SK-98xx device driver

(출처 : http://blog.naver.com/sweatmeat?Redirect=Log&logNo=10019887095)

2007/10/12 10:28 2007/10/12 10:28

너의 길을 걸어라. 그리고 사람들로 하여금 말하게 내버려 두어라. (Segui il tuo corso, e lascia dir le gentil) - 단테, '신곡' [연옥]편 제5절 - by Twins

Counter

· Total
: 103778
· Today
: 120
· Yesterday
: 139


Locations of visitors to this page
free counters