DBA가 되고 싶은 병아리
RAID 구성 가이드 본문
문서내용
===================================
--1. RAID 설명
--2. RAID 0 실습
--3. RAID 1 실습
--4. RAID 5 실습
===================================
--1. RAID 설명
RAID 0 :Striping
- 최소 드라이브 개수 : 2
- 최대 용량 : 디스크의 수 x 디스크의 용량
- 특징 : 빠른 입출력 속도가 요구되나
장애 복구 능력은 필요 없는 경우에 적합하다.
RAID 1 : (디스크 미러링)
- 최소 드라이브 개수 : 2
- 최대 용량 : (디스크의 수/2) x 디스크의 용량
- 특징 : 빠른 기록 속도와 함께 장애 복구 능력이 요구되는 경우
에 사용된다. 2대의 드라이브만으로 구성할 수
있기 때문에 작은 시스템에 적합하다.
RAID 0+1:
RAID 0으로 묶은 하드 디스크를 최종적으로 RAID 1로 구성
성능과 안정성을 동시에 추구할 수 있음.
따로 패리티 정보를 사용하지 않음
RAID 기능을 지원하는 웬만한 메인보드 컨트롤러 및
보급형 RAID 카드에서 RAID 0+1을 기본 지원하고 있어
RAID 3, 4와 달리 고급형 컨트롤러가 필요하지 않다.
- 최소 드라이브 개수 : 4
- 최대 용량 : (디스크의 수/2) x 디스크의 용량
- 특징 : 일반 RAID 1 구성보다 높은 성능을 낼 수 있으며
한쪽 RAID 0에 들어가는 하드들이 모두 고장난 경우에도
나머지 RAID 0 하드를 통해 정상 동작 및 데이터
복구를 할 수 있다.
RAID 10(1+0)
RAID 1로 구성된 하드들을 최종적으로 RAID 0 방식으로 병렬구성(striping)
해서 성능을 높이게 된다.
역시 RAID 1의 미러링을 기본으로 하고 있으므로
하드 1개가 고장나도 그와 함께 미러링 된 하드를 통해 데이터 복구가
가능하다.
(비교 116p 참고)
RAID 0+1은 양쪽 RAID 0 구성 중 하나씩 고장이 나면 전체 데이터가 손실되고, RAID 10은 미러링 된 하드 2개가
동시에 고장 날 경우 전체 데이터가 날아간다. 물론 그 대신 RAID 0+1은 미러링 된 한쪽이 하드 전체가 망가져도
데이터를 살릴 수 있고, RAID 10도 각 RAID 1 묶음에서 하나씩이 고장이 나도 이상 없이 동작한다.
그러나 RAID 0+1의 경우 1개의 하드만 고장 나서 복구해도 다른 RAID 0 구성에서 나머지 하드까지 데이터 전체
(A1~3, B1~3, C1~3)를 복구해야 하지만, RAID 10으로 만든 시스템은 고장난 하드가 A2, B2, C3 가 저장된 하드 1개
라고 하면 미러링으로 묶인 하드를 통해 A2, B2, C2 데이터만 복구하면 되므로 실제로 운영하는데는 RAID 10이 훨
씬 유리하다
RAID 5
RAID 5는 패리티정보를 스트라이핑으로 구성된 디스크 내에서
처리하게 만들었다.
물론 패리티 정보는 데이터가 저장된 디스크와는 물리적으로
다른 디스크에 저장되도록 만들어 1개의 하드가 고장 나더라도
남은 하드들을 통해 데이터를 복구할 수있도록 했다.
최소 3개부터 구성이 가능하며
하드 1개 용량만 빠지게 되므로 미러링으로 처리되는
RAID 1보다 저장공간도 크다.
패리티 정보가 데이터가 저장된 디스크와는
다른 디스크에 저장되기 때문에 위의 RAID 5 구성에서
만약에 3번 하드(Disk3)가 고장날 경우
A3, C2, D2, 데이터는 다른 하드에 별도로 저장된 패리티 정보를
통해서 복구하고 B 패리티 정보는 나머지 하드에 있는
B1, B2, B3 데이터를 토대로 다시 작성할 수 있다.
그러나 별도로 패리티 정보를 저장하는 작업을 해야 하므로
RAID 1보다 쓰기 성능이 떨어진다.
패리티 정보가 저장된 디스크가 따로 없어 패리티 디스크 고장과
같은 문제에서 자유롭고 실제 서버/워크스테이션에서 가장 많이
사용되는 방식이기도 하다.
보드나라 서버 역시 3개의 하드로 RAID 5를 구성하고 있다.
RAID 5 역시 XOR 연산을 필요로 하기 때문에
PCI 방식의 보급형 RAID 컨트롤러 카드나 데스크탑 메인보드의 내장
RAID 컨트롤러에서는 그 동안 거의 지원하지 않았던 규격이기도 하지만,
컴퓨터 성능이 올라간 요즘에는 메인보드 사우스브릿지 칩셋에
RAID 5 기능을 넣는 추세로 가고 있다.
- 최소 드라이브 개수 : 3
- 최대 용량 : (디스크의 수 - 1) x 디스크의 용량
- 특징 : 작고 랜덤한 입출력이 많은 경우 더 나은 성능을 제공한다.
빠른 기록속도가 필수적이지 않다면, 일반적인
다중사용자 환경을 위해 가장 좋은 선택이다.
그러나 최소한 3대, 일반적으로는 5대 이상의 드라이브가
필요하다.
---------------------------------------------------------------------------
--2. RAID 0 실습
단일 디스크 단위로 RAID 0 구성
lnx1 리눅스 가상머신에서 디스크 8개를 강사의 지시대로 추가
1. lnx1 리눅스 가상머신 Power-On
2.소프트 웨어 설치 유무 확인
# rpm -qa mdadm --mdadm 1.6 이하는 raid 10 지원 불가
mdadm-1.12.0-5
3. 추가된 디스크를 개별디스크 단위로 다음처럼 파티셔닝.
(주의 : 파티션 생성 후, 파티션시스템ID를 fd(Linux raid autodetect)로 변경)
# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 4966 39889363+ 83 Linux
/dev/sda2 4967 5221 2048287+ 82 Linux swap
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/sdf: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdf doesn't contain a valid partition table
Disk /dev/sdg: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdg doesn't contain a valid partition table
Disk /dev/sdh: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdh doesn't contain a valid partition table
Disk /dev/sdi: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdi doesn't contain a valid partition table
#
# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklab el
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): t --파티션시스템ID를 fd(Linux raid autodetect)로 변경하려고
Selected partition 1
Hex code (type L to list codes): L
0 Empty 1e Hidden W95 FAT1 80 Old Minix c1 DRDOS/sec (FAT-
1 FAT12 24 NEC DOS 81 Minix / old Lin c4 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 82 Linux swap c6 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c7 Syrinx
4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: da Non-FS data
5 Extended 41 PPC PReP Boot 85 Linux extended db CP/M / CTOS / .
6 FAT16 42 SFS 86 NTFS volume set de Dell Utility
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set df BootIt
8 AIX 4e QNX4.x 2nd part 8e Linux LVM e1 DOS access
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e3 DOS R/O
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e4 SpeedStor
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS eb BeOS fs
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ee EFI GPT
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ef EFI (FAT-12/16/
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD f0 Linux/PA-RISC b
10 OPUS 55 EZ-Drive a7 NeXTSTEP f1 SpeedStor
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f4 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f2 DOS secondary
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot fb VMware VMFS
16 Hidden FAT16 63 GNU HURD or Sys b7 BSDI fs fc VMware VMKCORE
17 Hidden HPFS/NTF 64 Novell Netware b8 BSDI swap fd Linux raid auto
18 AST SmartSleep 65 Novell Netware bb Boot Wizard hid fe LANstep
1b Hidden W95 FAT3 70 DiskSecure Mult be Solaris boot ff BBT
1c Hidden W95 FAT3 75 PC/IX bf Solaris
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): p
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ fd Linux raid autodetect
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#
같은방법으로
# fdisk /dev/sdc
...
...
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): p
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 2610 20964793+ fd Linux raid autodetect
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#
# fdisk /dev/sdd
# fdisk /dev/sde
# fdisk /dev/sdf
# fdisk /dev/sdg
# fdisk /dev/sdh
# fdisk /dev/sdi
# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 4966 39889363+ 83 Linux
/dev/sda2 4967 5221 2048287+ 82 Linux swap
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdf: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdg: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdg1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdh: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdh1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdi: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdi1 1 2610 20964793+ fd Linux raid autodetect
[root@ora100 ~]#
4. RAID 0 로 사용할 장치 구성 확인
# ls /dev/md*
/dev/md0 /dev/md12 /dev/md16 /dev/md2 /dev/md23 /dev/md27 /dev/md30 /dev/md6
/dev/md1 /dev/md13 /dev/md17 /dev/md20 /dev/md24 /dev/md28 /dev/md31 /dev/md7
/dev/md10 /dev/md14 /dev/md18 /dev/md21 /dev/md25 /dev/md29 /dev/md4 /dev/md8
/dev/md11 /dev/md15 /dev/md19 /dev/md22 /dev/md26 /dev/md3 /dev/md5 /dev/md9
만약 ls /dev/md* 확인 시 아무것도 안나온다면
다음의 명령어로 장치먼저 생성
# mknod /dev/md0 b 9 0 b: block 장치 9: 주장치번호 RAID 는 9 사용 0 : 장치번호
# mknod /dev/md1 b 9 1
# mknod /dev/md2 b 9 2
...
5. RAID-0 설정
# mdadm --create /dev/md0 -l 0 -n 3 /dev/sdb1 /dev/sdc1 /dev/sdd1 =>raid 0 설정
mdadm: array /dev/md0 started.
#
(기본 옵션 설명)
--create /dev/md0: /dev/md0 장치를 쓰는 RAID를 생성.
-l 0 : raid level 0
-n 3 : 사용할 디스크가 3개
/dev/sdb1 /dev/sdc1 /dev/sdd1: 해당 디바이스 장치들
--확인
# more /proc/mdstat
Personalities : [raid0]
md0 : active raid0 sdd1[2] sdc1[1] sdb1[0]
62894016 blocks 64k chunks
unused devices: <none>
# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.01
Creation Time : Tue Apr 13 16:10:26 2010
Raid Level : raid0
Array Size : 62894016 (59.98 GiB 64.40 GB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Tue Apr 13 16:10:26 2010
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Chunk Size : 64K
UUID : b86b8edd:9e75cfe5:4257a567:fdc5aca7
Events : 0.1
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 33 1 active sync /dev/sdc1
2 8 49 2 active sync /dev/sdd1
#
6. 생성된 /dev/md0 RAID 를 포맷
# mkfs.ext3 /dev/md0
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
7864320 inodes, 15723504 blocks
786175 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=16777216
480 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#
7. /dev/md0 RAID 를 마운트
# mkdir /raid0
# mount /dev/md0 /raid0
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 38G 3.6G 33G 10% /
none 506M 0 506M 0% /dev/shm
/dev/md0 60G 85M 56G 1% /raid0
8. 사용확인
# cd /mnt/hgfs/test/
[root@ora100 test]# ls
1 Enterprise-R5-U4-Server-i386-dvd.iso
Enterprise-R4-U8-i386-dvd.iso Enterprise-R5-U4-Server-x86_64-dvd.iso
Enterprise-R4-U8-x86_64-dvd.iso
# cp Enterprise-R4-U8-i386-dvd.iso /raid0/.
# cd /raid0/
# ls
Enterprise-R4-U8-i386-dvd.iso lost+found
#
(참고)
##### 부팅시 RAID 0 자동설정 및 자동 마운트 설정 #####
-- 시스템 부팅 시 RAID 0 구성을 위한 자동 설정 파일 생성
# mdadm --detail --scan >> /etc/mdadm.conf
# cat /etc/mdadm.conf
ARRAY /dev/md0 level=raid0 num-devices=3 UUID=b86b8edd:9e75cfe5:4257a567:fdc5aca7
-- 자동 마운트 설정
# vi /etc/fstab
....
/dev/md0 /raid0 ext3 defaults 0 0
(참고2)
-- RAID 0 중지
# mdadm -S /dev/md0 -- 사전에 umount 시키고, 마운트포인트(예,/raid0)
경로 이외의 경로에서 실행.
#
# mdadm --detail /dev/md0
mdadm: md device /dev/md0 does not appear to be active.
#
-- RAID 0 재시작
# mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm: /dev/md0 has been started with 3 drives.
# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.01
Creation Time : Tue Apr 13 19:25:32 2010
Raid Level : raid0
Array Size : 62894016 (59.98 GiB 64.40 GB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Tue Apr 13 19:25:32 2010
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Chunk Size : 64K
UUID : f21fb19f:522f673e:8ac5e234:79aa3b3d
Events : 0.1
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 33 1 active sync /dev/sdc1
2 8 49 2 active sync /dev/sdd1
#
# mount /dev/md0 /raid0
# cd /raid0
# ls
Enterprise-R4-U8-i386-dvd.iso lost+found
#
---------------------------------------------------------------
## Mirroring 구성 실습
RAID 1 : 장치 단위 미러링(디스크 파티션 용량이 모두 동일)
최소장치갯수: 2개
Primary Mirror
(100G + 100G 2개 장치) (100G + 100G 2개 장치)
RAID 5 : 패러티를 이용한 구성정보를 기반하여 미러링을 구성
(디스크 파티션 용량이 다르더라도 구성이 가능)
최소 장치 갯수: 3개
Primary Mirror
(20G + 30G + 50G) (10G +40G + 50G)
위의 2가지 미러링 방식에 있어서 유사 구성 시 성능비교를 하면
RAID 5의 경우 패러티 연산을 수행하는 과정이 같이 일어나므로
쓰기속도가 RAID 1에 비해 현저히 떨어짐
이를 극복하기 위하여 훨씬 많은 디스크 갯수를 늘림.
--3. RAID 1 실습
1) 장치 추가
2) 시스템 Power On
3) 추가 디스크 장치 파티셔닝
(fdisk, file-system-id: Linux raid autodetect (fd code)
# fdisk -l /dev/sde /dev/sdf
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdf: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf1 1 2610 20964793+ fd Linux raid autodetect
4) RAID 1 로 사용할 장치 구성 확인 및 구성
# ls -l /dev/md1
brw-r----- 1 root disk 9, 1 Apr 13 19:21 /dev/md1
또는
# mknod /dev/md1 b 9 1 -- 장치 생성
5) RAID-1 설정
# mdadm --create /dev/md1 --level=1 --raid-device=2 /dev/sde1 /dev/sdf1
# mdadm --create /dev/md1 --level=1 --raid-device=2 /dev/sde1 /dev/sdf1
mdadm: /dev/sde1 appears to contain an ext2fs file system
size=20964792K mtime=Thu Jan 1 09:00:00 1970
mdadm: /dev/sde1 appears to be part of a raid array:
level=0 devices=4 ctime=Wed Apr 14 13:36:04 2010
Continue creating array? y
mdadm: array /dev/md1 started.
#
(비교)
#mdadm --create /dev/md0 -l 1 -n 2 /dev/sde1 /dev/sdf1
-- 확인
# more /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdf1[1] sde1[0]
20964672 blocks [2/2] [UU]
[=======>.............] resync = 39.1% (8201344/20964672) finish=1.0min speed=200040K/sec
md0 : active raid0 sdd1[2] sdc1[1] sdb1[0]
62894016 blocks 64k chunks
unused devices: <none>
# mdadm --detail /dev/md1
/dev/md1:
Version : 00.90.01
Creation Time : Wed Apr 14 14:35:11 2010
Raid Level : raid1
Array Size : 20964672 (19.99 GiB 21.47 GB)
Device Size : 20964672 (19.99 GiB 21.47 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 1
Persistence : Superblock is persistent
Update Time : Wed Apr 14 14:35:11 2010
State : clean, resyncing
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Rebuild Status : 93% complete
UUID : f539a9f0:b226e331:02e041f7:843c3ae9
Events : 0.1
Number Major Minor RaidDevice State
0 8 65 0 active sync /dev/sde1
1 8 81 1 active sync /dev/sdf1
#
6) 생성된 /dev/md1 RAID 를 포맷
# mkfs.ext3 /dev/md1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5241168 blocks
262058 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=8388608
160 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#
7) /dev/md0 RAID 를 마운트
# mkdir /raid1
# mount /dev/md1 /raid1
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 38G 3.6G 33G 10% /
none 506M 0 506M 0% /dev/shm
.host:/ 366G 72G 295G 20% /mnt/hgfs
/dev/md0 60G 2.4G 54G 5% /raid0
/dev/md1 20G 77M 19G 1% /raid1
#
테스트
# cp /mnt/hgfs/test/Enterprise-R4-U8-i386-dvd.iso /raid1/
--용량크기와 시간을 측정
-- 장애가 발생 (/dev/sde1)
1) 장애난 디스클 fault 설정 수행
# mdadm /dev/md1 -f /dev/sde1
mdadm: set /dev/sde1 faulty in /dev/md1
#
2) 장애 장치 제거
# mdadm /dev/md1 -r /dev/sde1
mdadm: hot removed /dev/sde1
#
3)
(1) 새로운 디스크 장치를 추가
(2) fdisk 작업
(3) raid1에 장치 추가
# mdadm /dev/md1 --add /dev/sdg1
mdadm: hot added /dev/sdg1
#
VMWare 디스크 파일을 확인하면, 새로이 추가된 디스크에 자동으로
파일이 복사된것을 VMware Disk 파일 크키로 확인이 가능합니다.
=======================================================================
--4. RAID 5 실습
1) 디스크 추가 (4개의 SCSI 방식 디스크 추가, 각각 20G 용량임)
2) 시스템 Power-On
3) 파티셔닝 작업 (/dev/sde /dev/sdh /dev/sdi /dev/sdj)
# fdisk -l /dev/sde /dev/sdh /dev/sdi /dev/sdj
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/sdh: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdh doesn't contain a valid partition table
Disk /dev/sdi: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdi doesn't contain a valid partition table
Disk /dev/sdj: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdj doesn't contain a valid partition table
# fdisk /dev/sde
# fdisk /dev/sdh
# fdisk /dev/sdi
# fdisk /dev/sdj
# fdisk -l /dev/sde /dev/sdh /dev/sdi /dev/sdj
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdh: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdh1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdi: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdi1 1 2610 20964793+ fd Linux raid autodetect
Disk /dev/sdj: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdj1 1 2610 20964793+ fd Linux raid autodetect
#
4) RAID 5 로 사용할 장치 구성 확인 및 구성
# ls -l /dev/md5
brw-r----- 1 root disk 9, 5 Apr 13 19:21 /dev/md5
또는
# mknod /dev/md5 b 9 5 -- 장치 생성
5) RAID-5 설정
# mdadm --create /dev/md5 --level=5 --raid-device=3 /dev/sde1 /dev/sdh1 /dev/sdi1
mdadm: array /dev/md5 started.
#
-- 확인
--패러티정보 구성중
# more /proc/mdstat
Personalities : [raid0] [raid1] [raid5]
md5 : active raid5 sdi1[3] sdh1[1] sde1[0]
41929344 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]
[=====>...............] recovery = 25.4% (5329664/20964672) finish=1.2min speed=204987K/sec
md1 : active raid1 sdg1[0] sdf1[1]
20964672 blocks [2/2] [UU]
md0 : active raid0 sdd1[2] sdc1[1] sdb1[0]
62894016 blocks 64k chunks
unused devices: <none>
# mdadm --detail /dev/md5
/dev/md5:
Version : 00.90.01
Creation Time : Wed Apr 14 16:30:39 2010
Raid Level : raid5
Array Size : 41929344 (39.99 GiB 42.94 GB)
Device Size : 20964672 (19.99 GiB 21.47 GB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 5
Persistence : Superblock is persistent
Update Time : Wed Apr 14 16:30:39 2010
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 37% complete
UUID : 09408c7a:093207f5:0d618ec2:b9c63ce9
Events : 0.1
Number Major Minor RaidDevice State
0 8 65 0 active sync /dev/sde1
1 8 113 1 active sync /dev/sdh1
2 0 0 - removed
3 8 129 2 spare rebuilding /dev/sdi1 --패러티 정보구성중
#
-- 패러티 구성완료 후
# more /proc/mdstat
Personalities : [raid0] [raid1] [raid5]
md5 : active raid5 sdi1[2] sdh1[1] sde1[0]
41929344 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
md1 : active raid1 sdg1[0] sdf1[1]
20964672 blocks [2/2] [UU]
md0 : active raid0 sdd1[2] sdc1[1] sdb1[0]
62894016 blocks 64k chunks
unused devices: <none>
# mdadm --detail /dev/md5
/dev/md5:
Version : 00.90.01
Creation Time : Wed Apr 14 16:30:39 2010
Raid Level : raid5
Array Size : 41929344 (39.99 GiB 42.94 GB)
Device Size : 20964672 (19.99 GiB 21.47 GB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 5
Persistence : Superblock is persistent
Update Time : Wed Apr 14 16:32:24 2010
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : 09408c7a:093207f5:0d618ec2:b9c63ce9
Events : 0.2
Number Major Minor RaidDevice State
0 8 65 0 active sync /dev/sde1
1 8 113 1 active sync /dev/sdh1
2 8 129 2 active sync /dev/sdi1
#
6) 생성된 /dev/md5 RAID 를 포맷
# mkfs.ext3 /dev/md5
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
5242880 inodes, 10482336 blocks
524116 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=12582912
320 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#
7) /dev/md5 RAID 를 마운트
# mkdir /raid5
# mount /dev/md5 /raid5
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 38G 3.6G 33G 10% /
none 506M 0 506M 0% /dev/shm
.host:/ 366G 77G 290G 21% /mnt/hgfs
/dev/md0 60G 2.4G 54G 5% /raid0
/dev/md1 20G 2.4G 17G 13% /raid1
/dev/md5 40G 81M 38G 1% /raid5 -- 20G 3EA 인데 40G 용량입니다.
#
8) 미러링 테스트
--(참고)
VMWare 사용시 추가된 디스크에 해당하는 파일 크기를 확인해 봅니다.
/dev/sde : disk4.vmdk 2.624KB --/dev/md5
/dev/sdh : disk7.vmdk 2.624KB --/dev/md5
/dev/sdi : disk8.vmdk 2.624KB --/dev/md5
/dev/sde : disk4.vmdk 2.624KB --not used
-- 약 2.23GB 용량의 파일을 하나 복사해봅니다.
# cp /mnt/hgfs/test/Enterprise-R4-U8-i386-dvd.iso /raid5/
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 38G 3.6G 33G 10% /
none 506M 0 506M 0% /dev/shm
.host:/ 366G 80G 287G 22% /mnt/hgfs
/dev/md0 60G 2.4G 54G 5% /raid0
/dev/md1 20G 2.4G 17G 13% /raid1
/dev/md5 40G 2.4G 36G 7% /raid5
(참고)
VMWare 사용시 복사완료 후 추가된 디스크에 해당하는 파일 크기를 확인해 봅니다.
/dev/sde : disk4.vmdk 1,145,600KB --/dev/md5
/dev/sdh : disk7.vmdk 1,143,552KB --/dev/md5
/dev/sdi : disk8.vmdk 1,143,616KB --/dev/md5
/dev/sde : disk4.vmdk 2.688KB --not used
장애복구
9) 장애 발생 (/dev/sde1 디스크가 장애가 발생함.)
# fdisk /dev/sde -- 장애를 발생시키기 위하여 sde 디스크의 파티션을 삭제해봅니다.
# mdadm -D /dev/md5
# mdadm -D /dev/md5
/dev/md5:
Version : 00.90.01
Creation Time : Wed Apr 14 16:30:39 2010
Raid Level : raid5
Array Size : 41929344 (39.99 GiB 42.94 GB)
Device Size : 20964672 (19.99 GiB 21.47 GB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 5
Persistence : Superblock is persistent
Update Time : Wed Apr 14 16:43:16 2010
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : 09408c7a:093207f5:0d618ec2:b9c63ce9
Events : 0.384
Number Major Minor RaidDevice State
0 8 65 0 active sync /dev/sde1
1 8 113 1 active sync /dev/sdh1
2 8 129 2 active sync /dev/sdi1
1> 장애난 디스클 fault 설정 수행
# mdadm /dev/md5 -f /dev/sde1
mdadm: set /dev/sde1 faulty in /dev/md5
#
2> 장애 장치 제거
# # mdadm /dev/md5 -r /dev/sde1
mdadm: hot removed /dev/sde1
#
3>
(1) 새로운 디스크 장치를 추가
(2) fdisk 작업
(3) raid1에 장치 추가
# mdadm /dev/md5 --add /dev/sdj1
mdadm: hot added /dev/sdj1
#
# mdadm -D --scan /dev/md5
/dev/md5:
Version : 00.90.01
Creation Time : Wed Apr 14 16:30:39 2010
Raid Level : raid5
Array Size : 41929344 (39.99 GiB 42.94 GB)
Device Size : 20964672 (19.99 GiB 21.47 GB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 5
Persistence : Superblock is persistent
Update Time : Wed Apr 14 16:48:48 2010
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 4% complete -- 복구진행 정도가 표시됩니다.
UUID : 09408c7a:093207f5:0d618ec2:b9c63ce9
Events : 0.387
Number Major Minor RaidDevice State
0 0 0 - removed
1 8 113 1 active sync /dev/sdh1
2 8 129 2 active sync /dev/sdi1
3 8 145 0 spare rebuilding /dev/sdj1
#
VMWare 디스크 파일을 확인하면, 새로이 추가된 디스크에 자동으로
파일이 복사된것을 VMware Disk 파일 크키로 확인이 가능합니다.
VMWare 사용시 복구완료 후 추가된 디스크에 해당하는 파일 크기를 확인해 봅니다.
/dev/sde : disk4.vmdk 1.13GB --not used
/dev/sdh : disk7.vmdk 1.13GB --/dev/md5
/dev/sdi : disk8.vmdk 1.13GB --/dev/md5
/dev/sde : disk4.vmdk 1.14GB --/dev/md5
'OS관련 > Linux Study' 카테고리의 다른 글
B110i HP 컨트롤러 레이드 구성이 안될때... (0) | 2015.08.04 |
---|---|
LVM 구성 가이드 (0) | 2012.03.03 |
Send E-mail 죽이는 방법 (0) | 2012.03.03 |
계속 마운트 하고 싶은 경우 (0) | 2012.03.03 |
32비트리눅스에서 4기가이상메모리사용 (0) | 2012.03.03 |
'OS관련/Linux Study' Related Articles
- B110i HP 컨트롤러 레이드 구성이 안될때... 2015.08.04
- LVM 구성 가이드 2012.03.03
- Send E-mail 죽이는 방법 2012.03.03
- 계속 마운트 하고 싶은 경우 2012.03.03