Operating System/Solaris2007/08/06 09:25

20장. System Backup 및 주변장치(Device)

20.1 DAT 제어를 위한 mt 명령어

    - Tape Drive에 Message를 보낸다.
- TAPE 환경변수에 설정된 TAPE Drive에 Message를 전달하며, TAPE 환경변수가 설정되어 있지 않거나, 혹은 다른 TAPE Drive에 Message를 전달하려면 -f Option을 사용.
- TAPE의 위치 조정이나, 되감기 등이 가능하다.

        fsf # TAPE를 앞쪽으로 skip
        bsf # TAPE를 뒤로 skip (1/2" Tape Drive만 가능)
        rewind TAPE를 되감는다.
        offline TAPE를 되감고 unit를 offline 시킨다.
        status TAPE UNIT의 현재 상태 및 다른 정보를 보여준다.

  예) 디폴트 Tape Drive 설정

      #setenv TAPE /dev/nrst5
      #mt command

      특정 DRIVE에서의 Message 전달

      #mt -f /dev/nrst5 command
      #mt fsf 1  : Tape 앞쪽으로 1번 skip
      #mt rewind : Tape 되감기
      #mt erase  : Tape 내용 지우기
      #mt status : Tape Drive의 정보 보기
      #mt offline : Tape Drive offline

  예) #ls -al /dev/rst5 하면 rst5가 link된 /dev/rmt/xxx 가 보여진다.

※ backup 사용시 자신의 dir 포함유무 확인

20.2 tar 명령어

    특정 File이나, Directory를 복사하거나 재저장한다.

    Option x : File을 restore 한다.

          c : File을 create 한다. 셋 중 하나를 반드시 첫 Option으로 사용.
          t : File을 test 한다.
          f device : Tape Device 명시
          v       : verbose mode
          b size  : block size 명시
          r       : tar file 마지막에 추가 (1/4" Tape Drive에서는 사용불가)

        - remote Tape Drive를 이용해서 Tape에 File을 복사
         #tar cvbf - 126 files |rsh goldstar dd of=/dev/rst0 obs=1266

        - remote Tape Drive를 이용해서 현재Directory로 File을 복사.
        #tar goldstar ss if=/dev/rst0 bs=64b | tar xvBbf - 126 files
        #tar tvf /dev/rst0 /etc    ; /etc를 Backup

                 2.x는 rst4 or 5, rst는 rewind해서 다시 쓰므로 nrst0
             t:test, x:restore, c:creat

                * mt 명령을 쓸려면
                      #ls -al /dev/rst5 하면 rst5가 어디에 link되어 있는지 확인할 수 있다.
                      #mt -f /dev/rmt/

        예) 어떤 Media의 OPENWIN을 원래의 /usr에 copy 할 때.

         #tar cvf - openwin|(cd /usr/;tar xvf -)

         설명 : 현재 Directory 하위에 opnewin Directory가 있을 경우, tar로 openwin 및 하위 Directory 전체를 묶은 뒤 /usr Directory에 openwin을 생성하면서 묶었던 Directory 모두를 푼다.

          * openwin이 수행되기 위해서는 /.cshrc File에 아래 내용을 포함 시켜야 한다.

            setenv LANG ko
            setenv OPENWINHOME /usr/openwin
            set path=(/openwin/bin....추가)
            setenv LD_LIBRARY_PATH $OPENWINHOME/lib

20.3 cpio 명령어

      한 번에 두 개 명령 ==> error 유발함.

        예)사용법

        #cpio -itv [file or dir name] < /dev/rst5    : test
        #cpio -idumv [file or dir name] < /dev/rst5    : extract
        #cpio -ocvB [file or dir name] > /dev/rst5    : create

       ex) /usr/openwin/ "all"

        #cd /usr/openwin
        #find . -print | cpio -ocvB > /dev/rst5

             |---->상대 path : restore시 현재 dir밑에 write
                  절대 path로 정하면 무조건 /usr/openwin 에 write

        #cpio -ocvB /usr/openwin > /dev/rst5
        #cd /usr
        #find openwin -print |cpio -ocvB > /dev/rst5

        * File 단위 Backup
        #find . -print | cpio -pdv /home/etc ; 현재 내용을 /home/etc로 옮길 때.

20.4 ufsdump 명령어

  2.x ; File System 단위 Backup.

  ※ 참고 : dump / restore (SunOS 4.1.3)

            ufsdump /ufsrestore (Solaris 2.x)

       #ufsdump 0uf /dev/rst4 /dev/rdsk/c0t0d0s0   : create
      #ufsdump 0uf /dev/nrst4 /dev/rdsk/c0t0d0s0   : create
       #ufsrestore xvf /dev/rst4    : extract
       #ufsrestore tvf /dev/rst4    : test
       #ufsrestore ivf /dev/rst4    : information mode – 단일 file

         $>ls or cd or ...
         $>add file-name
         $>setmod

            ......? n

         $>extract     ;

  ※ 특정 FILE RESTORE시

        #ufsrestore ivf /dev/rst4

        ufsrestore>add file_name ; 받고자 하는 File
        ufsrestore>ls ; 하면 받고자 하는 File에 "*"표시가 되어 있음.
        ufsrestore>extract ; File이 있는 volume_number를 묻는다.

                            만약, 첫 번째 volume에 있으면, Mount volume에 "1"을 입력.

  ※ 예 : /(ROOT) File System을 /home 에 Backup.

        #ufsdump 0uf - /dev/rdsk/c0t3d0s0 | (cd /home;ufsrestore xvf -) ; 특정 Partition 받을 때, disk 대 disk 복사 시 root 받을 때 유용
       #tar cvf - . | (cd todir;tar xvfBP -) ; 특정 Directory 받을 때

20.5 Remote Backup

제한사항 ; /.rhosts 와 /etc/hosts.equiv 두 File에 REMOTE HOST_NAME을 포함하면 등록 Host 허락 한다는 의미, "+" 기호가 있으면 모든 Host에 대하여 개방한다는 의미이다.
           "[host_name] [username]" ; "sun schong" or "sun +" or "+ schong"
           /.cshrc File에 stty function이 없어야 한다.

#tar cvf - .|(rsh avante dd of=/dev/rst5) ; 현재 DIR을 avante의 Tape Drive에 Backup, restore시에는 of 대신 if.

REMOTE COPY

  #rsh sun dd if=/dev/nrst0 | dd of=/dev/nrst1    ; 원격 Host "sun" 의 DAT 내용을 현재 내 DAT 에
  #rsh sun tar cvpf - filename | dd of=/dev/nrst1 ; 현재 내 DAT에 원격Host"sun"의 filename을 저장

CREATE A TAR FILE ON A REMOTE TAPE DRIVE

  #tar cvf - filename | rsh remotehostname dd of=/dev/nrst0 ; SUN의 /usr/sbin을 SUN2의 /export/sbin에 생성시킬 때 SUN#tar cvf - /usr/sbin | rsh SUN2 dd of=/export/sbin/sbin.tar
  #rsh sun dd if=/dev/nrst4 | tar xvf - ; dd 는 표준 출력이므로 "|"을 하고, 출력을 지정하지 않으면 위의 Remote Host 에 해당하는"sun"에 직접 풀어 버린다.

※ 주의 ; 원격 Host의 DAT에서 현재 System으로 Restore할 경우 "|"에 유의!

20.6 Remote CD-ROM Mount

1. remote_machine : CD Drive가 연결된 system
   local_machine : CD Drive 없는 system

2. local_system and remote_system 공통

   # vi /.rhosts
     +
   # vi /etc/hosts.equiv
     +

3. local and remote system에 OS가 Solaris 2.x 일 때

    a. remote# mkdir -p /cdrom/unnamed_cdrom
    b. remote# mount -F ufs -r /dev/dsk/c0t6d0s2 /cdrom/unnamed-cdrom
    c. remote # vi /etc/dfs/dfstab file에 다음을 삽입

                share -F nfs -o ro /cdrom/unnamed_cdrom

    d. system reboot
    e. remote# shareall
    f. remote# rlogin local_machine -l root   
    g. local# mkdir -p /cdrom/unnamed_cdrom
    h. local# mount -r remote_machine:/cdrom/unnamed_cdrom /cdrom/unnamed_cdrom

4. remote system : Solaris 2.x

   local system : Solaris 1.x (Sun OS 4.1.x)

    a. ~ f.  까지 3번과 같음
    g. mkdir /cdrom
    h. mount -r remote_machine:/cdrom/unnamed_cdrom /cdrom

5. remote and local system : Solaris 1.x 일 때

    a. remote# mkdir /cdrom
    b. remote# mount -r /dev/sr0 /cdrom
    c. remote# vi /etc/exports file에 다음을 삽입

       /cdrom -ro

    d. system reboot
       - export file modify 했을 경우는 system rebooting 하지 않고 /usr/etc/exportfs -a command로 확인하면 됨

    e. remote# rlogin local_machine -l root
    f. local# mkdir /cdrom
    g. local# mount -r remote_machine:/cdrom /cdrom

20.7 DEVICE 관련된 사항

File System분류

0 sd0            c0t0d0s0
1 sd1            c0 - scsi controller number
2 sd2            t0 - target number
3 sd0 ---> default    do - disk number
4 st ꠏꠈ Tape        s0 - partition(slice) number
5 st ꠏꠎ
6 cdrom
7 scsi

1. CD-ROM

* 4.1.3 에서는 /dev/sr0 or /dev/sr1
* 2.x 에서는 /dev/sr5 or /dev/sr6

2. Tape-Drive

   1) /dev/rst4 or 5        <---- boot -r 로 Booting이 이루어 졌을 때.
     * 4.1.3에서는 rst0 or rst1     Reconfiguration Option(boot -r)없이 Booting된 상태라면 명령라인에서 "drvconfig", "disks" or "tapes" ...

   2) /dev/rmt/0nm or 1nm <---- drvconfig , tapes 명령으로 임시접속 시켰을 때의 Device_name

20.8 DISK Model 관련 사항

1. Seagate ST410800N 일 때.

   ST: Seagate (회사명) , 4: Form-Factor , 10800: Mbyte , N: Interface

   Form-Factor

      1 = 3.5-inch, half-height (41mm)
      3 = 3.5-inch, 1-inch height (25mm)
      4 = 5.25-inch, full-height (82mm)
      5 = 3.5-inch, 0.75-inch height (19mm)
      7 = 1.8-inch
      9 = 2.5-inch

   Mbytes

        Unformatted capacity (approx)

   Interface

       A = AT(IDE)
       AD = 50pin 1.3inch AT
       FC = Fibre Channel
       N = SCSI, 8-bit
       NC = Single Connector SCSI, 8-bit
       ND = Differential SCSI, 8-bit
       W = SCSI, 16bit
       WC = Single Connector SCSI, 16-bit
       WD = Differential SCSI, 16-bit
       P5 = PCMCIA, 5V
       G = SafeRiteTM
       K = IPI-2

       ※ 99년인 요즘은 N Type 후속인 LW 와 WC 후속인 LC Type이 주류를 이루고 있다. 속도(RPM) 도 많이 증가하여 현재는 10,000RPM 에 달하고 있다.

20.9 Addon DISK(추가 Device 설치)

  1) ok probe-scsi            ; PROM상에서 물리적으로 Disk가 Addon 됐는지 확인
     ok boot –r                ; 확인이 되었다면 ReconfigurationBooting

     #format -> partition(print, label, q)    ; Partition 설정 후 labeling 및 backup 한 다음 quit

  2) #newfs /dev/rsd1g            ; 2.x에서는 "/dev/rdsk/c0t1d0s6"처럼 표현
     #mount /dev/sd1g /usr        ; 만들어진 File System을 mount_point에 Mount
     #vi /etc/fstab            ; Booting시 인식시키기 위한 Mount Table 편집(2.x일 경우는 /etc/vfstab File)

  3) #fsck /dev/rsd1g            ; 최종적으로 Partition check 또는 "fack /dev/rdsk/c0t1d0s6" (2.x일 경우)

20.10 DEVICE 설치

  1. System을 shutdown하지 않고 잠시 OK 모드로 나가 device를 붙일 때.

     #STOP+A: System 잠시 멈추기 위함.      

        - device를 붙이고, "go"명령으로 복귀 후 다음 실행
        - 위험하므로, 특별한 경우가 아니면 power off 후에 하는 것이 좋다.

     #drvconfig                             
     #disks ------> tape drive이면 "tapes"   
   #format                                

  2. System을 shutdown 하고 boot -r으로 재부팅하면, 위의 예처럼 device를 인식할 수 있다.

     ※ vfstab(/etc)에 Device 명을 기입해주면 Booting시 자동으로 Device 인식.

        4.x에서는 fstab.

  * therd-party SCSI interface 설치(Adaptec Controller을 SUN PCI 에 설치 시)

    Installing The Device Driver (Version 2.0 or Later)
    For Solaris SPARC 2.5.1 / 2.6    

    Installing from a floppy Disk

  1. Log on to The Solaris Operation System as root.     
  2. At the superuser prompt(#), type the following command and press Enter;

    # mkdir floppy
    # /etc/init.d/volmgt stop
    # /etc/init.d/volmgt start
    # volcheck
    # cd /floppy/floppy0
    # cp 780fv200.dd.Z /tmp

  3. Then type the following and press displayed;

    # cd /tmp
    # uncompress 780fv200.dd.Z
    # pkgadd -d 780fv200.dd     

  The following software package is displayed;

  1. ADPadp Adaptec 294X(U)W/394X(U)W/4944(U)W SCSI

             Host Adapter Driver
             (Ultra Sparc) release v2.00

  Press Y to answer yes to each question that follows.   

  4. When the following messages is displayed, type q to quit the installation;

    Installation of <ADPadp>was successful.

  5. Reboot the system to enable the new device driver to take effect.

20.11 DISK format Utilities(Partition 설정 시)

  p, p해서 partition메뉴로 들어간다.
  Partition 설정 후 label하고 Q로 나온다

※ defect, backup은 추후/etc/format.dat에 Partition 내용이 저장한다

defect로 list 잡은 후 commit 실행 후 Q로 나온다.
backup 실행 후 label을 다시 한 후 Q로 나온다.

20.12 SCSI Disk의 RPM조정

  SCSI Disk 의 서로 다른 RPM 때문에 System의 문제시 조치 방법

  - Single Boot

    # adb -w /kernel/unix

      SCSI_options? W 58

      $q

    # boot -r

  - 4.1.x에서

    # adb -w /vmunix

      SCSI_options? W 58

    # boot -r

20.13 Floppy DISK인식

  ※ System 인식여부 테스트

    ok test-floppy    ; floppy Disk test .. 이상 없다면, System booting 진행.
    ok boot –r        ; boot sd(0,1,0) -r --> SunOS일 경우 Login하고,...
    sun#volcheck  -> Floppy Drive를 System이 자동 Mount 한다. 대게는 /floppy/no_name.. 이렇게 Mount 될 것이다.

  ※ tar Format으로 data가 저장 되어있을 때는 Floppy가 mount 안되므로, 이때는 vold Daemon을 kill 하고 tar를 사용하면 된다.

     #ps -ef|grep vold    ; 자동 Mount Daemon을 찾는다.
     #kill -9 vold_pid    ; Daemon을 kill 한다.
     #tar xvf /dev/floppy    ; data를 down_load 한다.
     #eject fd        ; Diskette을 꺼낸다.

20.14 / (root) file System restore

  아래는 /(root) File System의 restore 방법이다.

  ok boot cdrom -s

  Boot device: /sbus/esp@0,8000000/sd@6,0:c File and args: -sw

  SunOS Release 5.1 Version Generic [UNIX(R) System V Release 4.0]
  INIT: SINGLE USER MODE

  # newfs /dev/rdsk/c0t3d0s0

  newfs: construct a new file system /dev/rdsk/c0t3d0s0: (y/n)? y

  /dev/rdsk/c0t3d0s0: 59760 sectors in 83 cylinders of 9 tracks, 80 sectors
  30.6MB in 6 cyl groups (16 c/g, 5.90MB/g, 2688 i/g)
  super-block backups (for fsck -F ufs -o b=#) at:

   32, 11632, 23232, 34832, 46432, 58032,

  # fsck /dev/rdsk/c0t3d0s0

  ** /dev/rdsk/c0t3d0s0

  ** Last Mounted on

  ** Phase 1 - Check Blocks and Sizes
  ** Phase 2 - Check Pathnames
  ** Phase 3 - Check Connectivity
  ** Phase 4 - Check Reference Counts
  ** Phase 5 - Check Cyl groups

  2 files, 9 used, 27742 free (14 frags, 3466 blocks, 0.1% fragmentation)

  # mount /dev/dsk/c0t3d0s0 /a
  # cd /a
  # ufsrestore rvf /dev/rmt/0
  # rm restoresymtable
  # cd /
  # umount /a
  # fsck /dev/rdsk/c0t3d0s0

  ** /dev/rdsk/c0t3d0s0

  ** Last Mounted on /a

  ** Phast 1 - Check Blocks and Sizes
  ** Phast 2 - Check Pathnames
  ** Phast 3 - Check Connectivity
  ** Phast 4 - Check Reference Counts
  ** Phase 5 - Check Cyl groups

  1779 files, 12509 used, 15242 free (34 frags, 1901 blocks, 0.1% fragmentation)

  # cd /usr/lib/fs/ufs                2.x일 경우
  # installboot bootblk /dev/rdsk/c0t3d0s0    sol 2.6일 경우
  # reboot                    /usr/platform/sun 4x/lib/fs/ufs/bootblk

  * 참고

  /에 "ufsboot" file이 존재하는지 확인 없으면 CD에서 Copy 하고  없을 경우 다음과 같은 error 발생
⇒ error message : boot loader fast

Creative Commons License
Posted by BLUEDAY™