linux class 3 페이지

본문 바로가기
사이트 내 전체검색


회원로그인

linux class

RAID

페이지 정보

작성자 admin 작성일15-12-23 15:15 조회234회 댓글2건

본문

RAID

1. raid 0 volume (stripe volume)

raid0.jpg



최소디스크 : 2개 이상 필요
장점
- read / write 속도 빠르다.
- 디스크 가용률 100%
단점
- redundancy 안됨. 디스크 하나가 손상되면 나머지 디스크 데이터 전부 사용 불가

[root@centos1 ~]# fdisk /dev/sdb

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512):
Using default value 512

Command (m for help): p

Disk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 512 524272 83 Linux
Command (m for help): t ---> 그다음 타입을 fd 로 변경.

Device Boot Start End Blocks Id System
/dev/sdb1 1 512 524272 fd Linux raid autodetect

Command (m for help):

[root@centos1 ~]# ls -l /dev/md0
brw-r----- 1 root disk 9, 0 29 22:15 /dev/md0
[root@centos1 ~]#

[root@centos1 ~]# mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdc1
mdadm: /dev/sdb1 appears to contain an ext2fs file system
size=98288K mtime=Fri Jul 16 06:01:25 2010
mdadm: /dev/sdc1 appears to contain an ext2fs file system
size=524272K mtime=Sun Aug 29 22:28:52 2010
Continue creating array? y
mdadm: array /dev/md0 started.
[root@centos1 ~]#
[root@centos1 ~]# mdadm --detail --scan
ARRAY /dev/md0 level=raid0 num-devices=2 UUID=e5c9fc56:b8962bf1:c6f4ad04:0a23a9a3
[root@centos1 ~]#
[root@centos1 ~]# mkfs -t ext3 /dev/md0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
131072 inodes, 262080 blocks
13104 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@centos1 ~]#

* raid 구성 제거

mdadm --stop /dev/md5
mdadm --remove /dev/md5
mdadm --zero-superblock /dev/sdb1 ( /dev/sdc1 /dev/sdd1)


===============================================
2. raid 1 volume (mirror volume)

raid1.jpg




최소디스크 : 2개이상 필요
장점 : redundancy
단점 : 디스크 가용률 50%
*. read 속도는 빠르다.
*. write 속도는 보통
[root@centos1 dev]# mknod md1 b 9 1
[root@centos1 dev]# ls -l md1
brw-r--r-- 1 root root 9, 1 8¿u 29 22:46 md1
[root@centos1 dev]# mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdd1 /dev/sde1
mdadm: array /dev/md1 started.
[root@centos1 dev]# mdadm --detail --scan
ARRAY /dev/md0 level=raid0 num-devices=2 UUID=e5c9fc56:b8962bf1:c6f4ad04:0a23a9a3
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=9607e571:30f84644:05a52c29:723425f6
[root@centos1 dev]#

[root@centos1 etc]# mdadm --detail --scan -v
ARRAY /dev/md0 level=raid0 num-devices=2 UUID=e5c9fc56:b8962bf1:c6f4ad04:0a23a9a3
devices=/dev/sdb1,/dev/sdc1
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=9607e571:30f84644:05a52c29:723425f6
devices=/dev/sdd1 ; /dev/sde °iAa (½CA|´A sdd °iAa)
[root@centos1 etc]#

[root@centos1 ~]# mdadm /dev/md1 --add /dev/sdd1
mdadm: added /dev/sdd1
[root@centos1 ~]# mdadm --detail --scan -v
ARRAY /dev/md0 level=raid0 num-devices=2 UUID=e5c9fc56:b8962bf1:c6f4ad04:0a23a9a3
devices=/dev/sdb1,/dev/sdc1
ARRAY /dev/md1 level=raid1 num-devices=2 spares=1 UUID=9607e571:30f84644:05a52c29:723425f6
devices=/dev/sdd1,/dev/sde1
[root@centos1 ~]#

----------------------------------------------------------------------------------

3. raid 5 volume
raid5.jpg



최소디스크 : 3개이상 필요
장점: 디스크 1개가 fail(고장) 발생하더라도 데이터 복구가능
단점: 디스크를 가용할 수 있는 용량은 전체 디스크 갯수 - 1
* 성능이 그리 중요하지 않고 쓰기 작업이 많지 않은
다중 사용자시스템에 적합하다.

[root@centos1 ~]# mdadm --create /dev/md5 --level=5 --raid-devices=3 /dev/sdd1 /dev/sde1 /dev/sdf1
mdadm: array /dev/md5 started.
[root@centos1 ~]# mdadm --detail --scan -v
ARRAY /dev/md5 level=raid5 num-devices=3 spares=1 UUID=3639187d:d7eb011f:4df7428a:7e44acfb
devices=/dev/sdd1,/dev/sde1,/dev/sdf1
[root@centos1 ~]#


[root@centos1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 4.8G 4.5G 12M 100% /
/dev/sda5 487M 11M 451M 3% /data
/dev/sda2 1.6G 717M 812M 47% /home
tmpfs 252M 0 252M 0% /dev/shm
/dev/md5 1008M 18M 940M 2% /r5data
[root@centos1 ~]# mdadm --detail --scan -v
ARRAY /dev/md5 level=raid5 num-devices=3 UUID=3639187d:d7eb011f:4df7428a:7e44acfb
devices=/dev/sdd1,/dev/sde1,/dev/sdf1
[root@centos1 ~]# fdisk -l /dev/sdd

Disk /dev/sdd: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 512 524272 fd Linux raid autodetect
[root@centos1 ~]# fdisk -l /dev/sde

Disk /dev/sde: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sde1 1 512 524272 fd Linux raid autodetect
[root@centos1 ~]# fdisk -l /dev/sdf

Disk /dev/sdf: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdf1 1 512 524272 fd Linux raid autodetect
[root@centos1 ~]#


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

4. raid 0 + 1 (striped mirror volume)
raid01.jpg

최소디스크 : 4개 이상 필요
장점 : stripe 와 mirror 동시에 적용
단점 : 비용이 많이 발생
*. centos에서는 이 레벨을 지원하지 않으므로 0+1 을 구성하려면
stripe 볼륨을 먼저 구성하고 그것을 다시 mirror 볼륨으로 구성해야 한다.

[root@centos1 ~]# mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdc1
[root@centos1 ~]# mdadm --create /dev/md1 --level=0 --raid-devices=2 /dev/sdd1 /dev/sde1
mdadm: array /dev/md1 started.
[root@centos1 ~]# mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/md0 /dev/md1
mdadm: /dev/md0 appears to contain an ext2fs file system
size=98288K mtime=Fri Jul 16 06:01:25 2010
Continue creating array? y
mdadm: array /dev/md2 started.
[root@centos1 ~]# md
-bash: md: command not found
[root@centos1 ~]# mdadm --detail --scan -v
ARRAY /dev/md0 level=raid0 num-devices=2 UUID=23f38967:54f10aa2:c7facd0d:f0afc274
devices=/dev/sdb1,/dev/sdc1
ARRAY /dev/md1 level=raid0 num-devices=2 UUID=df3f180c:fbcaf03c:bbbbdc34:0d5f4343
devices=/dev/sdd1,/dev/sde1
ARRAY /dev/md01 level=raid1 num-devices=2 UUID=f98ef347:3ea6295a:64a8d04a:52015a93
devices=/dev/md0,/dev/md1
[root@centos1 ~]#

=====================================================
5. raid 1+0 volume (mirrored stripe volume)
raid10.jpg


# mdadm --create /dev/md10 --level=10 --raid-devices=4 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdef1
최소 디스크 : 4개이상 필요
장점 : stripe 와 mirror 동시에 적용.
단점 : 비용이 많이 발생
*. raid 0+1 과 비슷하지만 raid 0+1 에 비해서 좀 더 효율적이다.

=====================================================
* raid 옵션
cat /proc/mdstat --> 상태확인
mdadm --detail /dev/md0
--remove : raid disk 제거 ex) mdadm --manage /dev/md0 --remove /dev/sdc1
--add : raid disk 추가 ex) mdadm --manage /dev/md0 --add /dev/sdc1
--fail : raid disk 강제 fail ex) mdadm --manage /dev/md0 --fail /dev/sdc1
-S(--stop) : raid 정지 ex) mdadm --stop /dev/md0
-r(--remove) : raid 제거 ex) mdadm -r /dev/md0

댓글목록

닉네임님의 댓글

닉네임 작성일

선생님 안녕하세요 작년 5~7월달에 들었던 이준호입니다.
Raid 1 부분의 이미지가 Raid 5로 등록되어있습니다... 수정좀 부탁드립니다 ㅠㅠ

admin님의 댓글

admin 댓글의 댓글 작성일

그렇구나. 알려줘서 고맙다 ^^


접속자집계

오늘
52
어제
61
최대
611
전체
452,949
개인정보취급방침 서비스이용약관 twoseven.kr All rights reserved.
상단으로