솔라리스(unix) 디스크 관리 및 추가
Unix
1.슬라이스
1. 실린더의 그룹
2. 0~7번 슬라이스로 구성
3. 슬라이스 2번은 절대로 건들여서는 안된다.
4. benefit
    *데이터의 조직화
    *파일 엑세스 속도 감소
    *i/o 퍼포먼스 향상
2. 디스크 슬라이스 네이밍
종류 디바이스
컨트롤 이름 c0 ,c1, c2.. host bus adapter
타겟 숫자 d0 ,d1 ,d2.. disk,type,jumper로 세팅
슬라이스 숫자 s0 ,s1 ,s2.. slice number -> 0~7까지 가능
3.하드 추가 및 디스크 관리
bash-2.05# touch /reconfigure  /재부팅할때 장치를 읽을 수 있음
bash-2.05# devfsadm            /재부팅 할 수 없는 서버가 많기 때문에
                                거의 이쪽을 많이 쓴다.(리붓없이 장치인식)
bash-2.05# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0d0 <DEFAULT cyl 22189 alt 2 hd 15 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c0d1 <DEFAULT cyl 2077 alt 2 hd 16 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
       2. c1d1 <DEFAULT cyl 2077 alt 2 hd 16 sec 63>
          /pci@0,0/pci-ide@7,1/ide@1/cmdk@1,0
       3. c2t0d0 <DEFAULT cyl 1021 alt 2 hd 64 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@0,0
Specify disk (enter its number): 3
  • 0번은 처음 설치할때의 하드디스크고,
    나머지 1,2는 예전에 1G씩 추가. 3번이 이번에 추가한 1G 하드디스크다.
    3번을 선택해서 디스크의 파티션을 나눠보겠다.
    EX)DISK의 SLICE NAME을 꼭 기억하자. /dev/dsk/ 디렉토리에에 파일이 생성됨.
Specify disk (enter its number): 3
selecting c2t0d0
[disk formatted]


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>
  • 여러가지 메뉴가 뜨는걸 볼 수 있는데
    여기서 사용할 메뉴는 fdisk,part,verify,laber 정도이다.
format> fdisk                 /fdisk를 생성한다.
No fdisk table exists. The default partition for the disk is:

  a 100% "SOLARIS System" partition

Type "y" to accept the default partition, otherwise type "n" to edit the
partition table.

 Please answer with "y" or "n": y    /y선택
format> part     /partision인데 줄여써도 된다.


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition>
  • 위에서 설명했듯이 파티션을 누나기전에 fdisk를 꼭 생성해 줘야한다.
    part명령어를 입력하면 프롬프트가 바뀌면서 슬라이스 번호 메뉴가 나열된다.
    위에서 말했듯이 2번 슬라이스는 backup tag가 들어있으므로 절대 건들지않는다.
    0번으로 가서 파티션을 나눠보자.
partition> 0
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0

Enter partition id tag[unassigned]:     /파티션아이디 입력 [그냥엔터]
Enter partition permission flags[wm]:   /플래그 입력 [그냥엔터]
Enter new starting cyl[0]:              /맨첫번째니까 당연히 0 [그냥엔터]
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 500mb
partition>
  • 실린더가 중요한데 기본적으로 0번 슬라이스를 제외하고 1번부터는
    실린더 번호가 중복되어서는 안된다. 예를 들어 0번 실린더에서 0-899까지 썼다면
    다음 1번 파티션 실린더에서는 900번으로 써야지 옳다.
partition> print
Current partition table (unnamed):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0 -  499      500.00MB    (500/0/0)  1024000
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup    wu       0 - 1020     1021.00MB    (1021/0/0) 2091008
  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        1.00MB    (1/0/0)       2048
  9 unassigned    wm       0               0         (0/0/0)          0

partition>
  • print라는 명령어는 현재 파티션을 나눈 정보를 출력받을수 있다.
    이제 다음 1번 슬라이스를 나눠보자.
partition> 1     /파티션 1번 나눌차례
Part      Tag    Flag     Cylinders        Size            Blocks
  1 unassigned    wm       0               0         (0/0/0)          0

Enter partition id tag[unassigned]:    /그냥엔터
Enter partition permission flags[wm]:  /그냥엔터
Enter new starting cyl[0]: 500         /슬라이더 나누기전에 꼭 print 명령어로 마지막으로 나누었던 슬라이스 실린더번호를 꼭 확인해야한다.
Enter partition size[0b, 0c, 500e, 0.00mb, 0.00gb]: $  /달러문자는 나머지를 뜻함
partition> print      /정보확인
Current partition table (unnamed):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0 -  499      500.00MB    (500/0/0)  1024000
  1 unassigned    wm     500 - 1019      520.00MB    (520/0/0)  1064960
  2     backup    wu       0 - 1020     1021.00MB    (1021/0/0) 2091008
  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        1.00MB    (1/0/0)       2048
  9 unassigned    wm       0               0         (0/0/0)          0
  • 슬라이스를 모두 나누었다면 재부팅해도 사용할수 있게 명령어를 쳐야한다.
partition> label
Ready to label disk, continue? y

partition> quit
format> q
bash-2.05#
  • 여기서 끝이 아니고 포멧을 해야 쓸 수 있다.
    파일 시스템은 ufs(Unix FILE System)
bash-2.05# newfs /dev/dsk/c2t0d0s0      /IDE가 아닌 SCSI로 만들었다.
newfs: construct a new file system /dev/rdsk/c2t0d0s0: (y/n)? y  /Y 엔터
/dev/rdsk/c2t0d0s0:     1024000 sectors in 500 cylinders of 64 tracks, 32 sectors
        500.0MB in 32 cyl groups (16 c/g, 16.00MB/g, 7680 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 32832, 65632, 98432, 131232, 164032, 196832, 229632, 262432, 295232,
 721632, 754432, 787232, 820032, 852832, 885632, 918432, 951232, 984032,
 1016832,
bash-2.05# newfs /dev/dsk/c2t0d0s1
newfs: construct a new file system /dev/rdsk/c2t0d0s1: (y/n)? Y
bash-2.05#
  • 파티션 슬라이스 갯수많큼 포멧해줘야 한다.
    UFS로 만들어 졌는지 확인도 가능하다.
bash-2.05# fstyp /dev/dsk/c2t0d0s0
ufs
bash-2.05# fstyp /dev/dsk/c2t0d0s1
ufs
  • 이제 정상적으로 마운트 할 디렉토리 생성하고 디렉토리에
    disk를 마운트 하는 일만 남았다.
bash-2.05# mkdir /c2t0d0_1 /c2t0d0_2 /c2t0d0_backup
bash-2.05#
bash-2.05# mount /dev/dsk/c2t0d0s0 /c2t0d0_1
bash-2.05# mount /dev/dsk/c2t0d0s1 /c2t0d0_2
bash-2.05# mount /dev/dsk/c2t0d0s2 /c2t0d0_backup
bash-2.05# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0d0s0        4.8G   1.4G   3.3G    31%    /
/proc                    0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
fd                       0K     0K     0K     0%    /dev/fd
/dev/dsk/c0d0s1        939M    30M   852M     4%    /var
swap                   1.1G    20K   1.1G     1%    /var/run
swap                   1.1G   332K   1.1G     1%    /tmp
/dev/dsk/c0d0s3        4.1G   2.2G   1.8G    55%    /export/home
/vol/dev/dsk/c1t0d0/sol_9_905_x86/s2
                       250M   250M     0K   100%    /cdrom/sol_9_905_x86/s2
/vol/dev/dsk/c1t0d0/sol_9_905_x86/s0
                       183M   173M     0K   100%    /cdrom/sol_9_905_x86/s0
/dev/dsk/c2t0d0s0      469M   1.0M   422M     1%    /c2t0d0_1
/dev/dsk/c2t0d0s1      489M   1.0M   439M     1%    /c2t0d0_2
/dev/dsk/c2t0d0s2      469M   1.0M   422M     1%    /c2t0d0_backup
  • 마운트까지 잘 되었는지 df-h로 확인하였고 이후 hard disk 추가방법은
    맨 위에 기재를 해놨지만 1. touch /reconfigure나 2. reboot — -r로 가능하다.

'Unix' 카테고리의 다른 글

솔라리스 10 ssh 접속  (0) 2014.10.31
솔라리스(unix) 파일권한 관리  (0) 2014.10.31
솔라리스(unix) 파일 시스템 관리(fsck, du....)  (0) 2014.10.31
unix 암호찾기  (0) 2014.10.31
unix crontab, runlevel,init 정의 및 사용법  (0) 2014.10.31