Under Linux do all kinds of disk arrays and hot backup

Original link: http://www.cnblogs.com/chongchong201399/p/3820390.html

Disk array is divided into:

Array with redundancy: raid0 raid4 raid5 raid6 raid10 raid01 ....

An array of read and write speed advantage: raid1 raid4 raid5 raid6 raid10 raid01 ....

How to make a disk array it were listed:

1, an array with redundancy raid0

1.1 at least two disks, sdb and sdc, aside from the two disks are respectively a partition: sdb1 and sdc1,

1.2 when the district needs to change the partition number -fd, then w quit.

1.3 Production RAID0, before fabrication of the disk array, mdadm packages need to be installed, using the best installation yum

mdadm -Cv /dev/md0 -a yes -l 1 -n 2 /dev/sd{b,c}1

1.4 shows the development of an array of information

mdadm -D /dev/md0

1.5 Since the array includes redundancy, so that damage to a disk no effect on read and write operations, but at a greatly reduced, damage to the disk now simulation

mdadm /dev/md0 -f /dev/sdb1

1.6 remove the damaged disk

mdadm /dev/md0 -r /dev/sdb1

1.7 View running information of the disk array

mdadm -D /dev/md0

The results showed that Stat clean downlow: indicate that while a disk is damaged, but still be able to continue to use, but much lower performance

 

2. boot disk and automatically mount

In the above has been said how making a disk raid0, making a disk that way about it several steps need to boot hanging on, then go inside /etc/rc.d/rc.sysinit configure specific is to add the following code segment on ok

update_boot_stage RCraid
[ -x /sbin/nash ] && echo "raidautorun /dev/md0" | nash --quiet
if [ -f /etc/mdadm.conf ]; then
    /sbin/mdadm -A -s
fi

For automatically mount it, in the / etc / fstab add the following code is, of course, the disk array prior to use, and should be formatted in the hanging process

/dev/md0 /mnt/raid ext3 defaults 0 0

 

3. hot backup and heat recovery disk arrays

We all know that a lot of important data will need to be hot backup, as well as the provision of services.

In doing hot backup, if Raid0, that requires at least three disks, disk partition is now assumed that three sdb1 sdc1 sdd1

Do hot backup command is:

mdadm -Cv /dev/md0 -a yes -l1 -n 2 /dev/sd{b,c}1 -x /dev/sdd1

Sdd1 develop as a hot spare disk, sab1 and use the disc as sdc1

See RAID status: mdadm-D / dev / md0 displays the status of the three disks

Now simulate a damaged disk sdb1:

mdadm /dev/md0 -f /dev/sdb1

View raid0 status: mdadm -D / dev / md0

Synchronizing data can be seen sdd1

Usage monitoring, see the synchronization status:

! Wa, data synchronization can see the progress bar display map, sdd1 being enabled.

Description hot backup has completed conversion.

 

5. Stop using array:

umount   /media/

mdadm -S /dev/md0

 

6. Add the disk array has been some

mdadm -A /dev/md0 /sd{a,b,c,d}1

! Cat to be monitored.

For more information about the raid, and the follow-up will be perfect.

 

 

 

 

 

 

 

Reproduced in: https: //www.cnblogs.com/chongchong201399/p/3820390.html

Guess you like

Origin blog.csdn.net/weixin_30633405/article/details/94786267