디스크 관리 - 윈디하나의 솔라나라
|
디스크 관리란 물리적인 디스크를 교체하거나 추가, 제거 하는 프로세스를 의미한다. 디스크는 시스템 운용중에 (다른 컴포넌트에 비해) 자주 장애를 일으키기 때문에 장애에 대비해야 한다. 특히 디스크에는 데이터가 저장되기 때문에, 장비보다 더 중요한 데이터를 잃어버리지 않도록 해야 한다. 따라서 디스크 관리는 데이터 관리 프로세스중 하나가 되곤 한다.
정책(Policy)을 세우고 정책을
시행하는 프로세스인데, 디스크 관리도 마찬가지로
정책을 세워
시행하면 되는 문제다. 예를 들어
디스크 여유용량이 전체 용량의 30% 가 남았다면, 디스크를 증설해 저장용량을 2배로 늘인다.라는 정책을 세우고 그대로 시행하면 된다.
디스크 관리 정책을 어떻게 세워야 하나요?는 회사마다 자금 사정이 다르고 운용 환경이 완전히 다르기 때문에 이렇게하라고 할 수 없다. 그래서 경험 많은 시스템 관리자들이 심사숙고 끝에 결정한다. 솔라나라를 읽는 독자들은 보통 이런 결정을 내려야 하는 위치에 있지는 않을 것으로 생각한다. 큰 기업에서 중요한 데이터에 대해 관리계획을 세워야 하는데 정말 모르겠다면, 오라클의 파트너에게 문의하거나 컨설팅업체를 찾아보는 것도 좋다. 작은 기업이라면 거래하고 있는 저장장치 업체에 문의하면 기본적인 건 알려주기도 한다.
첫번째 LSI 106x장치에 붙어있는 두번째 하드 디스크라고 말하는 경우 서버를 열어보지 않는 이상 알기 어렵다. 따라서 솔라리스에서는 모든 하드 디스크에 통일된 규격으로 디스크를 가리키는 규칙이 있다.
논리적 디스크 장치 이름이 그것이다.
/dev/[r]dsk/c?[t?]d?[s?,p?]
/dev/dsk
는 블록(Block) 디스크 디바이스를, /dev/rdsk
는 로우(Raw) 디스크 디바이스를 의미한다. ? 에는 구분값이 들어가며 일반적으로 숫자다.아래에 예시가 있다.
c0d0: 컨트롤러 0번, 디스크 0번. 보통 [프라이머리 마스터, Primary Master] 하드디스크다. 프라이머리 슬레이브는 [c0d1] 이 된다. c1t0d0: 컨트롤러 1번, 타겟 0번, 디스크 0번 c1t0d0s0: c1t0d0 디스크 중 슬라이스 0번 c10t8000000ABC123456d0: 컨트롤러 10번, 타겟 8000000ABC123456, 디스크 0번(MPxIO)블록 디바이스와 로우 디바이스라고 말하지만, 동일한 디스크를
블록 장치로써 사용하는 방법과
로우 장치로써 사용하는 방법이 존재할 뿐이다. 아래에서
c0d0
는 같은 디스크 장치다.
/dev/dsk/c0d0: c0d0 디스크를 블록 형태로 접근 /dev/rdsk/c0d0: c0d0 디스크를 로우 형태로 접근블록/로우 접근 방법은 아래와 같이 사용 명령에 따라 구분해 사용해야 한다. (잘못 사용하면 오류메시지가 나온다)
커맨드 인터페이스 사용예 df(1m) 블록 df /dev/dsk/c0t3d0s6 fsck(1m) 로우 fsck -p /dev/rdsk/c0t0d0s0 mount(1m) 블록 mount /dev/dsk/c1t0d0s7 /export/home newfs(1m) 로우 newfs /dev/rdsk/c0t0d1s1 prtvtoc(1m) 블록 prtvtoc /dev/rdsk/c0t0d0s2대표적인 블록 장치는 디스크이고, 대표적인 로우 장치는 테이프나 DVD가 있다.
/devices
디렉토리에 있다. ls -al /dev
해보면 솔라리스에서 사용되는 많은 논리 장치들이 보이는데, 이 장치는 물리적 장치 이름에 링크 되어있다.
c0d0
장치가 어느 물리적 장치(여기서는 /devices/pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0
)에 연결되어있는지 보여준다.
root@wl ~ # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 <DEFAULT cyl 14590 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0 Specify disk (enter its number): ^C
root@wl ~ # ls -al /dev/dsk/ lrwxrwxrwx 1 root root 51 11월 19일 10:45 c0d0p0 -> ../../devices/pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0:q lrwxrwxrwx 1 root root 60 11월 19일 11:00 c2t0d0p0 -> ../../devices/pci@0,0/pci1043,80a6@1d,7/storage@2/disk@0,0:q ... root@wl ~ #물리적 장치 이름에도 규칙이 있지만 자세한 설명은 생략한다. 디바이스 매핑의 예가
/etc/path_to_inst
파일에서 인스턴스명과 장치와의 매핑 내역을 확인해볼 수 있다.
/dev
디렉토리에 있다. 대부분의 디바이스 관련 작업은 이 디렉토리에서 이루어 진다. dsk
, rdsk
도 논리적 장치 이름중 하나이다.
root@wl ~ # ls -al /dev ... drwxr-xr-x 2 root sys 86 2월 5일 09:58 dsk lrwxrwxrwx 1 root root 27 11월 19일 10:50 ipf -> ../devices/pseudo/ipf@0:ipf drwxr-xr-x 2 root root 3 11월 19일 10:45 md lrwxrwxrwx 1 root other 27 11월 19일 10:11 null -> ../devices/pseudo/mm@0:null lrwxrwxrwx 1 root other 27 11월 19일 10:11 tcp -> ../devices/pseudo/tcp@0:tcp lrwxrwxrwx 1 root other 26 11월 19일 10:11 tty -> ../devices/pseudo/sy@0:tty lrwxrwxrwx 1 root other 27 11월 19일 10:11 zfs -> ../devices/pseudo/zfs@0:zfs ...위에서 예시된 장치 이름중 몇가지는 MAN 페이지에 설명이 나와있기도 하다. tty(7d), null(7d) 와 같이 말이다.
파트 태그 플래그 실린더 크기 블록 0 root wm 3 - 1301 9.95GB (1299/0/0) 20868435 1 unassigned wm 0 0 (0/0/0) 0 2 backup wm 0 - 1301 9.97GB (1302/0/0) 20916630 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 alternates wu 1 - 2 15.69MB (2/0/0) 32130솔라리스는 슬라이스 2, 8, 9번을 특별하게 사용한다.
※ 아래의 내용을 고려해 정해주면 큰 어려움은 없을 것이다.
시스템 메모리 크기 스왑 크기 2GB 4GB 8GB 8GB 16GB 이상 16GB
/
: 솔라리스의 디렉토리 구조에서 최 상단에 위치하며 가장 기본이 되는 슬라이스로, 루트 슬라이스는 용량을 증설하기 어렵다. (초보자라면 차라리 재설치를 권장할 정도다) 미리미리 충분히 할당해야 한다./opt
: 썬의 부가적인 소프트웨어들이 /opt 에 설치되곤 했다. (요즘엔 아닌 경우도 많다) /opt 에 기본 설치되는 프로그램을 설치할 계획이 없다면 굳이 할당할 필요 없는 공간이다./var
: 솔라리스의 각종 로그가 쌓이고, 롤백을 위한 패치 아카이브가 저장되는 공간이다. 로그를 얼마나 남길것인가에 따라 다르지만 역시 충분히 할당해주는 것이 좋다./usr
: 각종 기본 프로그램이 설치되는 곳이다. 부가적인 소프트웨어도 여기에 설치되는 경우도 많으니 충분히 할당해야 한다./export/home
: 솔라리스에서 사용자의 홈 디렉토리다.※ 요즘엔 ZFS를 사용하기 때문에 굳이 크기를 정할 필요 없어졌지만(필요에 따라 동적으로 늘이거나 줄일 수 있으므로), 개인적인 서버를 운용할 때 아래와 같이 할당해 사용한 적이 있다. 대부분의 데이터는 /export/home 에 저장해서 사용했었다.
/ : 4GB /usr: 8GB /var: 4GB /opt: 8GB 스왑: 4GB (시스템메모리: 2GB) /export/home: 나머지
root@wl ~ # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 <DEFAULT cyl 1955 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0 Specify disk (enter its number): ^C root@wl ~ # touch /reconfigure root@wl ~ # shutdown -i 5 -g 0 -y
root@wl ~ # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 <DEFAULT cyl 1955 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0 1. c2t0d0 <DEFAULT cyl 1021 alt 2 hd 128 sec 32> /pci@0,0/pci1000,8000@14/sd@0,0 2. c2t1d0 <DEFAULT cyl 1021 alt 2 hd 128 sec 32> /pci@0,0/pci1000,8000@14/sd@1,0 Specify disk (enter its number): ^C
root@wltest ~ # format
Searching for disks...done
c1t1d0: configured with capacity of 9.98GB
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <DEFAULT cyl 1302 alt 2 hd 255 sec 63>
/pci@0,0/pci1000,8000@16/sd@0,0
1. c1t1d0 <DEFAULT cyl 1303 alt 2 hd 255 sec 63>
/pci@0,0/pci1000,8000@16/sd@1,0
Specify disk (enter its number): 1
selecting c1t1d0
[disk formatted]
Disk not labeled. Label it now? y
Warning: error setting drive geometry.
Warning: error writing VTOC.
Warning: no backup labels
Write label failed 1)
1) 결국 label
명령이 실패한다.이런 경우, 하드디스크 제조사에서 제공하는 제로필(ZeroFill)유틸리티로 0번 섹터를 지우거나 (시게이트의 경우 SeaTools for DOS를 사용하면 된다), format(1m)명령의 partition 서브메뉴로 들어가 존재하는 모든 파티션을 지운 후 다시 시도해본다.
디스크가 인식되었으면 파티션과 슬라이스를 설정한다. UFS를 사용하려 하는 경우에는 필수로 설정해줘야 하며 ZFS를 사용하는 경우에는 할 필요 없다.
이 작업에는 format(1m)명령을 사용한다.
root@wl ~ # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 <DEFAULT cyl 1955 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0 1. c2t0d0 <DEFAULT cyl 1021 alt 2 hd 128 sec 32> /pci@0,0/pci1000,8000@14/sd@0,0 2. c2t1d0 <DEFAULT cyl 1021 alt 2 hd 128 sec 32> /pci@0,0/pci1000,8000@14/sd@1,0 Specify disk (enter its number): 1 1) selecting c2t0d0 [disk formatted] FORMAT MENU: disk - 디스크 선택 type - 디스크 타입 선택 및 정의 partition - 파티션 테이블 선택 및 정의 current - 현재 디스크 설명 format - 디스크 포맷 및 디스크 분석 fdisk - fdisk 프로그램 실행 repair - 고장난 섹터를 복구 label - 레이블을 디스크에 쓰기 analyze - 표면 분석 defect - defect list management backup - 백업 레이블을 검색 verify - 레이블을 읽고 보임 save - 새로운 디스크/파티션 정의를 저장 inquiry - 제조사, 제품 리비전 보임 volname - 볼륨명 정의(8자) !<cmd> - <cmd> 실행후 리턴 quit format> fdisk 2) 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. y 3) format> fdisk 4) Total disk size is 1023 cylinders Cylinder size is 4096 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 Active Solaris2 1 1022 1022 100 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: 6 5) format> partition 6) 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> print 7) Current partition table (unnamed): Total disk cylinders available: 1020 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 unassigned wm 0 0 (0/0/0) 0 1 unassigned wm 0 0 (0/0/0) 0 2 backup wu 0 - 1019 1.99GB (1020/0/0) 4177920 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 2.00MB (1/0/0) 4096 9 unassigned wm 0 0 (0/0/0) 0 partition> 0 8) 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]: 1020c partition> print 9) Current partition table (unnamed): Total disk cylinders available: 1020 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 unassigned wm 0 - 1019 1.99GB (1020/0/0) 4177920 1 unassigned wm 0 0 (0/0/0) 0 2 backup wu 0 - 1019 1.99GB (1020/0/0) 4177920 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 2.00MB (1/0/0) 4096 9 unassigned wm 0 0 (0/0/0) 0 partition> label 10) Ready to label disk, continue? y partition> q 11) format> q root@wl ~ # prtvtoc /dev/rdsk/c2t0d0s2 * /dev/rdsk/c2t0d0s2 partition map * * Dimensions: * 512 bytes/sector * 32 sectors/track * 128 tracks/cylinder * 4096 sectors/cylinder * 1022 cylinders * 1020 accessible cylinders * * Flags: * 1: unmountable * 10: read-only * * First Sector Last * Partition Tag Flags Sector Count Sector Mount Directory 0 0 00 0 4177920 4177919 2 5 01 0 4177920 4177919 8 1 01 0 4096 40951) 파티션/슬라이스를 나눌 디스크를 선택한다.
root@wl ~ # newfs /dev/rdsk/c2t0d0s0 newfs: 새 시스템 파일 /dev/rdsk/c2t0d0s0을(를) 구성하시겠습니까: (y/n)? y /dev/rdsk/c2t0d0s0: 128 트랙, 32 섹터의 1019 실린더에 있는 4173824 섹터 2038.0MB (45 실린더 그룹) (23 c/g, 46.00MB/g, 11264 i/g) 수퍼 블록 백업 (fsck -F ufs -o b=#의 경우): 32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952, 848192, 3298432, 3392672, 3486912, 3581152, 3675392, 3769632, 3863872, 3958112, 4052352, 4146592 root@wl ~ # mkdir /newdisk1 root@wl ~ # mount /dev/dsk/c2t0d0s0 /newdisk1 root@wl ~ # df -h 파일시스템 크기 사용 가용 용량 설치지점 ... rpool 15G 33K 9.4G 1% /rpool /dev/dsk/c2t0d0s0 1.9G 2.0M 1.9G 1% /newdisk1 root@wl ~ #시스템 재시작시에 자동으로 마운트 하려면 /etc/vfstab 에 추가해야 한다. UFS에 대한 자세한 사항은 윈디하나의 솔라나라: UFS (작성중)을 참고한다.
root@wl ~ # zpool create datapool /dev/dsk/c2t1d0 root@wl ~ # df -h ... rpool 15G 33K 9.4G 1% /rpool datapool 2.0G 21K 2.0G 1% /datapool root@wl ~ #시스템 재시작시에 자동으로 마운트 하려면 /etc/vfstab 에 추가해야 한다. ZFS에 대한 자세한 사항은 윈디하나의 솔라나라: ZFS (작성중)을 참고한다.
root@wl ~ # mount /dev/dsk/c2t0d0s0 /newdisk1 root@wl ~ # cd /newdisk1/ root@wl /newdisk1 # umount /newdisk1 umount: /newdisk1 사용 중 root@wl /newdisk1 #위의 경우는 루트 사용자의 현재 디렉토리가 마운트 지점과 같다. 당연히 사용중으로 나온다. 어느 프로세스가 사용중인지 알려면 fuser(1m) 명령을 이용하면 된다. -c 옵션은 해당 디렉토리 뿐만 아니라 그 하위의 디렉토리/파일을 사용중인 프로세스까지 찾으라는 의미이다.
root@wl ~ # fuser -c /newdisk1 /newdisk1: 752c root@wl ~ # ps -ef | grep 752 root 752 746 0 16:21:24 pts/3 0:00 -bash root@wl ~ # pfiles 752 752: -bash Current rlimit: 256 file descriptors 0: S_IFCHR mode:0620 dev:287,0 ino:12582920 uid:0 gid:7 rdev:24,2 O_RDWR|O_NOCTTY|O_LARGEFILE /devices/pseudo/pts@0:2 1: S_IFCHR mode:0620 dev:287,0 ino:12582920 uid:0 gid:7 rdev:24,2 O_RDWR|O_NOCTTY|O_LARGEFILE /devices/pseudo/pts@0:2 2: S_IFCHR mode:0620 dev:287,0 ino:12582920 uid:0 gid:7 rdev:24,2 O_RDWR|O_NOCTTY|O_LARGEFILE /devices/pseudo/pts@0:2 3: S_IFDOOR mode:0444 dev:296,0 ino:55 uid:0 gid:0 size:0 O_RDONLY|O_LARGEFILE FD_CLOEXEC door to nscd[135] /var/run/name_service_door 255: S_IFCHR mode:0620 dev:287,0 ino:12582920 uid:0 gid:7 rdev:24,2 O_RDWR|O_NOCTTY|O_LARGEFILE FD_CLOEXEC /devices/pseudo/pts@0:2 root@wl ~ # pwdx 752 752: /newdisk1
fuser -ck
옵션을 주면 해당 지점을 사용중인 모든 프로세스에 SIGKILL 시그널을 보낸다. 따라서 마운트 지점이 사용중이 아니게 되고, 언마운트가 가능해진다.
root@wl ~ # fuser -ck /newdisk1 /newdisk1: 752c root@wl ~ #아니면 언마운트시 -f 옵션을 주어 강제로 언마운트 할 수 있다. 일단
fuser -ck
로 시도해본 후, 안되면 umount -f
를 시도한다.
root@wl ~ # umount -f /newdisk1
root@wl ~ # prtvtoc /dev/rdsk/c2t0d0s2 | fmthard -s - /dev/rdsk/c2t1d0s2
2TB를 초과하는 단일 하드디스크를 인식하려면 64비트 커널과 함께 반드시 EFI Label 을 사용해야 한다. (EFI 레이블 사용시 부팅 디스크로써 사용할 수 없다) 솔라리스는 기본적으로 SMI레이블을 사용하며, 아직까지는 SMI를 권장한다. SMI는 Sun Microsystems, Inc 의 약어이며, EFI는 Extensible Firmware Interface의 약어다. 최근에는 Unified EFI까지 정의되었다.
솔라리스에서 레이블을 변경하려면 아래와 같이 format -e
명령을 사용하자.
root@wl ~ # format -e
AVAILABLE DISK SELECTIONS:
0. c0d0 <DEFAULT cyl 1955 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
1. c2t0d0 <DEFAULT cyl 1020 alt 2 hd 128 sec 32>
/pci@0,0/pci1000,8000@14/sd@0,0
2. c2t1d0 <VBOX-HARDDISK-1.0-2.00GB>
/pci@0,0/pci1000,8000@14/sd@1,0
Specify disk (enter its number): 2
...
FORMAT MENU:
...
format> label 1)
[0] SMI Label
[1] EFI Label
Specify Label type[1]:
Ready to label disk, continue? n
format> q
root@wl ~ #
1) label은 원래 변경 내용을 저장하는 명령이지만, -e 옵션을 붙여 실행하면 작동이 위와 같이 변경된다.
RSS ATOM XHTML 5 CSS3 |
Copyright © 2004-2025 Jo HoSeok. All rights reserved. |