/dev/[r]dsk/c?[t?]d?[s?,p?]/dev/dsk는 블록(Block) 디스크 디바이스를, /dev/rdsk 는 로우(Raw) 디스크 디바이스를 의미한다. ? 에는 숫자가 들어간다. c는 컨트롤러를 의미하고, t는 타겟, d는 디스크 번호, s는 슬라이스 번호(0~7)이며 p는 파티션 번호(0~4)다. 이중 t는 ATA나 IDE장치에는 없다. (SCSI의 타겟을 생각하면 된다. 정확하게는 직접(Direct) 연결되어있는 경우엔 t가 없고, 버스 기반(Bus-Oriented) 콘트롤러에 연결되어있는 경우엔 t가 있다) s와 p는 구성에 따라 없는 경우도 있다. 아래와 같이 해석될 수 있다.
[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가 있다.
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 ~ #
물리적 장치 이름에도 규칙이 있지만 자세한 설명은 생략한다. 디바이스 매핑의 예가 Device Mapping on Sun Servers: A Quick Guide에 나와있다.
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 ...
파트 태그 플래그 실린더 크기 블록 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
※ 필자는 요즘엔 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@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 4095
1) 파티션/슬라이스를 나눌 디스크를 선택한다.
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
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 옵션을 붙여 실행하면 작동이 위와 같이 변경된다.
|
|
Copyright © 2004-2010 Jo HoSeok. All rights reserved. |