2013年7月11日 星期四

linux raid




Raid stands for Redundant Arrays o Independent Disks. It provides fault tolerance capability and / or performance enhancement depending on the level o RAID you are implementing.


stepStepRaid- LinearRaid-0 (danger)Raid-1 (mirror)Raid-4/5
make Partitionfdiskfdisk -l /dev/hdb && list the disk information
fdisk /dev/hdb && prepare a new partition it will go into fdisk prompt.
 Optionfdisk
create partitionncreate a new partition
 pPrimary partition
 22 second partion
 Enterdefault clinder shown
 + 200m200M Bytes
partition informationtchange system type of the parition
 pprint the partition information
   
Write to harddiskw 
Raid
information
vi /etc/raidtab
raid 0raid 1raid 5
 raiddev/dev/md0/dev/md0/dev/mdo/dev/md0
 raid-levellinear015
 nr-raid-disks2223
 nr-spare-disks 後備0011
 persistent-superblock0001
 chunk-size444128
 device/dev/hdb1/dev/hdb1/dev/hdb1/dev/hdb1
 raid-disk0000
 device/dev/hdd1/dev/hdd1/dev/hdd1/dev/hdd1
 raid-disk1111
 device   /dev/hdc1
 raid-disk   2
 device  /dev/hdc1 
 spare-disk  0 
 raid-disk    
Buid Raid (from information)mkraid /dev/md0   mkraid --really-force /dev/md0
      
      
      
Check Raidcat /proc/mdstat   cat /proc/mdstat&& the symbol "[UUU]" means that all three disks forming the RAID-5 are healthy
      
      
Format Raidmke2fs /dev/md0   mke2fs -b 4096 -R strids=32 /dev/md0
      
      
Mountmkdir /mnt/temp
mount -t ext2 /dev/md0 /mnt/temp
mount
   mount -t ext2 /dev/md0 /mnt/temp
      
Check the Raiddf -m
hdparm -t /dev/hdd1 /dev/md0
    
      
test it failureraidsetfault /dev/md0 /dev/hdb1
      
      
/etc/fstab 
/dev/md0 /mnt/temp ext2 defaults 0 0
   
      
Recover replace a new onereplace  
  modify /etc/raidtabmodify /etc/raidtabraidhotremove /dev/md0 /dev/hdd1raidhotremove /dev/md0 /dev/hdd1
  invoice mkraid /dev/md0invoke mktraid /dev/md0raidhotadd /dev/md0 /dev/hdd1raidhotadd /dev/md0 /dev/hdd1
    cat /proc/dstat && view condition
cat /proc/mdstat
      

沒有留言:

張貼留言