๐Ÿ“‚๋„คํŠธ์›Œํฌ&์„œ๋ฒ„/๐Ÿง๋ฆฌ๋ˆ…์Šค(Linux)

RAID๋ž€? ๋ ˆ์ด๋“œ ๋ ˆ๋ฒจ(์ข…๋ฅ˜)๊ณผ ๋ฐฑ์—…๊ณผ์˜ ์ฐจ์ด์ ! RAID ๋ ˆ๋ฒจ ๋ช…๋ น์–ด ํ•œ๋ฒˆ์— ์ด์ •๋ฆฌ ์ด๊ฑธ๋กœ ๋

๐Ÿ‘ฉ‍๐ŸŽ“์ธํ…”๋ฆฌ๊ฐ์ž๐Ÿฅ” 2024. 4. 8. 12:02

RAID๋ž€?

RAID(Redundant Array of Inexpensive Disks)๋Š” ์—ฌ๋Ÿฌ๊ฐœ์˜ ๋””์Šคํฌ๋ฅผ ๋ฌถ์–ด ํ•˜๋‚˜์˜ ๋””์Šคํฌ ์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜๋Š” ๊ธฐ์ˆ ์ž…๋‹ˆ๋‹ค. 2๊ฐœ ์ด์ƒ์˜ ๋””์Šคํฌ๋ฅผ ๋ณ‘๋ ฌ๋กœ ์ฒ˜๋ฆฌํ•˜์—ฌ ์„ฑ๋Šฅ ๋ฐ ์•ˆ์ •์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ค๋ฉฐ, ์†๋„์˜ ์ฆ๋Œ€, ์•ˆ์ •์„ฑ์˜ ์ฆ๋Œ€, ํšจ์œจ์„ฑ, ๊ฐ€์šฉ์„ฑ์˜ ์ฆ๋Œ€๋ฅผ ํ•˜๋Š”๋ฐ ์“ฐ์ด๋Š” ๊ธฐ์ˆ ์ž…๋‹ˆ๋‹ค. 

 

RAID์˜ ์ข…๋ฅ˜

๋ ˆ์ด๋“œ์˜ ์ข…๋ฅ˜๋Š” ๋ ˆ๋ฒจ์— ๋”ฐ๋ผ ๋‹ฌ๋ผ์ง‘๋‹ˆ๋‹ค. ์ด๋ฅผ ํ‘œ๋กœ ์ •๋ฆฌํ•ด ๋ดค์Šต๋‹ˆ๋‹ค. 

๋ช…์นญ ๋ณ„์นญ ํ•ต์‹ฌ ํŠน์ง• ๋””์Šคํฌ ์‚ฌ์šฉ๋Ÿ‰ ๋””์Šคํฌ ๋ณต๊ตฌ
linear RAID ์„ ํ˜• ๊ฐ ๋””์Šคํฌ์˜ ์šฉ๋Ÿ‰์ด ๋‹ฌ๋ผ๋„ ์ „์ฒด ์šฉ๋Ÿ‰ ์‚ฌ์šฉ ๊ฐ€๋Šฅ 
๊ณต๊ฐ„ ํšจ์œจ์„ฑ 100%
2๊ฐœ ์ด์ƒ 2T(N)
*T: ํ…Œ๋ผ
N: ๋””์Šคํฌ ๊ฐœ์ˆ˜
X
RAID 0 Striping ์†๋„๊ฐ€ ๋น ๋ฅด๋‹ค 2๊ฐœ ์ด์ƒ 2T(N) X
RAID 1 mirroring ๋ฐ์ดํ„ฐ ์†์ƒX 2๊ฐœ ์ด์ƒ 1T(N/2) O
RAID 10 Striping + mirroring ์†๋„๊ฐ€ ๋น ๋ฅด๋ฉด์„œ ๋ณต๊ตฌ๋„ ๋œ๋‹ค 4๊ฐœ ์ด์ƒ 1T(N/2) O
RAID 5 Stripe with parity ํŒจ๋ฆฌํ‹ฐ ๋น„ํŠธ ์‚ฌ์šฉ -> ๊ณต๊ฐ„ ํšจ์œจ ์ข‹์Œ 3๊ฐœ ์ด์ƒ 2t(N-1) O
RAID 6 double parity RAID 2๊ฐœ์˜ ๋””์Šคํฌ๊ฐ€ ๊ณ ์žฅ๋‚˜๋„ ๋ณต๊ตฌ ๊ฐ€๋Šฅ 4๊ฐœ ์ด์ƒ 2T(N-2) O

 

 

RAID์™€ ๋ฐฑ์—…์˜ ์ฐจ์ด์ 

RAID

  • RAID: ์ฃผ๋กœ ํ•˜๋“œ์›จ์–ด ๋˜๋Š” ์†Œํ”„ํŠธ์›จ์–ด ๊ธฐ์ˆ ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ์˜ ๊ฐ€์šฉ์„ฑ, ์„ฑ๋Šฅ ๋ฐ/๋˜๋Š” ์•ˆ์ •์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ค๋Š” ๊ธฐ์ˆ ์ž…๋‹ˆ๋‹ค.
  • ์ผ๋ฐ˜์ ์œผ๋กœ ์„œ๋ฒ„ ๋˜๋Š” NAS(Network Attached Storage) ์‹œ์Šคํ…œ์—์„œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
  • RAID๋Š” ํ•˜๋“œ ๋“œ๋ผ์ด๋ธŒ์˜ ์˜ค๋ฅ˜๋ฅผ ๋Œ€๋น„ํ•˜์—ฌ ์—ฌ๋Ÿฌ ๋””์Šคํฌ ๊ฐ„์— ๋ฐ์ดํ„ฐ๋ฅผ ๋ถ„์‚ฐ์‹œํ‚ค๊ณ  ๋ณต์ œํ•จ์œผ๋กœ์จ ์‹œ์Šคํ…œ์˜ ๋‚ด๊ฒฐํ•จ์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค.

๋ฐฑ์—…

  • ๋ฐฑ์—…: ๋ฐ์ดํ„ฐ๋ฅผ ์•ˆ์ „ํ•˜๊ฒŒ ๋ณดํ˜ธํ•˜๊ณ  ๋ณต๊ตฌํ•˜๊ธฐ ์œ„ํ•ด ์ •๊ธฐ์ ์œผ๋กœ ์ƒ์„ฑ๋œ ๋ฐ์ดํ„ฐ์˜ ๋ณต์‚ฌ๋ณธ์„ ๋ณด๊ด€ํ•˜๋Š” ํ”„๋กœ์„ธ์Šค ๋˜๋Š” ํ™œ๋™์ž…๋‹ˆ๋‹ค.
  • ์ •๊ธฐ์ ์ธ ์ฃผ๊ธฐ๋กœ ๋ฐ์ดํ„ฐ์˜ ๋ณต์‚ฌ๋ณธ์„ ์ƒ์„ฑํ•˜๊ณ  ๋ณด๊ด€ํ•ฉ๋‹ˆ๋‹ค.
  • ๋ฐฑ์—…๋œ ๋ฐ์ดํ„ฐ๋Š” ๋ณด๊ด€ ๊ธฐ๊ฐ„์— ๋”ฐ๋ผ ๋‹ค๋ฅธ ์ €์žฅ ์žฅ์น˜์— ์ €์žฅ๋ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ์™ธ๋ถ€ ํ•˜๋“œ ๋“œ๋ผ์ด๋ธŒ, ๋„คํŠธ์›Œํฌ ์ €์žฅ์†Œ, ํด๋ผ์šฐ๋“œ ์„œ๋น„์Šค ๋“ฑ์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. 

=> ์š”์•ฝ: RAID๋Š” ์ฃผ๋กœ ๋ฐ์ดํ„ฐ์˜ ๊ฐ€์šฉ์„ฑ๊ณผ ์„ฑ๋Šฅ์„ ํ–ฅ์ƒ์‹œํ‚ค๊ณ  ์‹œ์Šคํ…œ์˜ ๋‚ด๊ฒฐํ•จ์„ฑ(fault-tolerance)์„ ๋†’์ด๊ธฐ ์œ„ํ•œ ๊ธฐ์ˆ ์ด๋ฉฐ, ๋ฐฑ์—…์€ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณดํ˜ธํ•˜๊ณ  ๋ณต๊ตฌํ•˜๊ธฐ ์œ„ํ•œ ํ”„๋กœ์„ธ์Šค์ž…๋‹ˆ๋‹ค.

 

๋ ˆ์ด๋“œ ๋งŒ๋“ค๊ธฐ ๊ณผ์ •

ํ•˜๋“œ๋””์Šคํฌ ์‚ฝ์ž… > ํŒŒํ‹ฐ์…˜ > mdadm(๋ ˆ์ด๋“œ ๊ตฌ์„ฑ) > ํฌ๋งท > ๋งˆ์šดํŠธ ํฌ์ธํŠธ ์ƒ์„ฑ ๋ฐ ๋งˆ์šดํŠธ ํ•ด์ฃผ๊ธฐ

 

๋ ˆ์ด๋“œ์šฉ ํŒŒํ‹ฐ์…˜ ์ƒ์„ฑ ๋ช…๋ น์–ด

fdisk -> n -> p -> enter -> enter -> t -> fd(๋ ˆ์ด๋“œ์˜ hex code) -> w(write)

fdisk /dev/sdi  // ํŒŒํ‹ฐ์…˜ ์ƒ์„ฑ

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x2272607d.

Command (m for help): n   //new
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p    //primary
Partition number (1-4, default 1): 
First sector (2048-2097151, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-2097151, default 2097151): 

Created a new partition 1 of type 'Linux' and of size 1023 MiB.

Command (m for help): t  //table
Selected partition 1
Hex code (type L to list all codes): fd  //RAID์˜ Hex code
Changed type of partition 'Linux' to 'Linux raid autodetect'.

Command (m for help): w //write
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

 

๋ ˆ์ด๋“œ ๊ตฌ์„ฑ ๋ช…๋ น์–ด

mdadm --create /dev/md9 --level=linear --raid-devices=2 /dev/sdb1 /dev/sdc1
mdadm -C /dev/md0 -l 0 -n 2 /dev/sdd1 /dev/sde1
mdadm -C /dev/md1 -l 1 -n 2 /dev/sdf1 /dev/sdg1
mdadm -C /dev/md5 -l 5 -n 3 /dev/sdh1 /dev/sdi1 /dev/sdk1

๋‘˜ ๋‹ค ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 

 

ํฌ๋งท ํ›„ ๋งˆ์šดํŠธ ๋ช…๋ น์–ด

mkfs.xfs /dev/md9
mkdir /raidLinear
mount /dev/md9 /raidLinear

 

๋งŒ์•ฝ ๋ ˆ์ด๋“œ๋ฅผ ํ•ด์ œํ•˜๊ณ  ์‹ถ์œผ๋ฉด

umount /dev/md9
mdadm --stop /dev/md9

๋จผ์ € ์–ธ๋งˆ์šดํŠธ ํ•ด์ฃผ๊ณ  ๋ฉˆ์ถฐ์ค๋‹ˆ๋‹ค. 

 

RAID ์ƒํƒœ ํ™•์ธ ๋ช…๋ น์–ด

mdadm --detail /dev/md9