Fun with RAID
Jozef
RAID
- apt-get install mdadm
- # dpkg-reconfigure mdadm
RAID
Redundant Array of Independent/Inexpensive Disks
- RAID0 - striping
n*SIZE
- RAID1 - mirror
SIZE
- RAID5 - striped set with distributed parity
(n-1)*SIZE
- RAID6 - striped set with dual parity
(n-2)*SIZE
software raid
- more flexible
- can be reconfigured "on the fly"
- ex. pvmove data from RAID1 blockdevice,
destroy the RAID1 and use the disks to construct RAID0,
vgextend volume gropu with twice the size
- ex.2 replacing disks for bigger ones
- cat /proc/mdstat
server with 2 disks
- /dev/hda1 + /dev/hdb1 = RAID1 => /boot
- /dev/hda2 + /dev/hdb2 = RAID1 => /
- /dev/hda3 + /dev/hdb3 = RAID0 => /data
- redundacy for /boot and /, speed for data
- in case of 1 disk failure system will survive
no need for reinstalation, data are lost but recovered from backup
server with 3 disks
-
/dev/hda1 + /dev/hdb1 = RAID1 => /boot
/dev/hdc1 spare
- /dev/hda2 + /dev/hdb2 = RAID1 => /
/dev/hdc2 spare
- /dev/hda3 + /dev/hdb3 + /dev/hdc3 = RAID5 => /data
- redundacy for /boot and /, speed+redundancy for data
- server runs with no impact in case of 1 disk failure
if two disks fail (not at the same time) system is ok but /data lost
server with 8 disks
-
/dev/sda + /dev/sdb = RAID1
/dev/sdc spare (3 disks)
- /dev/sdd + /dev/sde + /dev/sdf + /dev/sdg = RAID5 => /data
/dev/sdh spare (5 disks)
destroy our lvm setup...
- lvremove vg00/test1
- vgremove vg00
- pvremove /dev/hdb # /dev/hdd (wiped with badblocks)
create raid0
- mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/hd[bd]
- cat /proc/mdstat
- fdisk -l /dev/md0
- mkfs.ext3 /dev/md0
- mount /dev/md0 /mnt
- umount /mnt
- mdadm --stop /dev/md0 --zero-superblock /dev/hd[bd]
create raid1
- mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd[bd] --spare-devices=1 /dev/hda5
- fdisk -l /dev/md0
- cat /proc/mdstat
- mkfs.ext3 /dev/md0
- mount /dev/md0 /mnt
- mdadm --manage /dev/md0 --fail /dev/hdb --fail /dev/hda5
- mdadm --remove /dev/md0 /dev/hdb /dev/hda5
- dd if=/dev/zero of=/dev/hdb
- dd if=/dev/zero of=/dev/hdd
- mdadm --add /dev/md0 /dev/hdb /dev/hda5
- umount /mnt
- mdadm --stop /dev/md0 --zero-superblock /dev/hd[bd] /dev/hda5
notes
- /dev/hda5 1310 1374 522081 fd Linux raid autodetect
- take care when buying different hdd-s
80GB is not always 80*1024*1024*1024B
80GB is sametimes 80*1000*1000*1000B
The difference is 1920MB or 2_013_265_920B...
And that's it...
Questions?
