一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

Linux|Centos|Ubuntu|系統(tǒng)進(jìn)程|Fedora|注冊(cè)表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服務(wù)器之家 - 服務(wù)器系統(tǒng) - Linux - linux磁盤管理軟RAID的實(shí)現(xiàn)原理分析和方法分享

linux磁盤管理軟RAID的實(shí)現(xiàn)原理分析和方法分享

2022-02-22 17:04趙杰迪 Linux

這篇文章主要介紹了linux磁盤管理中做軟RAID的實(shí)現(xiàn)原理分析和方法分享,需要的朋友跟著學(xué)習(xí)下。

1 什么是raid

raid全稱是獨(dú)立磁盤冗余陣列(redundant array of independent disks),基本思想是把多個(gè)磁盤組合起來(lái),組合一個(gè)磁盤陣列組,使得性能大幅提高。

raid分為幾個(gè)不同的等級(jí),各個(gè)不同的等級(jí)均在數(shù)據(jù)可靠性及讀寫性能做了不同的權(quán)衡。實(shí)際工作中根據(jù)自己的業(yè)務(wù)需求選擇不同的raid方案。

2 raid的實(shí)現(xiàn)方式

外接式磁盤陣列:通過(guò)擴(kuò)展卡提供適配能力內(nèi)接式raid:主板集成raid控制器安裝os前在bios里配置軟件raid:通過(guò)os實(shí)現(xiàn)

3 標(biāo)準(zhǔn)的raid

3.1 raid0

raid0稱為條帶化存儲(chǔ),將數(shù)據(jù)分段存儲(chǔ)在各個(gè)磁盤中,讀寫均可以并行處理,因此讀寫速率為單個(gè)磁盤的n倍,沒有冗余功能,任何一個(gè)磁盤的損壞就會(huì)導(dǎo)致的數(shù)據(jù)不可用。

linux磁盤管理軟RAID的實(shí)現(xiàn)原理分析和方法分享

3.2 raid1

radi1是鏡像存儲(chǔ),沒有數(shù)據(jù)校驗(yàn),數(shù)據(jù)被同等的寫入到2個(gè)或者多個(gè)磁盤中,寫入速度相對(duì)慢, 但是讀取速度比較快。

linux磁盤管理軟RAID的實(shí)現(xiàn)原理分析和方法分享

3.3 raid 4

radi4在raid1的基礎(chǔ)上,n個(gè)盤用于數(shù)據(jù)存儲(chǔ),另外加入了1個(gè)磁盤作為校驗(yàn)盤。一共n+1個(gè)盤,任何一個(gè)盤壞掉也不影響數(shù)據(jù)的訪問(wèn)

3.4 raid 5

raid5在raid4的基礎(chǔ)上,由原來(lái)的一個(gè)盤來(lái)存儲(chǔ)校驗(yàn)數(shù)據(jù),改為每個(gè)盤都有數(shù)據(jù)和校驗(yàn)信息的。

linux磁盤管理軟RAID的實(shí)現(xiàn)原理分析和方法分享

4 混合raid

4.1 raid01

先組成raid0,然后組成raid1.

linux磁盤管理軟RAID的實(shí)現(xiàn)原理分析和方法分享

4.2 raid10

先組成raid1,然后組成raid0

linux磁盤管理軟RAID的實(shí)現(xiàn)原理分析和方法分享

5 軟raid的實(shí)現(xiàn)

5.1 raid5的實(shí)現(xiàn)

創(chuàng)建由三塊硬盤組成的可用空間為2g的raid5設(shè)備,要求其chunk大小為256k,文件系統(tǒng)為ext4,開機(jī)可自動(dòng)掛載至/mydata目錄

5.1.1 先看看我們的磁盤情況

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@centos7 bash]$ lsblk
name maj:min rm size ro type mountpoint
sda 8:0 0 200g 0 disk
├─sda1 8:1 0 1g 0 part /boot
├─sda2 8:2 0 128g 0 part
├─sda3 8:3 0 48.8g 0 part /
├─sda4 8:4 0 512b 0 part
└─sda5 8:5 0 19.5g 0 part /app
sdb 8:16 0 100g 0 disk
sdc 8:32 0 20g 0 disk
sdd 8:48 0 20g 0 disk
sde 8:64 0 20g 0 disk
sdf 8:80 0 20g 0 disk
sr0 11:0 1 8.1g 0 rom /run/media/root/centos 7 x86_64 

這里我們使用sdb,sdc,sdd,每個(gè)盤創(chuàng)建一個(gè)主分區(qū)1g,構(gòu)建radi5.

5.1.2 根據(jù)實(shí)際情況分區(qū)

[root@centos7 bash]$ fdisk /dev/sdb
welcome to fdisk (util-linux 2.23.2).

changes will remain in memory only, until you decide to write them.
be careful before using the write command.

device does not contain a recognized partition table
building a new dos disklabel with disk identifier 0x93d380cf.

command (m for help): n
partition type:
 p primary (0 primary, 0 extended, 4 free)
 e extended
select (default p): p
partition number (1-4, default 1): 
first sector (2048-209715199, default 2048): 
using default value 2048
last sector, +sectors or +size{k,m,g} (2048-209715199, default 209715199): +1g
partition 1 of type linux and of size 1 gib is set

command (m for help): t
selected partition 1
hex code (type l to list all codes): fd
changed type of partition 'linux' to 'linux raid autodetect'

command (m for help): p

disk /dev/sdb: 107.4 gb, 107374182400 bytes, 209715200 sectors
units = sectors of 1 * 512 = 512 bytes
sector size (logical/physical): 512 bytes / 512 bytes
i/o size (minimum/optimal): 512 bytes / 512 bytes
disk label type: dos
disk identifier: 0x93d380cf

 device boot start  end blocks id system
/dev/sdb1  2048 2099199 1048576 fd linux raid autodetect

command (m for help): w
the partition table has been altered!

calling ioctl() to re-read partition table.
syncing disks.
[root@centos7 bash]$ fdisk /dev/sdc
welcome to fdisk (util-linux 2.23.2).

changes will remain in memory only, until you decide to write them.
be careful before using the write command.

device does not contain a recognized partition table
building a new dos disklabel with disk identifier 0xc56b90d8.

command (m for help): n
partition type:
 p primary (0 primary, 0 extended, 4 free)
 e extended
select (default p): p
partition number (1-4, default 1): 
first sector (2048-41943039, default 2048): 
using default value 2048
last sector, +sectors or +size{k,m,g} (2048-41943039, default 41943039): +1g
partition 1 of type linux and of size 1 gib is set

command (m for help): t
selected partition 1
hex code (type l to list all codes): fd
changed type of partition 'linux' to 'linux raid autodetect'

command (m for help): p

disk /dev/sdc: 21.5 gb, 21474836480 bytes, 41943040 sectors
units = sectors of 1 * 512 = 512 bytes
sector size (logical/physical): 512 bytes / 512 bytes
i/o size (minimum/optimal): 512 bytes / 512 bytes
disk label type: dos
disk identifier: 0xc56b90d8

 device boot start  end blocks id system
/dev/sdc1  2048 2099199 1048576 fd linux raid autodetect

command (m for help): w
the partition table has been altered!

calling ioctl() to re-read partition table.
syncing disks.
[root@centos7 bash]$ fdisk /dev/sdd
welcome to fdisk (util-linux 2.23.2).

changes will remain in memory only, until you decide to write them.
be careful before using the write command.

device does not contain a recognized partition table
building a new dos disklabel with disk identifier 0x7e0900d8.

command (m for help): n
partition type:
 p primary (0 primary, 0 extended, 4 free)
 e extended
select (default p): p
partition number (1-4, default 1): 
first sector (2048-41943039, default 2048): 
using default value 2048
last sector, +sectors or +size{k,m,g} (2048-41943039, default 41943039): +1g
partition 1 of type linux and of size 1 gib is set

command (m for help): p

disk /dev/sdd: 21.5 gb, 21474836480 bytes, 41943040 sectors
units = sectors of 1 * 512 = 512 bytes
sector size (logical/physical): 512 bytes / 512 bytes
i/o size (minimum/optimal): 512 bytes / 512 bytes
disk label type: dos
disk identifier: 0x7e0900d8

 device boot start  end blocks id system
/dev/sdd1  2048 2099199 1048576 83 linux

command (m for help): t
selected partition 1
hex code (type l to list all codes): fd
changed type of partition 'linux' to 'linux raid autodetect'

command (m for help): w
the partition table has been altered!

calling ioctl() to re-read partition table.
syncing disks.

5.1.3 創(chuàng)建raid

[root@centos7 bash]$ mdadm -c /dev/md5 -a yes -l 5 -n 3 /dev/sd{b1,c1,d1} -c 256 # -c指定創(chuàng)建, -a yes 自動(dòng)創(chuàng)建設(shè)備 , -l 設(shè)定level , -n 設(shè)定磁盤個(gè)數(shù), -c chunk大小
continue creating array? y
mdadm: defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
[root@centos7 bash]$ mdadm -ds        # 查看信息
array /dev/md5 metadata=1.2 name=centos7.magedu.com:5 uuid=2c8ae60d:a799fcb7:9008a046:ae6ea430
[root@centos7 bash]$ mdadm -ds >/etc/mdadm.conf      # 將軟raid信息寫入到配置文件中去
[root@centos7 bash]$ mkdir /mnt/md5       # 創(chuàng)建掛載點(diǎn)目錄 
[root@centos7 bash]$ mkfs.ext4 /dev/md5       # 創(chuàng)建文件系統(tǒng)
mke2fs 1.42.9 (28-dec-2013)
filesystem label=
os type: linux
block size=4096 (log=2)
fragment size=4096 (log=2)
stride=64 blocks, stripe width=128 blocks
131072 inodes, 523776 blocks
26188 blocks (5.00%) reserved for the super user
first data block=0
maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912

allocating group tables: done    
writing inode tables: done    
creating journal (8192 blocks): done
writing superblocks and filesystem accounting information: done 

[root@centos7 bash]$ mount /dev/md5 /mnt/md5      # 掛載設(shè)備 
[root@centos7 bash]$ tail -n 1 /etc/mtab
/dev/md5 /mnt/md5 ext4 rw,seclabel,relatime,stripe=128,data=ordered 0 0  # 查看掛載信息
[root@centos7 bash]$ tail -n 1 /etc/mtab >>/etc/fstab     #添加到fstab文件中,確保開機(jī)啟動(dòng),這里建議使用uuid

5.1.4 驗(yàn)證raid

[root@centos7 md5]$ mdadm -d /dev/md5       #查看詳細(xì)raid5詳細(xì)信息,可以發(fā)現(xiàn)有3個(gè)都是working狀態(tài)的
/dev/md5:
version : 1.2
creation time : wed dec 6 19:28:22 2017
raid level : raid5
array size : 2095104 (2046.00 mib 2145.39 mb)
used dev size : 1047552 (1023.00 mib 1072.69 mb)
raid devices : 3
total devices : 3
persistence : superblock is persistent

update time : wed dec 6 19:39:06 2017
state : clean 
active devices : 3
working devices : 3
failed devices : 0
spare devices : 0

layout : left-symmetric
chunk size : 256k

consistency policy : resync
name : centos7.magedu.com:5 (local to host centos7.magedu.com)
uuid : 2c8ae60d:a799fcb7:9008a046:ae6ea430
events : 18

number major minor raiddevice state
 0 8 17 0 active sync /dev/sdb1
 1 8 33 1 active sync /dev/sdc1
 3 8 49 2 active sync /dev/sdd1
[root@centos7 md5]$ man mdadm
[root@centos7 md5]$ mdadm /dev/md5 -f /dev/sdc1       # -f 設(shè)定指定設(shè)備故障, 將/dev/sdc1 這個(gè)盤標(biāo)記失敗, 看是否數(shù)據(jù)能訪問(wèn),我這里使用-f標(biāo)記失敗,工作中可以根據(jù)硬盤指示燈判斷磁盤狀態(tài)
mdadm: set /dev/sdc1 faulty in /dev/md5  
[root@centos7 md5]$ mdadm -d /dev/md5        #在次查看信息,發(fā)現(xiàn)工作的是2個(gè), 一個(gè)失敗的設(shè)備 
/dev/md5:
version : 1.2
creation time : wed dec 6 19:28:22 2017
raid level : raid5
array size : 2095104 (2046.00 mib 2145.39 mb)
used dev size : 1047552 (1023.00 mib 1072.69 mb)
raid devices : 3
total devices : 3
persistence : superblock is persistent

update time : wed dec 6 19:41:08 2017
state : clean, degraded        # 這里注意了。 我們的一個(gè)盤壞掉了。 raid5狀態(tài)為降級(jí)使用了。
active devices : 2
working devices : 2
failed devices : 1
spare devices : 0

layout : left-symmetric
chunk size : 256k

consistency policy : resync
name : centos7.magedu.com:5 (local to host centos7.magedu.com)
uuid : 2c8ae60d:a799fcb7:9008a046:ae6ea430
events : 20

number major minor raiddevice state
0 8 17 0 active sync /dev/sdb1
- 0 0 1 removed
3 8 49 2 active sync /dev/sdd1
1 8 33 - faulty /dev/sdc1
[root@centos7 md5]$ cat a.txt      # 發(fā)現(xiàn)我們的數(shù)據(jù)還是能訪問(wèn)的。沒有問(wèn)題。

5.1.5 替換設(shè)備

我這里是磁盤壞掉后的執(zhí)行替換的, 完全可以多一個(gè)備用盤, 壞掉自動(dòng)替換的。

[root@centos7 md5]$ mdadm /dev/md5 -a /dev/sde1   # 上面我們的sdc1數(shù)據(jù)損壞,我們需要更換新的磁盤來(lái)頂替他的位置。這里添加一個(gè)sde1的磁盤, fdisk操作這里省去了。
mdadm: added /dev/sde1
[root@centos7 md5]$ mdadm -ds      # 查看詳細(xì)信息
array /dev/md5 metadata=1.2 name=centos7.magedu.com:5 uuid=2c8ae60d:a799fcb7:9008a046:ae6ea430
[root@centos7 md5]$ mdadm -d /dev/md5     # 查看詳細(xì)信息
/dev/md5:
version : 1.2
creation time : wed dec 6 19:28:22 2017
raid level : raid5
array size : 2095104 (2046.00 mib 2145.39 mb)
used dev size : 1047552 (1023.00 mib 1072.69 mb)
raid devices : 3
total devices : 4
persistence : superblock is persistent

update time : wed dec 6 19:50:01 2017
state : clean       # 狀態(tài)恢復(fù)正常了。沒有問(wèn)題
active devices : 3
working devices : 3
failed devices : 1
spare devices : 0

layout : left-symmetric
chunk size : 256k

consistency policy : resync
name : centos7.magedu.com:5 (local to host centos7.magedu.com)
uuid : 2c8ae60d:a799fcb7:9008a046:ae6ea430
events : 43

number major minor raiddevice state
0 8 17 0 active sync /dev/sdb1
4 8 65 1 active sync /dev/sde1
3 8 49 2 active sync /dev/sdd1

1 8 33 - faulty /dev/sdc1  # 這個(gè)盤是壞掉的,我們已經(jīng)加入了新的磁盤, 這個(gè)盤可以干掉了
[root@centos7 md5]$ man mdadm
[root@centos7 md5]$ mdadm /dev/md5 --remove /dev/sdc1   # 這個(gè)盤我們從raid5中移除去。 
mdadm: hot removed /dev/sdc1 from /dev/md5

5.1.6擴(kuò)展raid

我們上面使用的是2+1構(gòu)成的raid5,磁盤利用率為66%,如果我們想改成3+1 可以執(zhí)行類似如下命令

[root@centos7 mnt]$ mkadm -g -r /dev/md5 -n 4 -a /dev/sdxx   # 這里我就不測(cè)試了。使用/dev/sdxx代替一個(gè)設(shè)備。-g 是grown增長(zhǎng)的意思,-r 是resizefs的意思,

5.1.7 清空raid信息

[root@centos7 mnt]$ umount /dev/md5     # 卸載設(shè)備
[root@centos7 mnt]$ mdadm -s /dev/md5     # 停止raid5 
mdadm: stopped /dev/md5
[root@centos7 mnt]$ sed -i '$d' /etc/fstab    # 刪除fstab中關(guān)于raid5掛載的行
[root@centos7 mnt]$ cat /etc/fstab     # 確保fstab沒有大問(wèn)題

#
# /etc/fstab
# created by anaconda on tue nov 7 16:07:01 2017
#
# accessible filesystems, by reference, are maintained under '/dev/disk'
# see man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#

uuid=59ccea87-3c4e-4bbc-9e2f-3fadb1dcf2e6 /   ext4 defaults 1 1
uuid=f4e867e8-bcde-43a2-adc7-c80b0948e85f /app   ext4 noatime,usrquota,grpquota 1 2
uuid=1d6cbe88-ffb4-4adf-bacf-76be1fa75708 /boot   ext4 defaults 1 2
#uuid=b2c064f5-1ee5-4b5c-9e75-ed41cb99c5aa swap   swap defaults 0 0
#uuid=a0516c4f-40e6-4919-905a-8b44db12ff7b swap  swap defaults,pri=0 0 0 
#/dev/sdb2 /test ext4 rw,seclabel,relatime,data=ordered 0 0
#/dev/sdb1 /home xfs rw,seclabel,relatime,attr2,inode64,usrquota,grpquota 0 0
[root@centos7 mnt]$ rm -rf /etc/mdadm.conf     # 刪除raid默認(rèn)配置文件
[root@centos7 mnt]$ mdadm --zero-superblock /dev/sd{b1,e1,d1,c1}  # 清空設(shè)置上的超級(jí)塊信息

5.2 raid10的實(shí)現(xiàn)

raid10 ,6個(gè)分區(qū),2個(gè)一組raid1,3組raid0

5.2.1 案例分析

分析下,我們創(chuàng)建一個(gè)raid10設(shè)置,2個(gè)設(shè)備組成一個(gè)raid1,6個(gè)設(shè)備2個(gè)一組可以組成3個(gè)raid1, 然后把3個(gè)raid1組成一個(gè)raid0即可

5.2.2 先創(chuàng)建6個(gè)設(shè)備

[root@centos7 mnt]$ lsblk    # 就是使用fdisk 創(chuàng)建的設(shè)備, 具體這里就不寫了。 最終使用lsblk顯示,我們可以看到sdb1,sdb2,sdd1,sde1一共6個(gè)磁盤
name maj:min rm size ro type mountpoint
sda 8:0 0 200g 0 disk 
├─sda1 8:1 0 1g 0 part /boot
├─sda2 8:2 0 128g 0 part 
├─sda3 8:3 0 48.8g 0 part /
├─sda4 8:4 0 512b 0 part 
└─sda5 8:5 0 19.5g 0 part /app
sdb 8:16 0 100g 0 disk 
├─sdb1 8:17 0 1g 0 part 
└─sdb2 8:18 0 1g 0 part 
sdc 8:32 0 20g 0 disk 
├─sdc1 8:33 0 1g 0 part 
└─sdc2 8:34 0 1g 0 part 
sdd 8:48 0 20g 0 disk 
└─sdd1 8:49 0 1g 0 part 
sde 8:64 0 20g 0 disk 
└─sde1 8:65 0 1g 0 part 
sdf 8:80 0 20g 0 disk 
sr0 11:0 1 8.1g 0 rom /run/media/root/centos 7 x86_64

5.2.3 創(chuàng)建raid

[root@centos7 mnt]$ mdadm -c /dev/md11 -a yes -l 1 -n 2 /dev/sd{b1,c1}    # 創(chuàng)建第一個(gè)raid1
mdadm: /dev/sdb1 appears to be part of a raid array:
 level=raid5 devices=3 ctime=wed dec 6 19:28:22 2017
mdadm: note: this array has metadata at the start and
 may not be suitable as a boot device. if you plan to
 store '/boot' on this device please ensure that
 your boot-loader understands md/v1.x metadata, or use
 --metadata=0.90
mdadm: /dev/sdc1 appears to be part of a raid array:
 level=raid5 devices=3 ctime=wed dec 6 19:28:22 2017
continue creating array? y
mdadm: defaulting to version 1.2 metadata
mdadm: array /dev/md11 started.
[root@centos7 mnt]$ mdadm -c /dev/md12 -a yes -l 1 -n 2 /dev/sd{b2,c2}    #創(chuàng)建第二個(gè)raid1
mdadm: note: this array has metadata at the start and
 may not be suitable as a boot device. if you plan to
 store '/boot' on this device please ensure that
 your boot-loader understands md/v1.x metadata, or use
 --metadata=0.90
continue creating array? y
mdadm: defaulting to version 1.2 metadata
mdadm: array /dev/md12 started.
[root@centos7 mnt]$ mdadm -c /dev/md13 -a yes -l 1 -n 2 /dev/sd{d1,e1}     # 創(chuàng)建第三個(gè)raid1
mdadm: /dev/sdd1 appears to be part of a raid array:
level=raid5 devices=3 ctime=wed dec 6 19:28:22 2017
mdadm: note: this array has metadata at the start and
may not be suitable as a boot device. if you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
mdadm: /dev/sde1 appears to be part of a raid array:
level=raid5 devices=3 ctime=wed dec 6 19:28:22 2017
continue creating array? y
mdadm: defaulting to version 1.2 metadata
mdadm: array /dev/md13 started.
[root@centos7 mnt]$ mdadm -c /dev/md10 -a yes -l 0 -n 3 /dev/md{11,12,13}    # 將3個(gè)raid1 合并為一個(gè)raid0 
mdadm: /dev/md11 appears to contain an ext2fs file system
size=2095104k mtime=wed dec 6 19:29:45 2017
mdadm: /dev/md13 appears to contain an ext2fs file system
size=2095104k mtime=wed dec 6 19:29:45 2017
continue creating array? y
mdadm: defaulting to version 1.2 metadata
mdadm: array /dev/md10 started.
[root@centos7 mnt]$ mkfs.ext
mkfs.ext2 mkfs.ext3 mkfs.ext4  
[root@centos7 mnt]$ mkfs.ext4 /dev/md10         # 創(chuàng)建文件系統(tǒng)            
mke2fs 1.42.9 (28-dec-2013)
filesystem label=
os type: linux
block size=4096 (log=2)
fragment size=4096 (log=2)
stride=128 blocks, stripe width=384 blocks
196224 inodes, 784896 blocks
39244 blocks (5.00%) reserved for the super user
first data block=0
maximum filesystem blocks=805306368
24 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912

allocating group tables: done    
writing inode tables: done    
creating journal (16384 blocks): done
writing superblocks and filesystem accounting information: done 

[root@centos7 mnt]$ mdadm -ds          # 查看配置信息
array /dev/md11 metadata=1.2 name=centos7.magedu.com:11 uuid=0ce2cd6c:cd21fab6:3e65cfb5:64bd86f3
array /dev/md12 metadata=1.2 name=centos7.magedu.com:12 uuid=8af31dff:efab06ed:48e2613b:a599c774
array /dev/md13 metadata=1.2 name=centos7.magedu.com:13 uuid=a8c99d60:2d0c61e7:97a76809:9396c020
array /dev/md10 metadata=1.2 name=centos7.magedu.com:10 uuid=50b2fa58:4ce65d67:8c50c853:fa175a28
[root@centos7 mnt]$ mdadm -ds >> /etc/mdadm.conf        # 寫配置文件到mdadm的配置文件中
[root@centos7 mnt]$ mkdir /mnt/md10         # 創(chuàng)建掛載目錄
[root@centos7 mnt]$ mount /dev/md10 /mnt/md10        # 掛載文件系統(tǒng)
[root@centos7 mnt]$ tail -n 1 /etc/mtab         # 查看mtab文件中的最后一行, 也就是我們的md10掛載信息
/dev/md10 /mnt/md10 ext4 rw,seclabel,relatime,stripe=384,data=ordered 0 0
[root@centos7 mnt]$ tail -n 1 /etc/mtab >> /etc/fstab       #添加到開機(jī)啟動(dòng)

5.2.4 raid 清除工作

[root@centos7 mnt]$ umount /dev/md10         # 取消掛載
[root@centos7 mnt]$ rm -rf /etc/mdadm.conf        # 刪除mdadm的默認(rèn)配置
[root@centos7 mnt]$ mdadm -s /dev/md10         # 停止raid0設(shè)置
mdadm: stopped /dev/md10
[root@centos7 mnt]$ mdadm -s /dev/md11         # 停止raid1設(shè)置
mdadm: stopped /dev/md11
[root@centos7 mnt]$ mdadm -s /dev/md12         # 停止radi1 設(shè)置
mdadm: stopped /dev/md12 
[root@centos7 mnt]$ mdadm -s /dev/md13         # 停止raid 1 設(shè)置
mdadm: stopped /dev/md13
[root@centos7 mnt]$ sed -i '$d' /etc/fstab        # 刪除fstab的掛載 
[root@centos7 mnt]$ cat /etc/fstab         # 確保正確

#
# /etc/fstab
# created by anaconda on tue nov 7 16:07:01 2017
#
# accessible filesystems, by reference, are maintained under '/dev/disk'
# see man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#

uuid=59ccea87-3c4e-4bbc-9e2f-3fadb1dcf2e6 /   ext4 defaults 1 1
uuid=f4e867e8-bcde-43a2-adc7-c80b0948e85f /app   ext4 noatime,usrquota,grpquota 1 2
uuid=1d6cbe88-ffb4-4adf-bacf-76be1fa75708 /boot   ext4 defaults 1 2
#uuid=b2c064f5-1ee5-4b5c-9e75-ed41cb99c5aa swap   swap defaults 0 0
#uuid=a0516c4f-40e6-4919-905a-8b44db12ff7b swap  swap defaults,pri=0 0 0 
#/dev/sdb2 /test ext4 rw,seclabel,relatime,data=ordered 0 0
#/dev/sdb1 /home xfs rw,seclabel,relatime,attr2,inode64,usrquota,grpquota 0 0
[root@centos7 mnt]$ mdadm -d           # 再次查看下mdadm信息,確保沒有了
mdadm: no devices given.
[root@centos7 mnt]$ mdadm --zero-superblock /dev/sd{b1,b2,c1,c2,d1,e1}     # 請(qǐng)求md的元數(shù)據(jù)信息

以上就是我們給大家整理的在linux磁盤管理中實(shí)現(xiàn)軟raid的方法講解,大家有不明白的可以在下方的留言區(qū)討論。

原文鏈接:http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_041_raid.html

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 明星梦淫 | 日韩一级精品视频在线观看 | 欧美日韩精品乱国产 | 幻女free性zoz0交 | 午夜伦理 第1页 | 动漫美女隐私尿口图片 | 美女口述又粗又大感觉 | 91在线 在线播放 | 耽美双性 | 大学生特黄特色大片免费播放 | 99在线精品免费视频九九视 | 极品91| 91视频免费观看网站 | 农村妇女野战bbxxx农村妇女 | 日本男男gayxxxxx免费 | 国产精品林美惠子在线观看 | 日韩一区二三区无 | 五月色天在线视频综合观看 | 久久精品无码人妻无码AV蜜臀 | 国产精品理论片 | 性做久久久久久 | 欧美一级精品 | 亚洲高清成人 | 免费精品视频在线 | 色综合天天综合中文网 | 精品视频入口 | 国产精品久久久久久久人人看 | 97午夜视频 | 青青草国产精品久久久久 | 我的好妈妈7中字在线观看韩国 | 亚洲天堂中文字幕 | 国产一区二区三区在线 | 成年人在线视频免费观看 | 肉宠文很肉到处做1v1 | 69罗莉视频在线观看 | 成人精品一区二区三区中文字幕 | 好男人好资源在线观看 | 亚洲人成绝费网站色ww | 日韩精品国产自在欧美 | voyeur 中国女厕 亚洲女厕 | 欧美日韩国产成人综合在线 |