Linux Learning - RAID

###RAID###
Features:
 1. Data spread across 2 or more disk/partitions
 2. Redundancy - recover from catastrophy
 3. Levels: 0,1,4,5,6,10




Tasks:
 1. RAID0 - volume set creation i.e. LVM
  a. Create multiple partitions: /dev/sd[bc][5-8] - of type '83' || 'linux'
  b. 'init 6' - reboot
  c. 'mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb5 /dev/sdc5'
  d. 'mke2fs -t ext4 -j /dev/md0'
  e. 'mkdir /raid0 && mount /dev/md0 /raid0'
  f. 'nano /etc/fstab'


 2. RAID1 - mirroring - halves the storage
  a. 'mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb6 /dev/sdc6'
  b. 'mke2fs -t ext4 -j /dev/md1'
  c. 'mkdir /raid1 && mount /dev/md1 /raid1'
 
 3. RAID5 - striping with parity - sacrifices the equivalent of 1-drive(partition)
  a. 'mdadm --create /dev/md2 --level=5 --raid-devices=4 /dev/sdb7 /dev/sdb8 /dev/sdc7 /dev/sdc8'
  b. 'mke2fs -t ext4 -j /dev/md2'
  c. 'mkdir /raid5 && mount /dev/md2 /raid5 && seq 1000000 > /raid5/1million.txt && ls -l /raid5'
  d. nano /etc/fstab
  e. test auto-mount during system initialization




###RAID Management###
Features:
 1. Create
 2. Assemble: assembles pre-existing array(s)
 3. Manage: Use to fail devices to take them offline
 4. Monitor: E-mail, run processes, etc.
 5. Misc: '--query', '--detail', '--examine'(individual RAID components'


Tasks:
 1. 'cat /proc/mdstat' - enumerates currently-available RAID-arrays (sets)
 2. 'mdadm --query /dev/md[0-2]' - returns information about the 3 arrays: 0-2
 3. Publish RAID array as a read-only volume
  a. 'umount /dev/md0' - unmounts the RAID array
  b. 'mdadm -o /dev/md0' - flags, in the superblock, the array: /dev/md0 as Read-Only
  c. 'mount /dev/md0 /raid0'
  d. 'mount'
 4. Publish RAID array as a read-write volume
  a. 'umount /dev/md0' - unmounts the RAID array
  b. 'mdadm -w /dev/md0' - flags, in the superblock, the array: /dev/md0 as Read-Write
  c. 'mount /dev/md0 /raid0'
  d. 'mount'
 5. Stop RAID volume for management purposes
  a. 'mdadm --manage --stop /dev/md0' - facilitates offline management
Note: Stopping/deactivating the array will remove its '/dev/md?' entry
Note: There are multiple ways to reassemble RAID arrays:
 1. command-line: 'mdadm -A /dev/md0 /dev/sdb5 /dev/sdc5' - restarts (reassembles) '/dev/md0' from its component parts
 2. '/etc/mdadm.conf' - associates DEVICES & ARRAYS and management/notification info.
   a. 'DEVICE /dev/sdb[5678] /dev/sdc[5678]'
   b. 'ARRAY /dev/md0 devices=/dev/sdb5,/dev/sdc5'




 6. Other options:
  a. 'mdadm -D /dev/md[0-2] - enumerates info. about ARRAYS
  b. 'mdadm -E /dev/sd[bc][78] - enumerates info. about the 4 partions on the 2 drives: /dev/sd[bc]

你可能感兴趣的:(Liunx/RAID)