OS/Solaris

0425 공부 정리 <압축, 하드디스크 추가, 파티션 할당 및 마운트>

dp. 2011. 4. 26. 00:57
file 명령어로 파일의 속성을 확인해보자 
유닉스리눅스 시스템은 파일 이름이나 확장자로 판단하지 말고 파일의 속성으로 판단해야 한다. 


==============한 묶음으로 만들기======== 
tar cvf 이름 대상
tar xvf 이름

단일 파일 만들기  . 이후 bz2로 압축을 한다.
tar 는 아이노드(무결성)의 정보를 고스란히 저장하기 때문에 백업용으로 사용하기도함.
cp 는 아이노드가 바뀌기 때문에 데이터정보는 동일하지만 연결항목이 끊어져 무결성 정보를 입증하기 어려움


==============압축==========
jar cvf 이름 대상
jar xvf 이름
작업시 META-INF 폴더에 파일이 생성됨.   
아이노드 번호가 바뀌기 때문에 ???? 
잘 사용안한다.




zip 이름 대상 (옵션없음)
unzip 이름


gzip -1 대상   (숫자는 속도- 1이 빠르고 9가 느리고)
gzip -9 대상   (압축률이 더 높다)

gzip풀기
gzip -d 이름
gunzip 이름


bzip2  
단일파일 압축률이 가장 높은 압축방법
보통 tar로 단일 파일을 만든후 bzip2로 압축한다. 
통상 10메가이하면 bzip2로 안하고 gzip 로 하는것이 일반적이다. 

풀때는 gzip과 동일하다.

=========================================================

디렉토리 관련

솔라리스는 디바이스 이름을 3가지의 형태로 사용한다. 

-논리적 장치
-물리적 장치
-인스턴스 이름


 /devices 물리적인 장치
 /dev 논리적인 장치sol-25@[/devices]format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
          /pci@0,0/pci8086,2829@d/disk@0,0
       1. c0t2d0 <DEFAULT cyl 1021 alt 2 hd 64 sec 32>
          /pci@0,0/pci8086,2829@d/disk@2,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c0t0d0s1 is currently used by swap. Please see swap(1M).


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> veryfy
`veryfy' is not expected.
format> verify

Primary label contents:

Volume name = <        >
ascii name  = <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
pcyl        = 2609
ncyl        = 2607
acyl        =    2
bcyl        =    0
nhead       =  255
nsect       =   63
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       1 - 2550       19.53GB    (2550/0/0) 40965750
  1       swap    wu    2551 - 2606      439.28MB    (56/0/0)     899640
  2     backup    wm       0 - 2606       19.97GB    (2607/0/0) 41881455
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)           0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065
  9 unassigned    wm       0               0         (0/0/0)           0

format>

/devices에 등록되고   /dev  는 이러한 장치를 논리적으로 링크 시켜 놔야 운영체제에서 사용할 수 있다.
드라이브 설치하면 /devices에 까지만 등록된다. 그래서 /dev에 동기화시켜야 한다 명령어를 통해서 
 
/export

파티션을 해야만하는 곳
/var
/boot
/export/home
/tmp --> 시스템마다 달라서 해줘야할때도 있다. 어플 활용에 따라 커질 수도있기때문에

절대 파티션을 하면 안되는곳
/etc    --> 시스템의 환경설정이 들어있기때문에 활용도.속도 가 떨어질 수 있다.






파티션을 할때 실린더를 기준으로 나누자. 이유는 물리적으로 처리하는 단위가 실린더 이므로 

참고로 ,슬라이스=파티션

리눅스에서도 scsi  = sd
eid = hd
라는 방식에 따른 표현 차이




디스크네이밍에서 

컨트롤러는 같은 방식이면 모두 c0

총 24개의 하드디스크를 6개의 컨트롤러로 묶을때 네이밍예
c2 t3 d5 s5
컨트롤러 가 번호가 붙으면 다른 컨트롤러라고 생각할 수 있지만 통상적으로 컨트롤러 번호는 같다
t는 6묶음의 갯수를 나타내므로 
d는 하나의 묶음안에 몇 번째 하드디스크
s는 해당 하드디스크 안에서 몇 번째 슬라이스(파티션)인지 나타내줌





새로운 하드 추가시과정
touch /reconfigure   파일 생성  - 여기서 이 파일을 통해서 새로운 장치가 있는지 검사함 (다른방법도 있음)
init 5    시스템 off
하드 추가후 새로 부팅
format 커맨드창에서 입력
devfsadm 물리정보와 논리정보를 연결
 
** 오늘날은 디바이스추가후(드라이브설치후) 바로 devfsadm 으로 /dev 에 연결해준다.  안되면 /reconfigure추가후 해보고 devfsadm을 해보고 아니면, reboot -- -r로 해보기도 한다. 




===== 기존 하드디스크
sol-25@[/devices]format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
          /pci@0,0/pci8086,2829@d/disk@0,0
       1. c0t2d0 <DEFAULT cyl 1021 alt 2 hd 64 sec 32>
          /pci@0,0/pci8086,2829@d/disk@2,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c0t0d0s1 is currently used by swap. Please see swap(1M).


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> veryfy
`veryfy' is not expected.
format> verify

Primary label contents:

Volume name = <        >
ascii name  = <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
pcyl        = 2609
ncyl        = 2607
acyl        =    2
bcyl        =    0
nhead       =  255
nsect       =   63
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       1 - 2550       19.53GB    (2550/0/0) 40965750
  1       swap    wu    2551 - 2606      439.28MB    (56/0/0)     899640
  2     backup    wm       0 - 2606       19.97GB    (2607/0/0) 41881455
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)           0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065
  9 unassigned    wm       0               0         (0/0/0)           0

format>
format>
format> ^C
sol-25@[/devices]
sol-25@[/devices]
sol-25@[/devices]
sol-25@[/devices]
sol-25@[/devices]format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
          /pci@0,0/pci8086,2829@d/disk@0,0
       1. c0t2d0 <DEFAULT cyl 1021 alt 2 hd 64 sec 32>
          /pci@0,0/pci8086,2829@d/disk@2,0
Specify disk (enter its number): ^C
sol-25@[/devices]^C
sol-25@[/devices]^[
sol-25@[/devices]
sol-25@[/devices]
sol-25@[/devices]format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <DEFAULT cylsol-25@[/devices]format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
          /pci@0,0/pci8086,2829@d/disk@0,0
       1. c0t2d0 <DEFAULT cyl 1021 alt 2 hd 64 sec 32>
          /pci@0,0/pci8086,2829@d/disk@2,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c0t0d0s1 is currently used by swap. Please see swap(1M).


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> veryfy
`veryfy' is not expected.
format> verify

Primary label contents:

Volume name = <        >
ascii name  = <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
pcyl        = 2609
ncyl        = 2607
acyl        =    2
bcyl        =    0
nhead       =  255
nsect       =   63
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       1 - 2550       19.53GB    (2550/0/0) 40965750
  1       swap    wu    2551 - 2606      439.28MB    (56/0/0)     899640
  2     backup    wm       0 - 2606       19.97GB    (2607/0/0) 41881455
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)           0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065
  9 unassigned    wm       0               0         (0/0/0)           0

format>
format>
format> ^C
sol-25@[/devices]
sol-25@[/devices]
sol-25@[/devices]
sol-25@[/devices]


c0t0d0s0       ====> 위 그림에서 0
c0t0d0s1       ====> 위 그림에서 1


format ; 명령어 
0 or 1 ; 하드디스크 선택
p ; 명령어 
0~7 ; 해당 파티션 선택가능 2번 은 절대 삭제하지 말것 
lable ; 저장






디스크 명령어 

prtvtoc   ==  디스크 첫번째 섹터- 파티션 정보가 들어있는 곳 , 
백업시
prtvtoc /dev/rdsk/c0t0d0s0  > c0t0d0.vtoc ; 백업가능
; 같은 디스크의 다른 파티션의 vtoc정보도 디스크의 첫번째 섹터를 가리키기 때문에 
; 결론적으로 같은 값. 
; 이값을 백업했을때는 다른 하드디스크 파티션 영역에 백업해둔다. 

복구시
prtvtoc -s c0t0d0.vtoc /dev/rdsk/c0t0d0s0



이러한 prtvtoc값이 백업이 되어있지 않은경우는 데이터 영역만 살려놓고 시스템을 재 설치 해야한다. 






새로운 하드를 추가후 마운트 과정

하드 추가
-> 장치인식
->부팅후 format 으로 정보확인
-> 해당 디스크 선택
-> verify로 실린더 번호 확인후 파티션 영역 선택
-> 파티션 생성후 저장  label
-> 마운트를 위한 명령어 입력 newfs /dev/rdsk/c0t0d0s0(s0~s7은 해당 파티션 번호 입력해야함)
-> fstyp /dev/rdsk/c0t0d0s0 확인 ufs인지
-> 마운트포인트 생성(디렉토리)
-> mount -F ufs /dev/dsk/c0t0d0s0 입력 -> 확인

== 부팅때 자동으로 마운트 되게 하기
/etc/mnttab   ,    /etc/vfstab   둘중 부팅후부터 유저 마운트까지 다 포함한게 mnttab. 
따라서 부팅후 자동으로 마운트 되게 하려면 vfstab을 수정해야함