HP-UX System and Network

Document Sample
HP-UX System and Network Powered By Docstoc
					HP-UX System & Network Administration I         0

                  HP-UX System and Network
                             Administration I
HP-UX System & Network Administration I                1

                                      목   차

Module 1     Introduction to HP-UX Administration           2
Module 2     Overview of SAM                                3
Module 3     Creating and Managing User                     3
Module 4     Customizing User                               6
Module 5     Guided Tour of the HP-UX File Hierarchy        7
Module 6     Connecting Peripherals                         9

Module 7     Configuring Device Files                      10
Module 8     Configuring Disk Device                       12
Module 9     File System Concepts                          14
Module 10    File System Creation                          19
Module 11    File System Repair                            21
Module 12    File System Management                        23
Module 13    System Backup                                 27
Module 14    Scheduling cron Jobs                          30
Module 15    Managing Swap Space                           31
Module 16    Printer Management                            34
Module 17    Shutdown and Reboot                           37
Module 18    Reconfiguring the Kernel                      43
Module 19    Managing Software with SD-UX                  44
Module 20    Patch Management (SD-UX)                      47
Module 21    Connecting to a Network                       49
HP-UX System & Network Administration I                                              2
Module 1 Introduction to HP-UX Administration

1-1. Hardware Responsibilities

  * System 의 Create and maintain a hardware diagram of the system.
  * Verify that peripherals are installed correctly and tested.
  * Monitor performance of hardware components.
  * Arrange for repair in event of hardware failure

1-2. Software Responsibilities
  * Install and configure the HP-UX operating system.
  * Create file Systems. newfs
  * Manage the integrity of file systems. fsck
  * Monitor system resource usage. bdf
  * Design and implement backup and recovery routines.
  * Configure and maintain printer spooler software. lpadmin
  * Install and maintain network communication software.
  * Update the HP-UX operating system for new release. swinstall, swremove, swlist
  * Install and update application software.

1-3. Responsibilities to the Users
  * Allow user access to the system as required.
  * Evaluate user needs.
  * Plan for future system growth/change.
  * Provide assistance to the user community.
  * Implement the policies and procedures of your company/organization
    regarding the use of the computer system and network.

1-4. The System Administrator’ s Tool Kit
  * SAM
  * Support Contract
  * HP-ESC
  * HP-UX Documentation
HP-UX System & Network Administration I                                                                      3
Module 2 Overview of SAM

2-1. Why Use SAM ?
    * Simplifies complex administration tasks
    * Minimizes potential for errors
    * Provides a built-in help utility
    * Is less flexible than manual configuration
    * Is not helpful in some troubleshooting situations

       Shell                                Environment                             Environment File
  POSIX, Korn or Bourne shells           export DISPLAY=hostname:0.0                .profile or .dtprofile
  C shell                                setenv DISPLAY=hostname:0.0                .login

Module 3       Creating and Managing User Accounts

3-1. Users and Groups – Access to System and Data

                Su             Fran                                    rs
                e              k
                                                             Jean            Sue
                                                                Mari            Fran
                                                                e               k

3-2. What Defines a User Account ?

  /etc/passwd                                 /etc/group                op
   user1: …                                       accounts: …
   user2: …                                       research: …
   user3: …                                       finances: …
   uesr4: …                                       admin: …

                            /home                    Home directory

               user1                      user2
   HP-UX System & Network Administration I                                                             4

   3-3. The /etc/passwd file

                                                                    User 추가 방법
   Example :                                                        1. /etc/passwd 에 user 계정 추가 등록
                                                                       echo       ybn::1045:20::home_dir:shell >>
      root:Eq0oBTr1y1I7w:0:3:super user:/:/sbin/sh
                                                                    2. user home directory 생성
      bin:*:2:2::/usr/bin:/sbin/sh                                  3. 환경 file copy
      sys:*:3:3::/:                                                     cp /etc/skel/.* /home_directory
                                                                    4. chown – R user_name:group_name /home_dir
                                                                        owenr 와 group 을 모두 바꿔줌
   Use /usr/sbin/vipw to edit     /etc/passwd file edit             5. chmod 755 /home_dir
   Use /usr/sbin/pwck      /etc/passwd file error check

                                                                                login shell
username             user ID                ID string : comment


                            group ID
     password                                        Home directory

   ex ) username:password:user_ID:group_ID:ID_string:home_directory:login_shell

     shell 종류                                      Super shell

    /usr/bin/sh         POSIX shell               UID : 0

    /usr/bin/ksh        Korn shell                shell : /sbin/sh (다른 shell 을 사

    /usr/bin/csh        C shell                   용할 경우 booting 시 문제가 발
                                                  생할 수도 있다.

   3-4. The /etc/group File

                                                                 group 변경 :
                                                                 newgrp group_name

   Example :
                                                                 find / -name user1

            other::1:root,daemon,uucp,sync                       find / -user | xargs rm
            users::20:                                                     xargs chown user2

   Use /usr/sbin/grpck to check       /etc/group file error check
   User ADD SAM  Account for users and group  user  Menu 이동  action  Add

   3-5. Creating User Accounts with SAM

                                         Add a User Account (na168w3)
HP-UX System & Network Administration I                                                     5

                          Login Name :                               1

                         User ID (UID) :                             3

                       Home Directory :                               Create Home Directory 6

            Primary Group Name … :                                   4

                 Start-Up Program …:                                 7 (shell)

                           Real Name :                               (Optional)

                       Office Location :                             (Optional)
                         Office Phone :                              (Optional)

                         Home Phone :                                (Optional)

            Set Password Options …:

 Super User 의 password 를 잃어 버린 경우
 1. single user mode 로 bootin
 2. # mount –a
 3. # vi /etc/passwd     passwd file 을 수정
 4. reboot or init 3

useradd – u 1045 – g users – d /home/ybnoh – s /usr/bin/ksh – m ybnoh

3-6. Deactivating and Removing Users with SAM

                                      Deactivate a User (r08a6153)
 You have selected user john for deactivation
 User’ s Files and Directories Should Be :

     Left Where They Are        사용자 계정만
     Removed from User’ s Home Directory Only        Home_directory 까지
     Removed from All Local File Systems      File 까지
     Assigned to Another User        File 을 다른 User 에게 Assign

Module 4       Customizing User Accounts
HP-UX System & Network Administration I                                                           6
4-1. Why Customize a User Account ?

   Set the user’ s terminal type.
   Customize the user’ s prompt.
   Set the user’ s default printer.                    변수
   Customize the user’ s PATH variable.
   Define a command line editor.

4-2. Some Sample Customizations

  export TERM=’ vt100’
  export PS1=’ $PWD $’                                      HP-UX 10.20 Super user 는
  export LPDEST=’ laser’                                    recalling 이 안됨
  export PATH=$PATH:/usr/local/bin
  export EDITOR=vi     recalling
  export HISTSIZE=50     recalling 이 저장되는 단위
  export HISTFILE=~/.sh_history       recalling 이 저장되는 File

4-3. What Happens When a User Logs In?

Displays the contents of the /etc/copyright and /etc/motd file.

wall : 접속해 있는 User 들에게 Message 전송

   csh login scripts                   login , passwd          POSIX login scripts

   /etc/csh.login                   System login script        /etc/profile

   $HOME/.login                       local login script       $HOME/.profile        ENV=~/.profile
                                                                                     export ENV

   $HOME/.cshrc                       additional local         $HOME/.kshrc
                                        login script

4-4. What Happens at CDE Login ?
                                                                          CDE 환경 logion 시
                           login,     passwd                                  true 로 설정
HP-UX System & Network Administration I                                                       7

                               $HOME/.dtprofile                DTSOURCEFILE = „true‟

                               CDE home session

Module 5        Guided Tour of the HP-UX File Hierarchy

5-1. Introducing the File System Paradigm

                                  Executables                   Application

Static Files                      Libraries

                                  System startup

                                  Configuration                   Application
Dynamic Files                     Temporary

5-2. The File System Layout

                                                                              Dynamic files

App1                                                    /dev    /mnt
    Static Files              /home

/usr      Sharable operating system commands, libraries, and documentation.
          /usr/bin : general user command
HP-UX System & Network Administration I                                                            8
         /usr/sbin : super user command
/sbin     Minimum commands needed to boot the system and mount other file systems.
/opt      Applications.
/etc      System configuration files. No longer contains executable files.
/dev      Device files.
/var      Dynamic information such as logs and spooler files (previously in /usr).
         mail, unix log file
          /var/adm ; Common administrative files and log files.
         /var/adm/crash ; Kernel crash dumps.
/mnt      Local mounts.
/tmp      Operating System temporary files.
/stand    Kernel and boot loader.
/home     User directories.

5-3. Commands to Help You Navigate

find      Searches the file hierarchy   모든 파일 Search
                                                                   find / -name ybnoh
         find . – name
               -user                                               find / -user ybnoh | xargs rm
               -perm 755                                                           | xargs chown user2
               -size +10000C (10000 byte 초과)
               -atime +30
whereis Locates source, binaries, and man pages         실행 파일의 위치
which     Locates an executable in your PATH      PATH 변수 안에서만
file      Determines file type    ASCII, binary

Module 6        Connecting Peripherals

6-1. The HP9000 Product Family

  Servers Series 800 – Class V, N, K, D
                                                  HP3000 MPE
  Workstation Series 700
                                                  HP9000 HP-UX       800(Server) : Multi-user 용
                                                                    700(Workstation) : Single-user 용
 numbers of CPUs               CPU 수
                                                  Multi-user, Multi-tasking
 processor speed               CPU 속도
                                                  Network OS(NOS) : OS 자체가 protocal 포함
 I/O expandability             확장성
 graphics capabilities         graphic 속도

6-2. Device Adapters
HP-UX System & Network Administration I                                                                    9
SCSI     Small Computer System Interface. There are three SCSI-2 Interfaces available:
         Single-ended, Differential, and Fast and Wide.
         Supports SCSI disks, DDS tape drives, CD-ROM drives,
         MO drives, quarter inch cartridges(QIC), 8mm tapes and IBM 3480-compatible drives.
MUX      Multiplexer. Supports serial terminals, printers, plotters, modems, and Access Port.
LAN/9000          Local Area Network. For IEEE 802.3 and Ethernet networks.
FDDI     Fiber Distributed Data Interface. High-speed local area network

6-3. Types of SCSI

                                            ‘ Standard
                                                                     ‘ Fast’            ‘ Differential-
                                                                  ‘ Fast/Narrow            Wide’
   Other names bus is known by               ‘ SCSI’ ,
                                                                        ’               ‘ F/W-SCSI’
                                            ‘ SCSI-2’
                                                                  ‘ Diff-SCSI’        ‘ Fast and Wide’
                                           ‘ SE-SCSI’
        Compatible with the
                                               NO!                    NO!                      NO!
       other SCSI bus types ?
         Bus Transfer Rate                 5 Mbytes/s             10 Mbytes/s            20 Mbytes/s
           Data Bus Width                     8 bits                 8 bits                16 bits
         # Connector pins                     50 pin                 50 pin                 68 pin
         Max. cable length                   6 meters              25 meters              25 meters
   Maximum Devices on Interface                 7                      7                       15

    Kernel 의 재구성 : Device file 이 Kernel 에 없을 경우
                          Kernel parameter 를 변경하고자 할 때
    OS = Kernel + Shell + 기타 Utility

Module 7         Configuring Device Files

7-1. What Is A Device File ?                                                             disks

                            Device Files
      UNIX                                       /stand/vmunix                    6        5         4
   Commands and

contains software to
operate on filenames
                        contains references includes software to
                        to the software in
                        /stand/vmunix and
                                            operate on hardware                   1 1          tapes

                        address which
                        device to access

7-2. Listing Device Files with   ll /dev
HP-UX System & Network Administration I                                                                       10
Listing device files with        ll /dev

brw-r-----       1   root     sys    31    0x005000       Feb    10    1997    /dev/dsk/c0t5d0
brw-r-----       1   root     sys    31    0x006000       Feb    10    1997    /dev/dsk/c0t6d0
crw-r-----       1   root     sys    31    0x005000       Feb    10    1997    /dev/rdsk/c0t5d0
crw-r-----       1   root     sys    31    0x006000       Feb    10    1997    /dev/rdsk/c0t6d0
crw-r-----       2   root     tty   17     0x000001    Jan       9    09:25    /dev/ttyp1
crw-r-----       2   root     tty   17     0x000002    Mar       9    17:46    /dev/ttyp2

device file type                 major#       minor#                              device file name

 device file type     -     c : character     b : block
 major #     -   kernel 내 driver pointer
 minor #     -   장치 연결 경로

7-3. Listing Device Files with lssf          list special file
# lssf /dev/rdsk/c0t0d0                                                         # - card instance
sdisk card instance 0 SCSI target 0 SCSI LUN 0
                                                                                # - SCSI target
section 0 at address 10/0.0.0 /dev/rdsk/c0t0d0
                                                                                # - internal disk 0
    section 0 : 전체(disk)
                                                                                   array 에서만 유용

7-4. The Layout of        /dev


                     vg00                   dev                                             tty#p#
                                                                                            # card instance
       dsk                rdsk              rmt              ttyxpy           ttydxpx       # port number(MUX)

                                                          Terminals       Modems
         Disk Drives             Tape Drives

7-5. Disk Drive File Names

       SCSI Card
         I=0                        Disk A                 Disk B
HP-UX System & Network Administration I                                                     11

                                       c0t6d0              c0t5d0

                                       c1t6d0              c1t5d0

7-6. Tape Device File Names

/dev/rmt/0m        instance name
        - 0h   high                          - DDS tape 은 0m
        - 0m   middle                        - 0mn      n : no rewind
        - 0l   large

7-7. How Device Files are Creaed                lsdev     : major#를 알수 있다.
                                                장치 device 를 만들 Driver 가 Kernel 에 없을
 Autoconfiguration                              경우 Device file 이 자동 생성이 안됨.
 SAM                                             Device File 생성
 insf                 insf -e                   1. ioscan – 루
                                                2. insf
 mksf                 major#, minor#, type       Kernel 에 driver 가 없는 경우
 mknod                                            /stand/system file 에 추가
                                                           (ioscan 시 나오는 driver)

Module 8        Configuring Disk Device
8-1. Disk Partitioning

 Each HP-UX disk can have one or more partitions                        /home file system
 Each partition can be used for
  -     a file system    data 저장 (newfs)                                 /opt file system
  -     swap space        memory swap (swapon)
  -     raw data                                                         raw oracle data
  -     boot area       (LIF format)
                                                                           swap space

8-2. Whole-Disk Partitioning
HP-UX System & Network Administration I                                                            12
There are five ways to partition a disk using the whole disk approach.

         file system            swap             raw data                   boot disk

                                                                          root file system
                  file system           boot area
                                       file system                       primary swap
정점 : 속도가 빠르다. (약간)
단점 : 1. Disk size 이상의 file system 을 만들지 못한다.
      2. 임의의 size 로 file system 을 만들지 못한다.
      3. file system 이 full 이 났을때 size 를 늘릴수 없다.
      4. 하나의 disk 에 하나의 file system
최대 Disk Size : 10.20 이후 128GB
Boot Disk = boot area + root file system + primary swap (한 disk 에 연속적으로 있어야 한다.)

                                                                                                 file system
8-3. LVM Disk Partitioning                                    logical volume 1                       단위
                                                                           logical volume 2

     Physical      Physical               Volume
                                                                                        volume 2
     Volume 1      Volume 2               Group 00

                                                     logical volume 1                        partition
     Physical             Volume
     Volume 3             Group 01
                                                                               volume 2

                                                            logical volume 2

장점 : 1. physical disk 를 묶어 하나의 volume group 으로 만들수 있다.
      2. 4MB 단위로 file system 을 자를수 있다.
      3. file sytem 이 full 이 났을때 logical volume 으로 할당되지 않은 공간이 있다면
        extend 할 수 있다.

8-4. LVM Device Files
HP-UX System & Network Administration I                                                  13

 dsk                      rdsk               /dev

          c0t5d0                 c0t5d0             group      vg device file

                                                               block lv device files
          c0t6d0                 c0t6d0

 block              character                       rlvol1
                                                               raw lv device files
   pv                 (raw)
                                                    rlvol2            (character)
 device                 pv
  files              device
block device -> buffer 사용 : 데이터 저장형
character device -> serial : 안정성을 고려한 전송

8-5. Creating Physical Volumes

                     PVRA/VGRA              PVRA/VGRA              pvcreate 시

                          BBRA                BBRA

                      c0t3d0                  c0t4d0

                     pvcreate /dev/rdsk/c0t3d0
                                                             일반 file system
                     pvcreate /dev/rdsk/c0t4d0

             boot file system
             pvcreate –B /dev/rdsk/c#t#d#
 LVM Overhead (PVRA, VGRA, BBRA)
 The data structures that are used by LVM consume some overhead feom the disk space. This
overhead is set at a fixed boundary for bootable LVM disks (2912KB), and may vary in size for
non-bootable LVM disks (typically 400KB)

8-6. Creating Volume Groups


    PVRA/VGRA                  PVRA/VGRA
HP-UX System & Network Administration I                                                     14

                                              Create :           mkdir /dev/vg01
                                                         mknod /dev/vg01/group c 64 0x010000
                                                         vgcreate vg01 /dev/dsk/c0t3d0 /dev/dsk/c0t4d0
                                              Check : vgdisplay –v vg01
                                                         pvdisplay –v /dev/dsk/c0t3d0
                                                         pvdisplay –v /dev/dsk/c0t4d0

8-7. Creating Logical Volumes
                  vg01                                                    logical volume
                                                                            name 지정

                                              Create :           lvcreate –L 16 –n myswap
        myfs2                                            lvcreate –L 16 –n myfs1 vg01
                                                         lvcreate –L 16 –n myfs2 vg01
                                              Check : vgdisplay –v vg01
      c0t3d0                    c0t4d0
                                                         lvdisplay –v /dev/vg01/myswap
                                              -I : stripe size
/etc/mnttab : 현재 file system 의    mount 정보
                                              -i : stripes
                                              lvcreate –l 16 –n myswap vg01
                                                         4*16 =64MB

Module 9        File System Concepts

9-1. File System Types

 HP-UX supports several file system types;
    - HFS         High Performance File System
    - JFS         Journaled File System   10.01 부터 사용
    - NFS         Network File System
    - CDFS        CD-ROM File System
 HP-UX file commands work on all HP-UX file system types.

 JFS 장점 : file system recovery 속도가 빠르다.(fsck 수행시)
 /etc/fstab 에서 file system type 확인 가능
9-2. What’ s in a File System ?
HP-UX System & Network Administration I                                                             15
User data = actual data contained files
Metadata = file system structural information
  Superblock           cylinder group 마다 superblock 의 복사본을 가지고 있다. (redundant superblock)
      file system 의 일반적인 정보를 포함하고 있다.
      (file system type, size, status, contains pointers, other file system metadata structures.)
  Inodes        Inode table 의 pointer 를 이용 file‟s data area 내의 pointer 가 가리키는 data 를 가져온다.

        Super group                     Cylinder group
                                                                              inode table
           primary                        inode table
                                                                              file‟s type
        super block
                                         file‟s data area                    permissions
             group 1                       Redundant
           Cylinder                       super block
             group 2
                                                                             15‟s pointer
                                                            실제 data 영역을
                                                            가리키고 있다
9-3. Accessing a File System

            Inode 2                        Inode 100                          Inode 101
           rwxr-xr-x                       rwxr-xr-x                          rwxr-xr-x

                                               
         mydir 100                           f1 101

                                               
       root directory                   mydir directory                         f1 data

  cat /mydir/f1

9-4. HP-UX Hard Links

      Directory /mydir                  Inode Table                    Data Blocks

        f1          101               101 –rwxr-xr-x
        file1       101

                                                           ln /mydir/f1 /mydir/file1

 특징          1. 같은 file system 안에서 link 가 가능
             2. 오직 file 만 link 가 가능
HP-UX System & Network Administration I                                                     16
           3. 원본, 사본의 구분이 없다. (둘다 원본)

9-5. HP-UX Symbolic Links

  Directory /mydir                       Inode Table                    Data Blocks

                                              
      f2          102                102 rwxr-xr-x
      file2       103                103 link to /mydir/f2

                                                           ln –s /mydir/f2 /mydir/file2

 특징        1. 다른 file system 도 link 가능
           2. Directory 도 link 가능
           3. 원본, 사본의 구분이 있다.
           4. file type 이 l 로 표시된다. : symbolic link file

9-6. HFS Structural Overview

   Primary Super block
     File System type and size
     Free resource summary
     Pointers to everything else !

   Cylinder group 0
     Superblock backup
     Free resource summary and maps
     Inode table
             101 wxr-xr-x           user1 pointers
             102 r--r--r--          user2 pointers
             103 r-xr-xr-x          user3 pointers
     Data blocks for files in cylinder group 0

   Additional cylinder groups !

9-7. HFS Blocks
What is an HFS block ?
HP-UX System & Network Administration I                                                           17
  - HFS always reads a block of data at a time
  - Allowed lock sizes : 4KB, 8KB, 16KB, 32KB, 64KB
  - Blocks are not necessarily contiguous
  - Block size is set at file system creation.

Assuming 8-KB blocks,
  - How many accesses are required for an 8-KB read ?
  - How many accesses are required for a 32-KB read ?
  - How many bytes are read if a 1-KB read is requested ?

9-8. HFS Fragments

What is an HFS fragment ?
  - Smallest unit of space HFS can allocate to a file
  - Allowed fragment sizes : entire block, 1/2 block, 1/4 block, 1/8 block
  - Fragment size is set at file system creation
Example :
  How would HFS allocate space for three files of size 8K, 4K, and 3K if:
    Block size = 8K                              Block size = 8K
    Fragment size =8K                            Fragment size = 1K

      8K fragment       8K fragment     8K fragment                   1K fragment   1K fragment   1K

9-9. HFS Implications

HFS Advantages
  Easy to manage
  Fast and efficient
  The only option for the file system containing the kernel
HFS Disadvantages
  Slow and unpredictable crash recovery
  Must be unmounted to extend                         JFS 에서는 장점
  Impossible to reduce

9-10. JFS Structural Overview
HP-UX System & Network Administration I                                   18

   Primary Super block
     File System type and size
     Free resource summary
    Pointers to everything else !
   Intent log    빠른 recovery 가 가능
     Log of “intent” to change file system metadata structures
   Allocation unit 0
     Superblock backup
     Free resource summary and maps
     Inode table
            101 wxr-xr-x user1 pointers
            102 r--r--r--      user2 pointers
            103 r-xr-xr-x user3 pointers
     Data blocks for files in allocation unit 0

   Additional allocation units !

9-11. JFS Implications

JFS Advantages
  - Fast, reliable crash recovery
  - Online resizing         file system 이 mount 되어 있는 상태, Online 이 기본으로
  - Online backups          지원되지 않음, Online JFS product 를 구입해야 한다.
JFS Disadvantages
 - Fragmentation issues
 - “ Online” functionality not included with HP-UX
 - Kernel can’ t be in a JFS file system

     10.1             JFS 에서 resizing 지원 안됨
     10.2 or 10.3
     11.x                 JFS 에서 resizing 지원 가능
                          단, Online 은 Online JFS product 를
                          install 해야 한다.

     fsadm : mount 상태에서 resizing tool <=lvextend>

Module 10 File System Creation
     HP-UX System & Network Administration I                                                              19

     10-1. Overview of File System Creation

         vgdisplay 시 free PE 가 있는지?
                                          Are you using LVM ?
                         Yes                                                    No

            Is space available in a volume group ?                   Is a disk available ?
                                                                  Yes                        No
             Yes                          No
                                                                                       Add a Disk
                                    Add a Disk       pvcreate
            Create a
lvcreate Logical Volume                                         Create a File
                                    Make it a                   System in the
           Create a File         Physical Volume                    Disk
         System in the LV          Add it to a
                                  Volume Group                   Mount the
          Mount the File                                        File System

     10-2. Creating a New File System

     1. Create the new file system
         newfs – F vxfs /dev/vg01/rmyfs1
     2. Create a mount point directory for the file system
         mkdir /myfs1
     3. Mount the new file system
         mount /dev/vg01/myfs1 /myfs1
     4. Add the file system to the /etc/fstab file

     10-3. The newfs Command

     Examples                                                                           실제 사용 가능한
     1. newfs – F vxfs /dev/vg01/rmyfs1                                                  file system size =
                                                                                      (총사용량 – min-free),
     2. newfs – F vxfs – o largefiles /dev/vg01/rmyfs1                               min-free 가 약 10% 정도
                                 file size 를 2GB 를 넘는 128GB 허용                               차지한다.
                                                                                     실제 사용 가능한 용량은
     3. newfs – F hfs /dev/vg01/rmyfs1
                                                                                        전체의 90% 정도
     4. newfs – F hfs – o largefiles /dev/vg01/rmyfs1                                  (min-free default 10%)
     5. newfs – F hfs – b 4096 – f 2048 – m 5 – I 4096 /dev/vg01/rmyfs2

                                                         inode 생성 option(4K 마다 inode 생성(default : 6K)

                                               min-free size 변경(default : 10%)

                                       Fragment size 변경(default : 1K)
                               block size 변경 (default : 8K)
     10-4. Mounting the New File System
HP-UX System & Network Administration I                                           20


            usr      etc    myfs1

              Root File System                       New File System

mkdir /myfs1
mount /dev/vg01/myfs1 /myfs1
mount – v

10-5. The umount command

umount /dev/vg01/myfs1
umount /myfs1

fuser – u    : 사용중인 process 검색
fuser – ku /dev/vg01/myfs1       : 사용중인 process 검색해서 kill

10-6. Automatically Mounting File Systems

 Place an entry in the /etc/fstab file
 File systems will be mounted when the system is booted,
  or you can use mount – a or mountall
 You can mount file systems by absolute directory names.
Sample /etc/fstab:
/dev/vg00/lvol3    /        vxfs    delaylog         0        1
/dev/vg00/lvol1    /stand hfs       defaults         0        1
/dev/vg00/lvol4    /home vxfs       delaylog         0        2
/dev/vg00/lvol5    /opt     vxfs    delaylog         0        2
/dev/vg00/lvol6    /tmp     vxfs    delaylog         0        2
  file system      directory F/S type   rw,suid       무조건 0     fsck 시 check 순서
                                                  (예비용 field) 낮은 순서부터 0 제외
mount – a          : /etc/fstab 참조
umount – a         : /etc/mnttab 참조

10-7. CD-ROM File Systems (CDFS)
HP-UX System & Network Administration I                                                     21
 - Allows mass distribution and easy retrieval of large amounts of information
 - You can read data from a CD, but you cannot write to it.
 - To use CDFS volumes;
  1. Configure the appropriate driver into the kernel.
  2. Create the device files (if necessary).
  3. Mount the CDFS volume with the mount command.                   HP system 외 다른 vendor 의
 - CDFS Examples;                                                       CD-ROM 은 mount 시에
  1. LaserRom Manual                                                  option 을 적어주어야 한다.
  2. Application CD

                                            /etc/fstab 에 추가해서 booting 시에 Automount 시키려면         항
 CD-ROM mount 절차                                              상 CD 가 들어 있어야 한다.
1. # ioscan – unfC disk                            /dev/dsk/c1t3d0  /cdrom cdfs ro 0   0
                                                       현실적으로 사용하기가 불편함 read only
2. # mkdir /cdrom
3. # mount /dev/dsk/c1t3d0 /cdrom

 File System Create
                                                   File System Remove
# pvcreate /dev/rdsk/c0t5d0
# mkdir /dev/vg01
                                                  # lvremove /dev/vg01/lvol1
# mknod /dev/vg01/group c 64 0x010000
                                                  # vgremove /dev/vg01
# vgcreate vg01 /dev/dsk/c0t5d0
                                                  # pvcreate –fv
# lvcreate –L 12 –n lvol1 vg01
                                                    강제로 pvcreate 할수 있다.
# newfs –F hfs /dev/vg01/rlvol1
                                                    (지우는 과정이 생략)
# mkdir /data
# mount /dev/vg01/lvol1 /data

Module 11 File System Repair

11-1. File System Maintenance

 Routine Maintenance
  -   Check file system integrity   fsck
  -   Employ regular backup procedures
  -   Monitor disk usage    bdf

11-2. Flushing the Buffer Cache
         Buffer cache 의 내용을 Disk 로 Write                  1. System 종료시 발생
                                                          2. System Command 시
                                                          3. File System 을 umount 시
HP-UX System & Network Administration I                                           22
  Writes buffer contents to disk
  Keeps the file system current
  Is normally invoked on a regular basis by the syncer daemon

syncer(1m) daemon
  syncer is started automatically at system boot.
  The syntax of the syncer program is :
           syncer [seconds]

Question : What might prevent syncer from properly flshing the buffer cache ?

11-3. Introducing fsck
                          현재의 Disk 상태와 super block 을 비교
Why run fsck ?
  Checks file system metadata consistency
  Repairs metadata corruption as needed

When should fsck be run ?
  Runs automatically after improper shutdown
  Run manually whenever corruption is suspected

11-4. Running fsck

Example : Running fsck on /dev/vg01/myfs2
1. mount – v        현재 mount 되어 있는 File System 정보 표시
2. umount /dev/vg01/myfs2
3. fsck – F hfs /dev/vg01/rmyfs2
4. mount /dev/vg01/myfs2
5. Restore any corrupted files ;
                                                    vgremove        pvcreate -f
      Did fsck remove any files ?
      Did fsck reconnect any files ?

Some General fsck Options
 -y                 repair, super block 의 정보에 맞춰서…
Some Special HFS fsck Options
 -b block#          newfs 시에 표시됨, /var/adm/sbtab 의 정보를 이용, /etc/sbtab
 -f                 강제 forces
11-5. Checking lost+found       umount 되어 있는 directory 에 존재


           myfs1                       myfs2
HP-UX System & Network Administration I                                                    23

 Exists in every file system
 Orphaned files copied to this directory by fsck            재생성 : /usr/sbin/mklost+found
 Should be checked after every fsck

Module 12 File System Management

12-1. Monitoring Disk Usage

Monitor available file system space with bdf :       -i option ; iused, ifree, iuse
Filesystem            kbytes       used     avail   %used     Mounted on
/dev/vg00/lvol5      294912                261523    31352     89%       /opt
/dev/vg00/lvol4     24576          19333    4978     80%       /home
/dev/vg01/myfs1      16384         1174    14331     8%       /myfs1
/dev/vg01/myfs2      15893     14006        297     98%       /myfs2

Determine space used by directory subtrees with du :
# du – sk /myfs2/*
844       /myfs2/data1
1327      /myfs2/data2
1073      /myfs2/data3
10757     /myfs2/data4
4         /myfs2/lost+found

12-2. Routine Management
 Trim log files that grow without bound ;      wtmp, btmp, sulog
 Remove core files
 Remove large, old files
 Extend a file system
    -   into existing free space
    -   onto a new disk in the volume group

성공적인 login          : /var/adm/wtmp last
HP-UX System & Network Administration I                                               24
실패한 login          : /var/adm/btmp lastb
sulog    : /var/adm/sulog

# find / -name core – exec ll {} \; # list all core files
# find / -name core – exec rm {} \;            # remove all core files
# find /tmp – atime +30 – size +1000c – exec ll – ud {} \;
                                         1000 byte 이상
                        30 일 이상

12-3. Extending a Volume Group                       vg01


                                                          c0t3d0            c0t5d0
pvcreate /dev/rdsk/c0t5d0
vgextend vg01 /dev/rdsk/c0t5d0
vgdisplay -v
                                           After          myfs1

                                                            c0t3d0          c0t4d0

12-4. Extending a Logical Volume
                                            Before             myswap
                                                      16M       myfs2
                                                                   c0t3d0    c0t4d0
lvextend – L 32 /dev/vg01/myfs2 /dev/dsk/c0t3d0vg01
lvdisplay – v /dev/vg01/myfs2

                                                      32M       myfs2
                                                                   c0t3d0    c0t4d0
12-5. Extending a File System                                   c0t5d0
HP-UX System & Network Administration I                                                           25

            Before                                    After

                     myswap                                   myswap
                     myfs1                                    myfs1
                     myfs2             16MB File              myfs2       32MB File
                                        System                             System

# umount /myfs2
# extendfs /dev/vg01/rmyfs2
# mount /myfs2
# bdf

12-6. Summary of LVM Commands

extends              Extend an off-line file system
lvchange Changes the characteristics of a logical volume
lvcreate             Creates a logical volume in a volume group
lvdisplay Displays information abort logical volume
lvextend Increases the number of physical extents allocated to a logical volume
lvlnboot             Prepares a logical volume to be a root, swap or dump volume
lvmerge              Merges previously mirrored volumes into one logical mirrored volume
lvreduce Decreases the number of physical extents allocated to a logical volume
lvremove Removes one or more logical volumes from a volume group
lvrmboot Removes a logical volume link to root, swap or dump volume
lvsplit              Splits a mirrored logical volume into two logical volumes
lvsync               Synchronizes logical volume mirrors that are stale in one or more logical volume
pvchange             Changes the characteristics of a physical volume in a volume group
pvcreate Creates a physical volume that can be used as part of a volume group
pvdisplay            Displays information about one or more physical volumes within a volume group
pvmove Moves allocated physical extents from one physical volume to another
vgcfgbackup          Saves LVM configuration for volume group
vgcfgrestore         Restores LVM configuration onto the volume group
vgchange             Sets the status of a volume group to on or off
vgcreate Creates a volume group
vgdisplay            Displays information about volume groups
vgextend Extends a volume group by adding physical volumes to it
HP-UX System & Network Administration I                                                        26
vgexport           Exports a volume group from a system
vgimport Import a volume group onto the system
vgscan             Scans the sysetm’ s physical volumes for volume groups
vgreduceRemoves a volume group by removing one or more physical volumes from it
vgremove           Removes the definition of one or more volume groups from the system
vgsync             Synchronizes logical volume mirrors that are stale in one or more volume group

Module 13 System Backup

13-1. Why Back Up?

How Much Data Can You Afford To Lose?
Data is sometimes lost by;
 - File system corruption
 - Accidential removal fo files
 - Hardware failures
 - System crash
Regular backups;
 - Minimize data loss
 - Keep users happy
 - Provide stability and order

13-2. What Do You Back Up?

- Backup the entire file system (full backup)
- Backup part of the file system
  -   Files that have changed since the last backup (incremental or delta backups)
  -   A subtree of the file system
  -   Application data
  -   User’ s files
- Backup the database configuration
- Backup the LVM configuration

tar cvf /dev/rmt/0m 대상            backup
tar xvf /dev/rmt/0m 대상            restore
tar tvf /dev/rmt/0m > tarlist      backup list

13-3. How Do You Perform the Backup?
HP-UX System & Network Administration I                                              27
- fbackup/frecover are the most flexible standard HP-UX backup utilities.
- Other utilities are available as well.

13-4. Using fbackup

Backing up a single Directory or File
  fbackup – f /dev/rmt/0m – i /home – I index.home
  fbackup – f /dev/rmt/0m – i .            -I index.pwd

Full ans Incremental Backups
  cd /var/adm/fbackupfiles
  vi graph
      i /
      e /cdrom
  fbackup – f /dev/rmt/0m – u0g graph – I index.full
  fbackup – f /dev/rmt/0m – u1g graph – I index.incremental

fbackup options
-f device          the device to which output will be sent
[ -0-9 ]           backup level – default is 0
[ -u ]             update /var/adm/fbackupfiles/dates file (only if used with – g)
[ -i path ]        include path (file or directory) in the backup
[ -e path ]        exclude path (file or directory) from the backup
[ -g graph ]       file that contains a list of files and directories
                   to be included or excluded from the backup
[ -I path ]        write an index to file path

13-5. Using frecover

Restoring Files and Directories
  frecover – f /dev/rmt/0m – rv
  frecover – f /dev/rmt/0m – i /home/user1 – xv
  frecover – f /dev/rmt/0m – i /home/user2 – xv

Extracting an Index
  frecover – f /dev/rmt/0m – I index
HP-UX System & Network Administration I                                             28
                                  tar 명령의 tvf 와 동일

13-6. Network Backup and Recovery

             minnie                    mickie                     donald   tape

donald # vi ~root/.rhosts

mickie # fbackup – f donald:/dev/rmt/0m – u0g graph – I index
minnie # fbackup – f donald:/dev/rmt/0m – u0g graph – I index

mickie # frecover – f donald:/dev/rmt/0m – rv
minnie # frecover – f donald:/dev/rmt/0m – rv

13-7. Being Prepared with make_recovery

                System Recovery
                   Boot Tape
                                                Boot LIF Area
        The “System Recovery Boot                    /usr
        Tape” can be used to recover                  
        from any disk failure in vg00

13-8. Creating a Recovery Tape

                Boot Area

                                                Recovery Tape
                                                  List of files
                                            on Recovery Tape 6
                                           makerec.last Log File
Create a recovery tape and log file
                – C
# make_recoveryvg00                       check_recovery 시에 필요한 log 를 남긴다.
                                           /var/opt/ignite/recovery/makerec.last
HP-UX System & Network Administration I                                      29
13-9. Updating the Recovery Tape

              Boot Area
                                                      List of files
                                                 on Recovery Tape
                                                makerec.last Log File



Compare current OS files to recovery tape;
# check_recovery

Module 14 Scheduling cron Jobs

14-1. The cron Daemon

- Executes commands at specified dates and times
- Automates routine tasks
- Examples;
    -   Trimming system log files
    -   Performing system backups
    -   Generating weekly reports

14-2. cronfile
- cronfile contains one line for each schedule job.
- Example;

분        시간           일      월       요일      수행 할 작업

# min     hour        date   month   day      command
# 0-59 0-23           1-31   1-12    0-6      must redirect output!
    0     *           *      *       *        /usr/bin/date > /dev/console
    0     6           1,15   *       *        > /var/adm/btmp
    0     5           *      *       1-5      /usr/bin/who | /usr/bin/lp
                                             월요일부터 금요일까지

                             1 일에서 15 일까지

14-3. Managing cronfile with crontab
HP-UX System & Network Administration I                                                     30
- Edit and submit a cronfile ;
  crontab – e

- View your cronfile ;
  crontab – l

- Remove all your scheduled cron jobs ;
  crontab – r

14-4. What Happens When a Job is Scheduled ?                   /var/adm/cron/cron.allow
                                                                 cron.allow 에 user name 을
                                     /var                          등록하면 일반 user 도 cron 에
                                                                   작업을 올릴수 있다.
                  adm                             spool

                  cron                             cron

   cron.allow            cron.deny              crontabs

                                        user2     user2    user2

Module 15    Managing Swap Space

15-1. System Memory

          Page                                             Avilable
          (4Kb)                                            Memory

                       HP-UX                                          Memory

15-2. What is Swap Space ?

            Process                                        D
HP-UX System & Network Administration I                                                       31

                                                                              statedaemon :
                                                                              Memoty 상태 감시

15-3. Types of Swap Space

                          Primary Swap

     LVM structure                               / file system
       file system
        swap lvol                                  swap area
                                                                           data 저장과 swap 을
       LVM root disk                        “Whole Disk” approach
                                                                               동시에 사용
                        Secondary Swap

                         File System Swap
     LVM structure                                file system
       file system          Device Swap
        swap lvol                                  swap area

         LVM                                  “Whole Disk” approach

15-4. Enabling Swap from the Command Line

Examples ;                           Explanations ;
 swapon /dev/vg01/myswap                   swap on a logical volume
 swapon /dev/dsk/c0t2d0                   swap on a whole disk
 swapon –p 4 –l 4M /myfs2                 swap on a file system
 swapon -a                                Enable all swap entries in /etc/fstab

SAM can help !
15-5. Enabling Swap via /etc/fstab
HP-UX System & Network Administration I                                                      32
Swap areas listed in /etc/fstab are automatically enabled at system boot.
         /dev/vg01/myfs1               /myfs1   vxfs     delaylog         0   2
         /dev/vg01/myfs2               /myfs2   hfs      defaults         0   2
         /dev/vg01/myswap               .       swap     defaults         0   0    swap 은 file system
         /dev/dsk/c0t2d0                .       swap     defaults         0   0    check 하지 않는다.
         .                             /myfs2   swapfs pri=4, lim=4M      0   0
                                                       file system type
Explanations ;
         Swap on a logical volume
         Swap on a whole disk
         Swap on a file system

15-6. Monitoring Swap Space Usage

Examples ;
   swapinfo – f
   swapinfo – d
   swapinfo – tm
Explanations ;
    Report usage of all swap areas
    Only list file system swap areas
    Only list device swap areas
    Report values in megabytes, with a total line

15-7. Guidelines for Selecting Device Swap Areas

 Two swap areas on different physical disks are better than one single swap area
 Only one swap partition (logical volume or reserved space) per disk
 Device swap areas should be of similar size
 Consider the speed of the disks

             swap              swap                     swap              swap
                      yes                                           no

15-8. Guidelines for Selecting File System Swap Areas
HP-UX System & Network Administration I                                                   33
 Avoid using busy file systems such as the root file system
 Use bdf to check file system space availability
 Set priorities appropriately
  -     Faster devices over slower devices
  -     Infrequently-used file systems over busier file systems
 It is preferable to enable swap on file systems that are located on separate disks or,
  in the case of LVM, separate physical volumes.

Module 16 Printer Management

16-1. Types of Printers


             Printer1       host1                                 Printer2


16-2. Adding Local Printers Using SAM

                          Printer Name :        spark

             Printer Model/Interface …          deskjet12000

                          Printer Name :        room608                      (optional)

              Default Request Priority :        0

       Make This Printer the Default Destination

           OK                              Cancel                                Help

16-3. Adding a Remote Printer Using SAM
HP-UX System & Network Administration I                                       34

                         Printer Name :        lj153

                Remote System Name :           r08a6153

                Remote Printer Name :          1

    Remote Printer is on a BSD System

         Remote Cancel Model …                 rcmodel

         Remote Status Model …                 rcmodel

              Default Request Priority :       0

    Allow Anyone to Cancel a Request

    Make This Printer the Default Destination

        OK                                 Cancel               Help

16-4. Adding a Network-based Printer

                        HP JetAdmin Utility for UNIX
                                                                     H/W 인식
  Printer Network Interface
        1) Create printer cofiguration in BOOT/TFTP database
        2) Remove printer configuration from BOOT/TFTP
  Spooler :                                                    등 록
        3) Add printer to local spooler
        4) Delete printer from local spooler
        5) Modify existing spooler queue(s)
                           ?) Help                  q) Quit

JetAdmin Utility : printer setting 시 반드시 필요
 Printer 설치 & Driver 설치
 # lpshut        lpsched daemon 죽임
 # lpadmin -p laser2 -v /dev -n /usr/lib/lp/model/dumb
 # accept laser2
 # enable laser2
 # lpadmin -d laser2 (option)                 Printer 를 사용할수 없다
 # lpsched        default 지정      disable

16-5. Managing Print Queues
HP-UX System & Network Administration I                                                    35
Accept / Reject
# reject – r “ Sparky is down. Use the destination lj” sparky
# accept sparky                      reject 이유, lp 명령 사용시 보임

Enable / Disable
# disable sparky
# enable sparky

Moving Request
# lpshut                    Must stop the schedules before lpmoveing requests
# lpmove sparky lj          Move all requests from sparky to lj

# lpmove sparky-123 lj      Move only one request to lj

# lpsched                   Restart the scheduler
# lpalt sparky-123 – d lj   Move only one request. This can be used bye an ordinary user

# cancel sparky-123         Cancel request sparky-123
# cancel sparky             Cancel current request printing on sparky(현재 출력중인 것을 중단)

Display Status
# lpstat – t
scheduler is running           lpsched daemon 동작중
system default destination : lj
device for lj : /dev/null
    remote to : lj_ld on hpsfecid
device for sparky : /dev/c1t0d0_lp
sparky accepting requests since Dec 19 08:18
lj accepting requests since Dec 19 08:18
printer sparky disabled since Dec 19 10:47 –
            reason unknow
            fence priority : 0
printer lj is idle. enabled since Dec 19 08:54
            fence priority : 0
sparky-18             root     priority 0 Dec 19 10:47
            hosts                         37410 bytes
printer queue for lj
no entries

16-6. Priorities and Fences
HP-UX System & Network Administration I                                                        36

Fence Priority
# lpfence sparky 5                  Set the fence priority to 5
                            lp fence 설정, priority 5 이상으로 출력 가능
# lp – p5 – d sparky myfile                  Jump the fence with this request
                 priority 를 5 로 해서 출력
# lpalt sparky-123 – p5             Allow one request to print
                               priority 를 5 로 변경
# lpfence sparky 0                  Lower the fence and allow other requests to print

16-7. Troubleshooting the Spooler

Potential Spooler Problems ;       rm –f /var/spool/lp/SCHEDLOCK                 lpsched daemon 이
 Spooler won’ t start                                                            떠 있을 경우 존재
 Scheduler won’ t stop              - lpsched daemon 이 죽으면 SCHEDLOCK file 이 삭제된다
 Paper jam/printer out of paper     - lpshut : lpsched daemon down
 Runaway printout
 Printer won’ t print

Module 17 Shutdown and Reboot

17-1. HP-UX Operation States                   Run-Level
                                               S,s , 0 , 1 , 2 , 3 , 4 , 5 , 6
Multi-user mode
                                                           Multi-user mode
  Normal machine state
                                                Level 3 : default run level
  Users can log in
  File systems mounted
                                                NFS 는 level 3 에서 Daemon 이 Startup 된다.
  Most services plus daemons available
                                                # init #      run-level 변경

Single-user mode
  Required for some admin tasks
  Only root login allowed   console 에서만 가능
  Non-critical file systems unmounted
  Non-critical daemons shut down

Halt state
  Nothing running

17-2. Changing State with Shutdown and Reboot
HP-UX System & Network Administration I                                                                                   37

                                       Multi-user Mode                                           Level 2 이상


                                                                                   shutdown -h
            shutdown -r

                                      Single-user Mode                                           Level s,0,1

                                                          reboot -h

                                                                                                   telnetd  sh  ps –f

                                                                      Halt State                      Multi  Single

                                                                                                      1. shutdown
                                                                                                      2. init
                                                                                                      3. manual boot
                                                                                                   shutdown = single user mode 로
 안정성은 shutdown 이 reboot 보다 좋다.                                                                     reboot = reboot –r

 Multi-user mode 에서는 반드시 shutdown 으로 종료
  /etc/shutdown.allow 에 등록이 되어 있으면 일반 user 도 shutdown 할수 있다.
  SAM – r            :    user 에게 SAM 의 사용 권한을 할당. /usr/sbin

  kill –9    reboot                Daemon 을 한번에 종료시킴
  kill –15 shutdown                Daemon 을 차례로 종료시킴.

17-3. System Boot Introduction

  Load Kernel in memory.
  Bring system up to a fully functional state.

                          boot area


                          Boot Disk                                                     SPU

17-4. System Boot Players
HP-UX System & Network Administration I                                                         38

                                                           boot area         Boot area
                                                                             File system
                                                        /stand/vmunix        containin the kernel
                                                             swap            Primary swap

                    SPU                                   Boot Disk

                Boot Area <LIF>

BootROM  PDC  ISL  hpux  kernel load
                       utility 실행
               code 실행 : Boot disk 확인file system

ISL : Auto file road   hpux (;0) /stand/vmunix

17-5. System Boot Process Overview
                 Test SPU.
                 Choose a boot disk using h/w paths in stable storage
                 Load and run ISL Utility from boot area in boot disk.
    System Road Auto file from boot disk for kernel load options.
           Load and run hpux utility from boot area in boot disk.              hpux (;0) /stand/vmunix
           Find root file system on boot disk.
           Load and run kernel from boot disk.
                 Uses “init” to start all necessary daemons and services.
                 Bring system to multi-user mode.

Manual boot : console 상에서만 가능, boot disk 와 kernel 을 선택할 수 있다.
Boot_Admin > search          H/W path 검색
Boot_Admin > boot p1
                                                                            Auto Boot
Interact with IPL(y/n)   y
ISL> hpux (;0) /stand/vmunix      default 이기 때문에 생략 가능

17-6. Autoboot versus Manual boot
HP-UX System & Network Administration I                                                       39
  System boots without admin intervention
  Uses default boot disk kernel
  Normal mode of operation
What if …
  The primary boot disk is damaged ?
                                                     # lifls   /dev/dsk/c0t6d0
  The default kernel is unbootable ?
                                                               boot 영역의 내용을 확인
  The root password has been lost ?
                                                     # lifcp   /dev/dsk/c0t6d0:AUTO /myauto

A manual boot may bo required !

17-7. Interacting with the ISL

Getting to the ISL
menu choice : a                                 # some models go straight to BOOT_ADMIN
BOOT_ADMIN> boot pri isl               # use “ isl”
Interact with IPL ? Yes                         # some models go straight to ISL

Useful ISL commands
ISL> help                                       #   list available commands
ISL> hpux                                       #   boot from default kernel
ISL> hpux – is                                  #   boot to single-user mode
ISL> hpux ls                                    #   list contents of /stand
ISL> hpux – is /stand/vmunix.prev               #   boot using an alternate kernel
ISL> hpux show autofile                         #   show the LIF AUTO file contents

17-8. What Happens after the Kernel Is Loaded ?

            Kernel loaded

            Swapper process is started PID=0

            Kernel runs /sbin/pre_init_rc                          root file system fsck 수행
            Kernel spawns /sbin/init                               PID=1
            /sbin/init reads /etc/inittab and spawns :
                      bcheckrc                                     나머지 File System 에
                      getty                                           대해서 fsck 수행


17-9. Run Levels and init
HP-UX System & Network Administration I                                                             40
Init starts services in stages (run levels)
  Possible run levels        = 0, s, 1, 2, 3, 4, 5, 6
  Lower run levels           = few services available
  Higher run levels          = more services available
Simplified example :
       Run level :                Services available :
           3            syncer, apooler, CDE, NFS                        CDE : Graphic Windows 환경
           2            syncer, spooler, multi-user, network
           1            syncer

17-10. Changing Run Levels with init

Viewing the current run level
# who – r
. Run-level 3 Dec 1 12:13             3    0   S
                                               previous run level
                                               # times at this level since boot
                                               current run level
                                               when this level was entered
                                               current run level
Changing run levels
# init 4         # moves up to run level 4
# init 2         # moves down to run level 2
# init 3         # moves backup up to run level 3

17-11. Configuring init via /etc/inittab

Sample inittab file
### change the default run level here

### pre-configured lines required for boot – don’ t change !
ioin::sysinit:/sbin/ioinitrc                    # scan h/w and create dev files
muxi::sysinit:/sbin/dasetup          # initialize console mux
stty::sysinit:/sbin/stty 9600        # set console baud rate, etc.
brcl::bootwait:/sbin/bcheckrc                   # run fsck on file system
cprt::bootwait:/sbin/cat /etc/copyright         # display copyright
           모든 run level 실행
### these lines display login prompts
cons:123456:respawn:/usr/sbin/getty console              # login prompt on console
t0p1:234:respawn:/usr/sbin/getty – h tty0p1 H            # login prompt for tty0p1
t0p2:234:respawn:/usr/sbin/getty – h tty0p2 H            # login prompt for tty0p2
                                     terminal 에 login prompt 를 계속 띄워준다.
(Note : some arguments are truncated from commands to fit on slide.)
HP-UX System & Network Administration I                                       41

Run-level          실행 run-level 을 결정
Action             initdefault:       Defines the default system run level.
                   boot,              Execute only during the boot process.
                   bootwait,          booting 할때만 수행
                   wait:              이 process 가 끝나야 다음 수행.
                   respawn:           process 가 죽으면 다시 process 를 띄운다.

         rc2.d     S 로 시작하는 것 실행
         rc3.d     dtlogin.rc  CDE 환경
         rc0.d     S                  rc2.d     K
         rc1.d     S                  rc1.d     K
         rc2.d     S
         rc3.d     S

run-level 을 내릴때에는 rc#.d 의 K 로 시작하는 script 수행
                                      현재 level – 1 부터 rc0.d 까지 모두 수행
run-level 을 올릴때에는 rc#.d 의 S 로 시작하는 script 수행
                                      현재 level +1 부터 올릴려는 level 까지 모두 수행

/etc/rc.config.d   Daemon 실행 script
                   환경 file 의 변수를 1 에서 다른것으로 바꾸면 수행 안됨.

   startup 시           nfs_server   start_msg
                       nfs_server   start
   stop 시              nfs_server   stop_msg
                       nfs_server   stop
HP-UX System & Network Administration I                                             42
Module 18 Reconfiguring the Kernel

18-1. Why Reconfigure the Kernel ?

Reasons for reconfiguring :
  To add or remove device drivers
  To add or remove subsystems
  To modify system parameters
Methods for reconfiguring
  HP-UX commands

18-2. Static Kernel Modules

              vmunix                       vmunix            Recompile a new
                                                      tape   kernel with a tape
                                         vmunix       tape
                            Reboot !

          vmunix     tape
                                         vmunix       tape   New Kernel and
                                                             driver are loaded in
              Memory                                         memory ater reboot.
18-3. Dynamic Kernel Modules

                            Reboot !

              vmunix                                         New driver loaded in
          d                                vmunix            memory without

18-4. Moving the New Kernel into Place
HP-UX System & Network Administration I                                                 43



         vmunix_test                   vmunix           vmunix_test

         dlkm.vmunix_test              dlkm             dlkm.vmunix_test

         system.sam                    system           system.sam

Module 19 Managing Software with SD-UX

19-1. Introducing SD-UX

Managing Software On Your Local Host
 Installing Software
 Copying Software
 Removing Unwanted Software
 Listing Software
 Verifying Installations
 Packaging Software
 Configuring Software

19-2. SD-UX Software Structure


        Product A                                                        Product B

              fileset                                  fileset
                                 Sub Product 1                                fileset
                                 Sub Product 2
              fileset                                  fileset

19-3. SD-UX Software Depots
HP-UX System & Network Administration I                                                       44



                                         System                         m

19-4. The SD-UX IPD

               swinstall                               swremove

                    Accounting                B.10.20
                    AdvJournalFS              B.10.20
                    AudioSubsystem            B.10.20
                    CDE                       B.10.20
                    DiskQuota                 B.10.20
                    International             B.10.20
                    InternetSrvcs             B.10.20
                    JournalFS                 B.10.20
                    Keyshell                  B.10.20
                    LVM                       B.10.20
 Maintained by SD-UX utilities
 Records installed software

19-5. SD-UX Daemon / Agents

        Process            Description

    swagentd               Listens for requests, then schedules a “ swagent” to do the work
                           Initiates communication between the target and the source
                           There must be one swagentd running on the system
                           to use “ SD-UX” commands

     swagent               Performs software management tasks
                           Started as needed bye “ swagentd”

# /sbin/init.d/swagentd start                     # start it
# ps – ef | grep swagentd                         # check it

19-6. swinstall
HP-UX System & Network Administration I                                                                  45


# swinstall    -s /dev/rmt/0m                     # from a local tape depot
# swinstall    -s /var/spool/sw                   # from a local directory depot
# swinstall    -s /cdrom                          # from a CD mounted on /cdrom
# swinstall    -s depothost:/mnt/mydepot          # from a network depot

19-7. Selecting Software to Install

1. Select a product/bundle/fileset with the space bar (TUI) or mouse (GUI).
2. Select Actions Show Description of Software to view a software description
3. Select Actions Mark for Install
4. To meet dependencies, swinstall may automatically select additional filesets.
5. Repeat steps 1-4 to select additional software.
6. Select Actions  Install (Analysis) to install the selected software.
/var/adm/sw/swinstall.log         Install / Update Log
19-8. Listing Software

                Depot                        Products

 List Installed software
 List software in a depot

  swlist                                          Lists the software installed on your local system
  swlist – d    @     /my     depot               Lists the software in the depot /mydepot
  swlist – l   depot      @    r08a6153 Lists the depots on the host r08a613
  swlist – l   file   LVM                         Lists all the files that are part of the LVM product
  swlist – I                                      Interactively list software installed on your local
  swlist – i   – d    @     /var/depot            Interactively list software in the depot at location
19-9. SD-UX command Summary

SD-UX Command Purpose
HP-UX System & Network Administration I                                                           46

swinstall            Install software
swremove                      Remove software
swpackage                     package software into a depot
swcopy                        Copy software from one depot to another
swlist                        List software in a depot or installed on a system
swreg                         Make a depot visible to other systems
swverify                      Verifies the integrity of installed software and depot software
swconfig             Configures and unconfigures installed software
swacl                         Change access to SD-UX software objects
swagentd                      Distribution daemon

Module 20      Patch Management (SD-UX)

20-1. Why Install Patches?

 New functionality
 New hardware support
 Bug fixes

20-2. Patch Naming Conventions

Patch Name Format is : PHxx_yyyy
where :
    PH       = Patch HP-UX
    xx      = area patched.
              CO – general HP-UX commands.
              KL – kernel patchs.
            NE – network specific patches.
            SS – all other subsystems : X11, Starbase, etc.
    yyyy = a unique number

Example : PHSS_4014 – an HP-UX subsystem patch name.

20-3. Obtaining Patches
 HP Electronic Support Center (ESC)                           # (Americas and Asia- Pacific)
                                               http:// europe –support .external.hp.com
                                                              # (Europe, Africa, and the Middle East)
HP-UX System & Network Administration I                                                          47
     -     individual patches
     -     custom patch manager
 The Extension Software (XSW) CD-ROM
 HP Enterprise Response Centers
     -     custom patch tapes

20-4. Retrieving Patches from the Web Patch Database



                           PHKL_6681 shar archive
1        Back up system
2        Download patch from the ESC web site to /tmp
3        cd /tmp
4        sh PHKL_6681
5        more PHKL_6681.text
6        swinstall – s PHKL_6681.depot

20-5. Retrieving Patches from Tape or CD

                                                 1. Do a full backup.
                                                 2. mkdir /patchCD
                                                 3. mount /dev/dsk/c#t#d# /patchCD
          S/W Extension CD
                                                 4. swinstall –s /patchCD

                                                 1. Do a full backup.
                                                 2. swinstall –s /dev/rmt/0m
            Depot Format
              Patch Tape

20-6. Installing Patches with swinstall

    The 11.x example below installs all the               The next example installs all applicable
    critical patchs from the named depot :                patches on a 10.x machine.
    # swinstall –s depot_name \                           # swinstall –s depot_name \
                 -x auto_reboot=true \                                -x auto_reboot=true \
                 -x patch_match_target=true \                         -x match_target=true
                 -x patch_filter=‟*.*, c=critical‟

20.7. Listing Patches
HP-UX System & Network Administration I                                                               48
         swlist – l patch ‘ *.*, c=patch’
         swlist – l product PH*

To following is sample output :
         # Initializing …
         # Contacting target “ servell” …
         # Target : servell : /
         # PHCO_12772.ADMN-ENG-A-MAN                          HPAutoRaid Utilities Manual Pages applied
         # PHCO_12772.ARRAY-MGMT                              HPAutoRaid Utilitirt.C-INC applied
         # PHKL_13052.CORE-KRN                  OS-Core.CORE-KRN applied
         # PHKL_13052.CORE2-KRN                               OS-Core.CORE2-KRN applied

20-8. Removing Patches

                   11.0           Before              after          11.0
                  Target                                            Target
                 System                                            System
                 Product          swremove PHKL_1234               Product

                                        Saved Files

Module 21 Connecting to a Network

21-1. Setting an IP Address and Subnet Mask                     IP address
                                                                   Assigned to each network node
                                                                     -   Must be unique
                                                                     -   Define via SAM or set_parms
set_parms <argument>

21-2 Setting a Default Route
HP-UX System & Network Administration I                          49

                                   The        Internet-Other


 Hosts can locally deliver data to nodes on own LAN
 Route is required to route data to other LANs
 Defined via SAM or set_parms

# set_prams initial
# sam  Networking & Communications  Hosts  Local Hosts File
       Actions  Configure Default Gateway
21-3. Setting a System Hostname

  Mnemonic name assigned to each node
  Can be based on
  -   Purpose of node
  -   Primary users of node
  -   Any other naming convention
 Defined via set_parms

# set_parms initial
# sam  Networking & Communications  Lan Interface Cards
       Actions  Modify System Name
21-4. Resolving Hostnames to IP Address

            telnet mickie
            ftp minnie

 Every outgoing packet requires an IP
 Three ways to resolve hostnames to IP addresses
  -   /etc/hosts file
  -   Domain Name Service (DNS)
HP-UX System & Network Administration I                                              50
  -    Network Information Service (NIS)

/sbin/init.d/net stop          read
/sbin/init.d/net start                              /etc/rc.config.d/netconf

21-5. Configuring /etc/hosts

Sample /etc/hosts :
                        mickie mailsvr

 Maps : IP addresses  hostnames
 Maintained on each individual host
 Usually used to resolve hostnames on small LANs
 Define via SAM or copy from another host

# sam  Networking and Communications  hosts  Local Hosts File
Actions  Add/Modify/Remove
21-6. Configuring a DNS Client

                                       www.acme.com ?
                                                                   DNS name server

                            www.hp.com ?


 Used to resolve hostnames on larger networks
 Clients request lookups from DNS servers
 To prevent duplicate names, each host assigned to a “ domain”
 Must define the following via SAM or set_parms
  -    Your DNS server address
  -    Your DNS “ domain” name

# sam  DNS (BIND)  DNS Resolver
      Actions  Specify Name Servers
21-7. Configuring a DNS Client


HP-UX System & Network Administration I                            51

Q : Where do I look up hostnames ?
A : Consult /etc/nsswitch.conf

21-8. Trobleshooting Tools

Check connectivity
   # ping              ping : 물리적연결 + Network 구성 Check
   # ping
Check hostname resolution
   # nslookup minnie             linkloop MAC : 물리적 연결
   # nslookup donald

제 1 일차

** User Account 등록 절차

1. /etc/passwd file 에 user 계정 등록
     echo ybn::1045:20::/home/ybn:/usr/bin/sh >> /etc/passwd
2. User home directory 생성 -> mkdir /home/ybn
3. 환경 file copy -> cp /etc/skel/.* /home/ybn
4. chown
     chown -R ybn /home/ybn -> chown -R ybn:users /home/ybn
                               owner 와 group 을 모두 바꿔줌
5. chmod
     chmod 755 /home/ybn

find / -name ybnoh

find / -user ybnoh | xargs rm
                      xargs chown user2

** Super User 의 password 를 잃어 버린 경우

1. single mode 로 booting
2. # mount -a
3. # vi /etc/passwd
HP-UX System & Network Administration I                                 52
4. # reboot or init 3

 useradd [-u uid [-o] ] [-g group] [-G group [, group...]] [-d dir]
           [-s shell] [-c comment] [-m [-k skel_dir]] [-f inactive]
           [-e expire] login

 useradd -u 1045 -g users -d /home/dickybn -s /usr/bin/ksh -m dickybn

제 2 일차

*** File System Create 절차

1. Creating Physical Volumns : 각각의 디스크에 대해서 pv 를 create

  pvcreate /dev/rdsk/c0t3d0
  pvcreate /dev/rdsk/c0t4d0

2. Creating Volumn Groups : device file 생성 & vgcreate

  mkdir /dev/vg01
  mknod /dev/vg01/group c 64 0x100000
                                vg##과 동일한 ##
  vgcreate vg01 /dev/dsk/c0t3d0 /dev/dsk/c0t4d0

3. Creating Logical Volumns

  lvcreate -L 16 -n myswap vg01
  lvcreate -L 16 -n myfs1 vg01
  lvcreate -L 16 -n myfs2 vg01
---------- partition 생성 완료
4. newfs
5. mount


** File System 생성

1. pvcreate /dev/rdsk/c0t4d0
2. mkdir /dev/vg011
3. mknod /dev/vg01/group c 64 0x010000
4. vgcreate /dev/vg01 /dev/dsk/c0t4d0
---------/etc/lvmtab 에 확인
5. lvcreate -L 16 /dev/vg01
    수행후 device file 이 자동 생성됨
     or lvcreate -L 16 -n lvol12 /dev/vg01
6. newfs -F hfs /dev/vg01/rlvol#
7. mkdir /ybn
8. mount /dev/vg01/lvol# /ybn

lvremove /dev/vg01/lvol#
HP-UX System & Network Administration I                         53
vgremove /dev/vg01
pvcreate  -> pvcreate -fv : 강제로 pvcreate 할수 있다.(지우는 과정이 생략)

제 3 일차


** File System Hard Link
    : file name 은 같고 file 의 정보는 같다.

1.   touch f1
2.   ln f1 f2
3.   ls -i -> inode 확인
4.   vi f1 -> f1 edit
5.   cat f1
6.   cat f2

[script 로 user 생성]

1. vi 로 adduser script 생성

uid = 1000
for name in $(cat /userlist)
  echo $name::$uid:20::/home/$name:/usr/bin/sh >> /etc/passwd
  mkdir /home/$name
  cp /etc/skel/.* /home/$name
  chown -R $name:users /home/$name
  chmod 755 /home/$name
  let uid=uid+1

2.   vi 로 userlist file 생성
3.   adduser 를 실행
4.   crontab -l 로 작업 확인
5.   crontab -r 로 작업 종료할수 있다.

제 4 일차

fbackup -f . -i /ybnoh -I /ybnoh/f/aaa
frecover -f /ybnoh/f/aaa -i /ybnoh -xv

cat home.graph
i /albert
i /stand
e /cdrom

fbackup -f /dev/rmt/0m -u0g home.graph -I index.full
fbackup -f /dev/rmt/0m -u1g home.graph -I index.incr
HP-UX System & Network Administration I                                                        54

**printer 등록

#   lpshut
#   lpadmin -p laser2 -v /dev/            -m /usr/lib/lp/model/dumb
#   accept laser2
#   enable laser2
#   lpadmin -d laser2 (option)
#   lpsched

제 5 일차

cat /etc/inittab
ioin::sysinit:/sbin/ioinitrc >/dev/console 2>&1
tape::sysinit:/sbin/mtinit > /dev/console 2>&1
muxi::sysinit:/sbin/dasetup      </dev/console >/dev/console 2>&1 # mux init
stty::sysinit:/sbin/stty 9600 clocal icanon echo opost onlcr ixon icrnl ignpar < /dev/systty
brc1::bootwait:/sbin/bcheckrc </dev/console >/dev/console 2>&1 # fsck, etc.
link::wait:/sbin/sh -c "/sbin/rm -f /dev/syscon; \
           /sbin/ln /dev/systty /dev/syscon" >/dev/console 2>&1
cprt::bootwait:/sbin/cat /etc/copyright >/dev/syscon            # legal req
sqnc::wait:/sbin/rc </dev/console >/dev/console 2>&1               # system init
cons:123456:respawn:/usr/sbin/getty console console                 # system console

Volumn Group 정보

--- Volume groups ---
VG Name                      /dev/vg00
VG Write Access               read/write
VG Status                     available
Max LV                               255 => 최대 lv 갯수
Cur LV                             9         => 현재   "
Open LV                         9
Max PV                         16 => 최대 pv(disk) 갯수
Cur PV                         2           => 현재    "
Act PV                         2
Max PE per PV                2000
VGDA                          4
PE Size (Mbytes)                4
Total PE                     500                                               => 이 vg size
Alloc PE                     424         =>    " 사용중인 size
Free PE                       76         =>   "  남은 size
Total PVG                      0
Total Spare PVs                 0
Total Spare PVs in use            0

    LV Name                       /dev/vg00/lvol11
    LV Status                    available/syncd
    LV Size (Mbytes)             40
    Current LE                   10
    Allocated PE                 10
    Used PV                       1
HP-UX System & Network Administration I                                    55
  --- Physical volumes ---
  PV Name                      /dev/dsk/c0t6d0
  PV Status                  available
  Total PE                   250               => disk size (250*4 =1GB)
  Free PE                    0

  PV Name                      /dev/dsk/c0t5d0
  PV Status                  available
  Total PE                   250
  Free PE                    76