Linux Raid 디스크 구성

이동명·2023년 11월 9일
0

Cent OS

목록 보기
12/13
post-thumbnail

Raid(Redundant Array of Inexpensive Disks)

  • 다수의 디스크를 논리적인 하나의 디스크로 구성하여 데이터를 분산 저장하고 동시에 여러개를 읽어들이는 기능을 제공한다.

  • 이를 통해서 데이터 저장/관리에 대한 신뢰성/안정성/이중성 보장, 성능/속도 향상이 가능하다

Raid 를 위한 파티션 작업 실시

  • 작업 대상 : /dev/sdc, /dev/sdd, /dev/sde, /dev/sdf, /dev/sdg

  • 파티션 용량 : 전체

  • 타입 : Raid 타입

일단 파티션 5개 raid 로 만들어주자..

Raid 유형

Raid 0(Striping)

순차적으로 저장

구성

mdadm --create /dev/md0 --level=0 --raid-devices=3 /dev/sdc1 /dev/sdd1 /dev/sde1 -> 200 M 짜리 3개 raid 0 구성..

ls -l /dev/md0 -> 

fdisk -l /dev/md0 -> Size 600 M

mdadm --detail --scan -v -> 장치 구성 정보

cat /proc/mdstat -> 

mkfs -t ext4 /dev/md0 > /dev/null -> 파일시스템 포맷

mkdir /mnt/raid0

mount /dev/md0 /mnt/raid0 -> 마운트

df -h

삭제

umount /dev/md0 -> 마운트 해제

df -h | head -1 ; df -h | grep md0

rm -rf /mnt/raid0 

mdadm --stop /dev/md0 -> raid stop

mdadm --zero-superblock /dev/sdc1 /dev/sdd1 /dev/sde1 -> 초기화

dadm --examine /dev/sdc1 /dev/sdd1 /dev/sde1 -> 초기화

ls -l /dev/md0

Raid 1(Mirroring)

구성

200M 2개를 raid1 로 구성 해서 200M 용량 사용가능.

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdf1 /dev/sdg1

ls -l /dev/md1

fdisk -l /dev/md1

mdadm --detail --scan -v

cat /proc/mdstat

mkfs -t ext4 /dev/md1 > /dev/null

mkdir /mnt/raid1

mount /dev/md1 /mnt/raid1

df -h

삭제


umount /dev/md1

df -h | head -1 ; df -h | grep md1

rm -rf /mnt/raid1

mdadm --stop /dev/md1

mdadm --zero-superblock  /dev/sdf1 /dev/sdg1

mdadm --examine  /dev/sdf1 /dev/sdg1

ls -l /dev/md1

Raid 4(Parity)

  • Raid 4 구성 : /dev/sdc1(200M), /dev/sdd1(200M), /dev/sde1(200M)

  • 2개의 disk는 raid0(RR)으로 나머지 1개는 패리티정보

  • disk 개수는 전체 - 1

  • 패리티정보 디스크가 장애가 생길 시 복원이 쉽지 않음


mdadm --create /dev/md4 --level=4 --raid-devices=3 /dev/sdc1 /dev/sdd1 

/dev/sde1

ls -l /dev/md4

fdisk -l /dev/md4

mdadm --detail --scan -v

cat /proc/mdstat

mkfs -t ext4 /dev/md4 > /dev/null

mkdir /mnt/raid4

mount /dev/md4 /mnt/raid4

df -h 

삭제

umount /dev/md4


df -h 

rm -rf /mnt/raid4

mdadm --stop /dev/md4

cat /proc/mdstat

mdadm --zero-superblock /dev/sdc1 /dev/sdd1 /dev/sde1

mdadm --examine /dev/sdc1 /dev/sdd1 /dev/sde1

ls -l /dev/md4

Raid 5(Distributed Parity)

  • Raid 5 구성 : /dev/sdc1(200M), /dev/sdd1(200M), /dev/sde1(200M)
  • raid 4 와의 가장 큰 차이는 패리티 정보를 담는 디스크가 각각의 디스크에 있음.
  • disk 개수 : 전체개수 - 1 ( 왠만하면 disk 짝수 구성이 좋다 )

mdadm --create /dev/md5 --level=5 --raid-devices=3 /dev/sdc1 /dev/sdd1 

/dev/sde1

ls -l /dev/md5

fdisk -l /dev/md5

mdadm --detail --scan -v

cat /proc/mdstat

mkfs -t ext4 /dev/md5 > /dev/null

mkdir /mnt/raid5

mount /dev/md5 /mnt/raid5

df -h 

삭제

umount /dev/md5

df -h 

rm -rf /mnt/raid5

mdadm --stop /dev/md5

cat /proc/mdstat

mdadm --zero-superblock /dev/sdc1 /dev/sdd1 /dev/sde1

mdadm --examine /dev/sdc1 /dev/sdd1 /dev/sde1

ls -l /dev/md5

Raid 6(Dual Parity)

  • Raid 6 구성 : /dev/sdc1(200M), /dev/sdd1(200M), /dev/sde1(200M), /dev/sdf1(200M), /dev/sdg1(200M)

mdadm --create /dev/md6 --level=6 --raid-devices=5 /dev/sdc1 /dev/sdd1 

/dev/sde1 /dev/sdf1 /dev/sdg1

ls -l /dev/md6

fdisk -l /dev/md6

mdadm --detail --scan -v

cat /proc/mdstat

mkfs -t ext4 /dev/md6 > /dev/null

mkdir /mnt/raid6

mount /dev/md6 /mnt/raid6

df -h 

삭제


umount /dev/md6

df -h 

rm -rf /mnt/raid6

mdadm --stop /dev/md6

cat /proc/mdstat

mdadm --zero-superblock /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1

mdadm --examine /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1

ls -l /dev/md6

Raid 0+1(Stripe + Mirror)

  • Raid 0+1 구성 : /dev/sdc1(200M), /dev/sdd1(200M), /dev/sde1(200M), /dev/sdf1(200M)
mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdc1 /dev/sdd1

mdadm --create /dev/md1 --level=0 --raid-devices=2 /dev/sde1 /dev/sdf1

mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/md0 /dev/md1

ls -l /dev/md2

fdisk -l /dev/md2

mdadm --detail --scan -v

cat /proc/mdstat

mkfs -t ext4 /dev/md2 > /dev/null

mkdir /mnt/raid01

mount /dev/md2 /mnt/raid01

df -h 

삭제

umount /dev/md2

df -h 

rm -rf /mnt/raid01

mdadm --stop /dev/md2

cat /proc/mdstat

mdadm --zero-superblock /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

mdadm --examine /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

ls -l /dev/md2

ls -l /dev/md1

ls -l /dev/md0

Raid 1+0(Mirror + Stripe)

  • Raid 1+0 구성 : /dev/sdc1(200M), /dev/sdd1(200M), /dev/sde1(200M), /dev/sdf1(200M)

mdadm --create /dev/md10 --level=10 --raid-devices=4 /dev/sdc1 /dev/sdd1 

/dev/sde1 /dev/sdf1

ls -l /dev/md10

fdisk -l /dev/md10

mdadm --detail --scan -v

cat /proc/mdstat

mkfs -t ext4 /dev/md10 > /dev/null

mkdir /mnt/raid10

mount /dev/md10 /mnt/raid10

df -h 

삭제


umount /dev/md10


df -h 

rm -rf /mnt/raid10

mdadm --stop /dev/md10

cat /proc/mdstat

mdadm --zero-superblock /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

mdadm --examine /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

ls -l /dev/md10
profile
Web Developer

0개의 댓글