Dynamic disk security strategy
linux kernel can simulate the RAID controller to manage the hard disk, but only to support the level of 0,1,4,5
RAID0, also known as striping
The continuous spread of the data access to multiple disk storage up to improve performance, the fastest, but the most dangerous.
RAID1, also known as Mirror or Mirroring
User data to ensure maximum availability and fixes, and user data 100% automatically copy to another hard drive, slower because of the need to write a number of hard drives at the same time.
Take at least three hard disk RAID5
Wrong line data storage backup, and the corresponding data and parity information were stored in different disks, data occurred when a damaged disk, using the remaining data and parity information corresponding to restore damaged data.
RAID0 +1, also known as RAID10
Combine the advantages of RAID0 and RAID1, many companies in the application of
Linux software RAID
1. Default kernel has support for software RAID controller
2. Raidtools need to install the management tools to create a RAID device, raidtools contains a RAID management tool to create the model and the default configuration file, the installation after editing / etc / raidtab this configuration file, it can be configured model raidtools document ( in / usr/share/doc/raid- ~ / directory) to copy. Finally, use the following command to create RAID devices:
# mkraid / dev/md0
# mkraid-f / dev/md0
# mkraid-R / dev/md0
Is mandatory after the creation of two orders, covering the past to build the super-block.
Fedora Core5 but do not use this tool using mdadm.
3. Software RAID device file name: / dev / mdN (N = 0,1,2 ...)
4. Software RAID device can be seen when the partition, formatted to be mounted
# mkfs.ext3 / dev/md1
# mount / dev/md1 / opt
5. Stop the RAID device
# umount / opt
# raidstop / dev/md0
To permanently delete the RAID devices, raidtab document needs to be deleted, otherwise RAID still work after the restart.
6. Show RAID device information
# lsraid-A-a / dev/md1
7.RAID1 fault simulation
Assuming sdb1 disk 2 sdc1 do with RAID1, sdb1 disk breaks down, one to add a new disk sdd1.
# raidsetfaulty / dev/md1 / dev/sdb1
# raidhotadd / dev/md1 / dev/sdd1
# more / proc / mdstat Show disk repair process
# raidhotremove / dev/sdb1
Raidtab to amend the final document.
Use mdadm to create and manage RAID
RAID0
Add the hard disk
RAID devices are hard disk partition member, need to first partition on the hard disk, partition can not be in the same physical hard disk
# fdisk / dev / sdb
n create a primary partition, t partition type fd, w to write the preservation
# fdisk / dev / sdc
# mdadm-Cv / dev/md0-l0-n2 / dev/sdb1 / dev/sdc1
-C, - create create a new array
-v, verbose show details
/ dev/md0 array device name
-l, - level = array level, such as 0,1,4,5,6
-n, - raid-devices = array the number of activities
/ dev / sd [bc] 1 array contains a list of equipment
# more / proc / mdstat to view array status
# mkfs.ext3 / dev/md0 to create file system
# mount / dev/md0 / mnt / raid
Let the system automatically mount, modify / etc / fstab, add
/ dev/md0 / mnt / raid ext3 defaults 0 0
RAID5 fault simulation
Have already created a RAID5 device md0
# mdadm-Cv / dev/md0-l5-n3-x1-c128 / dev / sd [b, c, d, e] 1
1. To / dev/sdb1 marked as damaged equipment
# mdadm / dev/md0-f / dev/sdb1
At this time the beginning of reconstruction and restoration of array data
2. To remove the damaged equipment
# mdadm / dev/md0-r / dev/sdb1
3. Will be added to the array of new equipment
Note that one: the right of the hard disk partition, the Second: Add device name to be removed in line with, such as sdb1
# mdadm / dev/md0-a / dev/sdb1
Generated configuration file / etc / mdadm.conf
The following format:
DEVICE / dev/sdb1 / dev/sdc1 / dev/sdd1 / dev/sde1 ARRAY / dev/md10 level = raid10 num-devices = 4 UUID = 12334343dkfj
UUID information which, through # mdadm-D / dev/md10 be
# mdadm-Ds scan of the document information
Array used to maintain order
1. The opening of the array
# mdadm-As / dev/md0
-A has been in existence for the opening of the array
-s to / etc / mdadm.conf based on
Mdadm.conf not create a file using the following methods of opening
# mdadm-A / dev/md0 / dev / sd [bc] 1
2. Stop array
# mdadm-S / dev/md0
3. Shows array details
# mdadm-D / dev/md0
0 评论:
发表评论