2nd meeting
From BLUG
Topic: RAID Filesystems
Date: December 14th, 2004
Time: 7-9pm
Location: Monroe County Public Library room 1B
Attendance: 6
Presenter: Mark Krenz
[edit]
Summary
Mark gave a presentation on how RAID works and the use of hardware and software RAID. Ryan Cage was nice enough to bring some high end hardware RAID cards that are used in server class machines.
[edit]
Outline
Here is the outline that was made for the presentation.
- Software RAID for 2.4 and 2.6 kernels presentation o What is RAID?
- Termed in 1987 by a University of California Berkeley paper entitled
"A Case for Redundant Arrays of Inexpensive Disks (RAID)".
- Better features than a single bigger drive.
- Single logic drive unit
- RAID levels:
o Linear mode (sequential disks)
o RAID-0 (Stripping)
o RAID-1 (Mirroring)
o RAID-2/RAID-3 (different ways of striping and parity checking)
o RAID-4 (Striping + Parity disk)
o RAID-5 (Striping and parity information distributed across disks)
- RAID is not a substitute for good backups
- Hardware RAID
o Example controllers
o Motherboards with RAID
- Software RAID in Linux
o How to use Software RAID under Linux
- First, find at least 2 or more disks to use.
- Determine what you want.
Speed? (RAID-0)
Larger disk? (Linear)
Redundancy? (RAID-1 or RAID-5)
Combination?
- No need to RAID the swap space
From the Software RAID HOWTO:
"There's no reason to use RAID for swap performance reasons. The
kernel itself can stripe swapping on several devices, if you just
give them the same priority in the /etc/fstab file."
/dev/sda2 swap swap defaults,pri=1 0 0
/dev/sdb2 swap swap defaults,pri=1 0 0
/dev/sdc2 swap swap defaults,pri=1 0 0
/dev/sdd2 swap swap defaults,pri=1 0 0
/dev/sde2 swap swap defaults,pri=1 0 0
/dev/sdf2 swap swap defaults,pri=1 0 0
/dev/sdg2 swap swap defaults,pri=1 0 0
The only reason you'd want to use RAID for swap is for redundancy.
If one disk crashes, the machine will keep running because the
swap memory will still be there.
- What types of devices do you need (IDE, SATA or SCSI)
- Hotswapping
o Don't do it with IDE or SCSI
o SCA SCSI should work.
o Not sure about SATA
- Enabling it in the kernel
- Setting up /etc/raidtab
LINEAR
raiddev /dev/md0
raid-level linear
nr-raid-disks 2
chunk-size 32
persistent-superblock 1
device /dev/hda1
raid-disk 0
device /dev/hdb1
raid-disk 1
device /dev/hdc1
raid-disk 2
device /dev/hdd1
raid-disk 3
RAID-0
raiddev /dev/md0
raid-level 0
nr-raid-disks 2
persistent-superblock 1
chunk-size 4
device /dev/sdb6
raid-disk 0
device /dev/sdc5
raid-disk 1
RAID-1
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
chunk-size 32
persistent-superblock 1
nr-spare-disks 1
device /dev/hdb1
raid-disk 0
device /dev/hdc1
raid-disk 1
device /dev/hdd1
spare-disk 0
RAID-5
raiddev /dev/md0
raid-level 5
nr-raid-disks 7
nr-spare-disks 1
nr-spare-disks 1
persistent-superblock 1
parity-algorithm left-symmetric
chunk-size 32
device /dev/sda3
raid-disk 0
device /dev/sdb1
raid-disk 1
device /dev/sdc1
raid-disk 2
device /dev/sdd1
raid-disk 3
device /dev/sde1
raid-disk 4
device /dev/sdf1
raid-disk 5
device /dev/sdg1
raid-disk 6
device /dev/sdh1
spare-disk 0
- Creating the arrays with raidtools or mdadm
o Setup your disk partitions
o To create an array
mkraid
or
mdadm --create --verbose /dev/md0 --level=linear --raid-devices=2 /dev/sdb6 /dev/sdc5
Personalities : [linear] [raid0] [raid1] [raid5]
read_ahead 1024 sectors
md0 : active raid1 ide/host0/bus1/target1/lun0/part1[1] ide/host0/bus1/target0/lun0/part1[0]
977024 blocks [2/2] [UU]
[=============>.......] resync = 66.9% (654336/977024) finish=0.8min speed=6352K/sec
unused devices: <none>
o Now create the ext2/ext3/resierfs filesystem on the /dev/mdX device
mke2fs -j /dev/md0
- Simulating drive failures with raidsetfaulty
raidsetfaulty /dev/md0 /dev/hdc1
or
mdadm -f /dev/md0 /dev/hdc1
or by simply downing the machine and unplugging the drive.
---------------------------------------------------------------------------------------------------
Personalities : [linear] [raid0] [raid1] [raid5]
read_ahead 1024 sectors
md0 : active raid1 ide/host0/bus1/target1/lun0/part1[1] ide/host0/bus1/target0/lun0/part1[0](F)
977024 blocks [2/1] [_U]
unused devices: <none>
---------------------------------------------------------------------------------------------------
- Recovering from a drive failure
raidhotadd /dev/md0
or
mdadm -r /dev/md0 /dev/hdc1
mdadm -a /dev/md0 /dev/hdc1
[root@arvo httpd]# cat /proc/mdstat
Personalities : [linear] [raid1] [raid5]
md4 : active raid1 hdb1[1] hda1[0]
14659072 blocks [2/2] [UU]
md5 : active raid1 hdb2[1] hda2[0]
14659072 blocks [2/2] [UU]
md3 : active raid1 hdb3[1] hda3[0]
73248256 blocks [2/2] [UU]
md2 : active raid1 hdb6[1] hda6[0]
7823360 blocks [2/2] [UU]
md1 : active raid1 hdb7[1] hda7[0]
1935616 blocks [2/2] [UU]
md6 : active raid1 hdd1[2] hdc1[0]
195358208 blocks [2/1] [U_]
[==================>..] recovery = 90.3% (176523904/195358208) finish=9.7min speed=32175K/sec
md0 : active raid1 hdb5[1] hda5[0]
4891648 blocks [2/2] [UU]
unused devices: <none>
[root@arvo httpd]#

