1.raid简介
RAID 是英文 Redundant Array of Independent Disk 的首字母缩写,中文意思是:独立磁盘冗余阵列。通俗的讲就是把多块硬盘组成一个独立的磁盘阵列进行管理。
磁盘阵列是由很多块独立的磁盘,组合成一个容量巨大的磁盘组,利用个别磁盘提供数据所产生加成效果提升整个磁盘系统效能。利用这项技术,将数据切割成许多区段,分别存放在各个硬盘上。
磁盘阵列还能利用同位检查(Parity Check)的观念,当数组中任意一个硬盘发生故障时,仍可读出数据。在数据重构时,可将数据经计算后重新置入新硬盘中。
用RAID最直接的好处是:
提升数据安全性
提升数据读写性能
提供更大的单一逻辑磁盘数据容量存储
1.1安装mdadm软件包
[root@wjl ~]# yum -y install mdadm
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors.ustc.edu.cn
* extras: mirrors.ustc.edu.cn
* updates: mirrors.ustc.edu.cn
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
updates/7/x86_64/primary_db | 20 MB 00:00:02
Resolving Dependencies
--> Running transaction check
---> Package mdadm.x86_64 0:4.1-9.el7_9 will be installed
--> Processing Dependency: libreport-filesystem for package: mdadm-4.1-9.el7_9.x86_64
......
2.安装raid0
Raid0技术是把多块(至少两块)物理硬盘通过工具绑在一起,组成一个大的虚拟存储设备,并将数据分成几块分别依次写入到各个物理硬盘中。这样,在理想的情况下,硬盘的读写性能将会提高数倍,但是raid0也有局限性,提高读写速率的同时,如果任意中的一块硬盘发生故障,将会导致整个系统的数据都受到破坏。如图1所示,数据被分成多段分别写入到不同的硬盘中,即数据分别保存到disk1和disk2中,最终实现提升读取、写入的速度。
2.1.在虚拟机中安装raid0
#安装raid0
[root@wjl ~]# mdadm --create /dev/md0 --level 0 --raid-devices 2 /dev/sdb /dev/sdc
mdadm: Fail to create md0 when using /sys/module/md_mod/parameters/new_array, fallback to creation via node
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@wjl ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 60G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 59G 0 part
├─centos-root 253:0 0 38.3G 0 lvm /
├─centos-swap 253:1 0 2G 0 lvm [SWAP]
└─centos-home 253:2 0 18.7G 0 lvm /home
sdb 8:16 0 50G 0 disk
└─md0 9:0 0 100G 0 raid0
sdc 8:32 0 50G 0 disk
└─md0 9:0 0 100G 0 raid0
sdd 8:48 0 50G 0 disk
sde 8:64 0 50G 0 disk
sr0 11:0 1 4.2G 0 rom
#格式转换
[root@wjl ~]# mkfs.xfs /dev/md0
meta-data=/dev/md0 isize=512 agcount=16, agsize=1637248 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=26195968, imaxpct=25
= sunit=128 swidth=256 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=12792, version=2
= sectsz=512 sunit=8 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
#查看md0的uuid
[root@wjl ~]# blkid /dev/md0
/dev/md0: UUID="08923ff4-a585-4bf7-8a8c-28790c55b3ea" TYPE="xfs"
#进入/etc/fstab文件里面,添加。
UUID="08923ff4-a585-4bf7-8a8c-28790c55b3ea" /raid0 xfs defaults 0 0
#新建raid0的文件夹
[root@wjl ~]# mkdir /raid0
#挂载,查看
[root@wjl ~]# mount -a
[root@wjl ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 39G 8.2G 31G 22% /
devtmpfs 899M 0 899M 0% /dev
tmpfs 911M 0 911M 0% /dev/shm
tmpfs 911M 9.6M 902M 2% /run
tmpfs 911M 0 911M 0% /sys/fs/cgroup
/dev/mapper/centos-home 19G 33M 19G 1% /home
/dev/sda1 1014M 142M 873M 14% /boot
tmpfs 183M 0 183M 0% /run/user/0
/dev/md0 100G 33M 100G 1% /raid0
#卸载,删除目录里面的uuid
[root@wjl ~]# umount /raid0
[root@wjl ~]# vi /etc/fstab
[root@wjl ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Mar 2 16:56:16 2023
#
# 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
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=3fd12c19-c667-47d3-8ff0-27d6599f9cb9 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
3.安装raid1
如果生产环境对硬盘设别的读写速度没有要求,而是要求增加数据的安全性,这时候就要用到Raid1技术。
Raid1技术是把两块(多块)物理磁盘设备进行绑定,在写入数据时,是将数据同时写入到多块硬盘设备上(这里可以看作数据的备份或者时镜像)。当其中一块硬盘发生故障时,不会损坏数据,而是立即自动以热交换的方式来恢复数据的正常使用。Raid1技术虽然保证了数据的安全性,但是也有不足的地方,因为在多块设备中写入了相同的数据,因此硬盘的利用率下降了一半。从理论上讲,如图2所示的硬盘空间的真实可用率为50%;由三块硬盘组成的Raid1磁盘阵列的可用率为33%左右,以此类推。由于需要把数据同时写入到两块以上的硬盘设备,这无疑也在一定程度上增大了计算功能的负载。
3.1.在虚拟机中安装raid1
#安装raid1
[root@wjl ~]# mdadm --create /dev/md1 --level 1 --raid-devices 2 /dev/sdd /dev/sde
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: Fail to create md1 when using /sys/module/md_mod/parameters/new_array, fallback to creation via node
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md1 started.
[root@wjl ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 60G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 59G 0 part
├─centos-root 253:0 0 38.3G 0 lvm /
├─centos-swap 253:1 0 2G 0 lvm [SWAP]
└─centos-home 253:2 0 18.7G 0 lvm /home
sdb 8:16 0 50G 0 disk
└─md0 9:0 0 100G 0 raid0
sdc 8:32 0 50G 0 disk
└─md0 9:0 0 100G 0 raid0
sdd 8:48 0 50G 0 disk
└─md1 9:1 0 50G 0 raid1
sde 8:64 0 50G 0 disk
└─md1 9:1 0 50G 0 raid1
sr0 11:0 1 4.2G 0 rom
#格式转换
[root@wjl ~]# mkfs.xfs /dev/md1
meta-data=/dev/md1 isize=512 agcount=4, agsize=3274688 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=13098752, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=6395, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
#查看md1的uuid
[root@wjl ~]# blkid /dev/md1
/dev/md1: UUID="c6533b2b-73a7-4dd2-8134-d4df0fba01ca" TYPE="xfs"
#进入/etc/fstab文件里面,添加。
UUID="c6533b2b-73a7-4dd2-8134-d4df0fba01ca" /raid1 xfs defaults 0 0
#新建raid1的文件夹
[root@wjl ~]# mkdir /raid1
#挂载,查看
[root@wjl ~]# mount -a
[root@wjl ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 39G 8.2G 31G 22% /
devtmpfs 899M 0 899M 0% /dev
tmpfs 911M 0 911M 0% /dev/shm
tmpfs 911M 9.6M 902M 2% /run
tmpfs 911M 0 911M 0% /sys/fs/cgroup
/dev/mapper/centos-home 19G 33M 19G 1% /home
/dev/sda1 1014M 142M 873M 14% /boot
tmpfs 183M 0 183M 0% /run/user/0
/dev/md1 50G 33M 50G 1% /raid1
#卸载,删除目录里面的uuid
[root@wjl ~]# umount /raid1
[root@wjl ~]# vi /etc/fstab
[root@wjl ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Mar 2 16:56:16 2023
#
# 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
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=3fd12c19-c667-47d3-8ff0-27d6599f9cb9 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
4.安装raid5
Raid5技术是把硬盘设备的数据奇偶校验信息保存到其他硬盘设备中。raid5磁盘阵列组中数据的奇偶校验信息并不是单独保存到某一个磁盘设备中,而是存储到除自身以外的其他每一块对应设备上,这样的好处是其中任何一个设备损坏后不至于出现致命缺陷。如图3“parity”部分存放的就是数据的奇偶校验信息,换句话说,Raid5技术实际上没有备份磁盘中的真实数据,而是当硬盘设备出现问题后,通过奇偶校验技术来尝试重建损坏的数据。Raid5这样的技术特性 “妥协”的兼顾了硬盘设备的读写速度、数据安全性与存储成本问题。
4.1.在虚拟机中安装raid5
#安装raid5
[root@wjl ~]# mdadm --create /dev/md5 --level 5 --raid-devices 3 /dev/sdb /dev/sdc /dev/sdd
mdadm: Fail to create md5 when using /sys/module/md_mod/parameters/new_array, fallback to creation via node
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
[root@wjl ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 60G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 59G 0 part
├─centos-root 253:0 0 38.3G 0 lvm /
├─centos-swap 253:1 0 2G 0 lvm [SWAP]
└─centos-home 253:2 0 18.7G 0 lvm /home
sdb 8:16 0 30G 0 disk
└─md5 9:5 0 60G 0 raid5
sdc 8:32 0 30G 0 disk
└─md5 9:5 0 60G 0 raid5
sdd 8:48 0 30G 0 disk
└─md5 9:5 0 60G 0 raid5
sde 8:64 0 40G 0 disk
sdf 8:80 0 40G 0 disk
sdg 8:96 0 40G 0 disk
sdh 8:112 0 40G 0 disk
sr0 11:0 1 4.2G 0 rom
#格式转换
[root@wjl ~]# mkfs.xfs /dev/md5
meta-data=/dev/md5 isize=512 agcount=16, agsize=982400 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=15718400, imaxpct=25
= sunit=128 swidth=256 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=7680, version=2
= sectsz=512 sunit=8 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
#查看md5的uuid
[root@wjl ~]# blkid /dev/md5
/dev/md5: UUID="e041659c-dc79-4551-bae9-56a1b5d0a117" TYPE="xfs"
#进入/etc/fstab文件里面,添加。
UUID="e041659c-dc79-4551-bae9-56a1b5d0a117" /raid5 xfs defaults 0 0
#新建raid5的文件夹
[root@wjl ~]# mkdir /raid5
#挂载,查看
[root@wjl ~]# mount -a
[root@wjl ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 39G 8.2G 31G 22% /
devtmpfs 899M 0 899M 0% /dev
tmpfs 911M 0 911M 0% /dev/shm
tmpfs 911M 9.6M 902M 2% /run
tmpfs 911M 0 911M 0% /sys/fs/cgroup
/dev/mapper/centos-home 19G 33M 19G 1% /home
/dev/sda1 1014M 142M 873M 14% /boot
tmpfs 183M 0 183M 0% /run/user/0
/dev/md5 60G 33M 60G 1% /raid5
#卸载,删除目录里面的uuid
[root@wjl ~]# umount /raid5
[root@wjl ~]# vi /etc/fstab
[root@wjl ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Mar 2 16:56:16 2023
#
# 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
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=3fd12c19-c667-47d3-8ff0-27d6599f9cb9 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
5.安装raid10
鉴于Raid5技术是因为磁盘设备的成本问题,对读写速度和数据的安全性能而又一定的妥协,但是在企业里更在乎的还是数据本身的价值而非硬盘的价格,因此在生产环境中推荐使用raid10技术。
Raid10是Raid1和Raid0的组合体,如图4所示,Raid10技术至少需要4块硬盘来组建,其中先分别两两制成Raid1磁盘阵列,以保证数据的安全性。然后再对两个Raid1磁盘按阵列实施Raid0技术,进一步提高硬盘设备的读写速度。这样从理论上讲,只要坏的不是同一组中的所有磁盘,那么最多可以损坏50%的硬盘设备而不丢失数据。由于Raid10技术击继承了Raid0的高速写速度和Raid1的数据安全性,在不考虑成本的情况下Raid10的性能都超过了Raid5,因此当前成为广泛使用的一种存储技术。
5.1.在虚拟机中安装raid10
#安装raid10
[root@wjl ~]# mdadm --create /dev/md10 --level 10 --raid-devices 4 /dev/sd{e,f,g,h}
mdadm: Fail to create md10 when using /sys/module/md_mod/parameters/new_array, fallback to creation via node
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md10 started.
[root@wjl ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 60G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 59G 0 part
├─centos-root 253:0 0 38.3G 0 lvm /
├─centos-swap 253:1 0 2G 0 lvm [SWAP]
└─centos-home 253:2 0 18.7G 0 lvm /home
sdb 8:16 0 30G 0 disk
└─md5 9:5 0 60G 0 raid5
sdc 8:32 0 30G 0 disk
└─md5 9:5 0 60G 0 raid5
sdd 8:48 0 30G 0 disk
└─md5 9:5 0 60G 0 raid5
sde 8:64 0 40G 0 disk
└─md10 9:10 0 80G 0 raid10
sdf 8:80 0 40G 0 disk
└─md10 9:10 0 80G 0 raid10
sdg 8:96 0 40G 0 disk
└─md10 9:10 0 80G 0 raid10
sdh 8:112 0 40G 0 disk
└─md10 9:10 0 80G 0 raid10
sr0 11:0 1 4.2G 0 rom
#格式转换
[root@wjl ~]# mkfs.xfs /dev/md10
meta-data=/dev/md10 isize=512 agcount=16, agsize=1309568 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=20953088, imaxpct=25
= sunit=128 swidth=256 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=10232, version=2
= sectsz=512 sunit=8 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
#查看md10的uuid
[root@wjl ~]# blkid /dev/md10
/dev/md10: UUID="aece229e-bc6e-4ad1-9c42-0440ded2739b" TYPE="xfs"
#进入/etc/fstab文件里面,添加。
UUID="aece229e-bc6e-4ad1-9c42-0440ded2739b" /raid10 xfs defaults 0 0
#新建raid10的文件夹
[root@wjl ~]# mkdir /raid10
#挂载,查看
[root@wjl ~]# mount -a
[root@wjl ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 39G 8.2G 31G 22% /
devtmpfs 899M 0 899M 0% /dev
tmpfs 911M 0 911M 0% /dev/shm
tmpfs 911M 9.6M 902M 2% /run
tmpfs 911M 0 911M 0% /sys/fs/cgroup
/dev/mapper/centos-home 19G 33M 19G 1% /home
/dev/sda1 1014M 142M 873M 14% /boot
tmpfs 183M 0 183M 0% /run/user/0
/dev/md10 80G 33M 80G 1% /raid10
#卸载,删除目录里面的uuid
[root@wjl ~]# umount /raid10
[root@wjl ~]# vi /etc/fstab
[root@wjl ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Mar 2 16:56:16 2023
#
# 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
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=3fd12c19-c667-47d3-8ff0-27d6599f9cb9 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
6.分区,格式化,挂载
6.1分区
[root@wjl ~]# fdisk /dev/md5
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 0xacaef86c.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-125759487, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-125759487, default 125759487): +5G
Partition 1 of type Linux and of size 5 GiB is set
Command (m for help): p
Disk /dev/md5: 64.4 GB, 64388857856 bytes, 125759488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk label type: dos
Disk identifier: 0xacaef86c
Device Boot Start End Blocks Id System
/dev/md5p1 2048 10487807 5242880 83 Linux
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (2-4, default 2):
First sector (10487808-125759487, default 10487808):
Using default value 10487808
Last sector, +sectors or +size{K,M,G} (10487808-125759487, default 125759487): +6G
Partition 2 of type Linux and of size 6 GiB is set
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): e
Partition number (3,4, default 3): 3
First sector (23070720-125759487, default 23070720):
Using default value 23070720
Last sector, +sectors or +size{K,M,G} (23070720-125759487, default 125759487): +15G
Partition 3 of type Extended and of size 15 GiB is set
Command (m for help): p
Disk /dev/md5: 64.4 GB, 64388857856 bytes, 125759488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk label type: dos
Disk identifier: 0xacaef86c
Device Boot Start End Blocks Id System
/dev/md5p1 2048 10487807 5242880 83 Linux
/dev/md5p2 10487808 23070719 6291456 83 Linux
/dev/md5p3 23070720 54527999 15728640 5 Extended
Command (m for help): n
Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (23072768-54527999, default 23072768):
Using default value 23072768
Last sector, +sectors or +size{K,M,G} (23072768-54527999, default 54527999): +6G
Partition 5 of type Linux and of size 6 GiB is set
Command (m for help): p
Disk /dev/md5: 64.4 GB, 64388857856 bytes, 125759488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk label type: dos
Disk identifier: 0xacaef86c
Device Boot Start End Blocks Id System
/dev/md5p1 2048 10487807 5242880 83 Linux
/dev/md5p2 10487808 23070719 6291456 83 Linux
/dev/md5p3 23070720 54527999 15728640 5 Extended
/dev/md5p5 23072768 35655679 6291456 83 Linux
Command (m for help): n
Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 6
First sector (35657728-54527999, default 35657728):
Using default value 35657728
Last sector, +sectors or +size{K,M,G} (35657728-54527999, default 54527999): +6G
Partition 6 of type Linux and of size 6 GiB is set
Command (m for help): p
Disk /dev/md5: 64.4 GB, 64388857856 bytes, 125759488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk label type: dos
Disk identifier: 0xacaef86c
Device Boot Start End Blocks Id System
/dev/md5p1 2048 10487807 5242880 83 Linux
/dev/md5p2 10487808 23070719 6291456 83 Linux
/dev/md5p3 23070720 54527999 15728640 5 Extended
/dev/md5p5 23072768 35655679 6291456 83 Linux
/dev/md5p6 35657728 48240639 6291456 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#查看分好区md5
[root@wjl ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 60G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 59G 0 part
├─centos-root 253:0 0 38.3G 0 lvm /
├─centos-swap 253:1 0 2G 0 lvm [SWAP]
└─centos-home 253:2 0 18.7G 0 lvm /home
sdb 8:16 0 30G 0 disk
└─md5 9:5 0 60G 0 raid5
├─md5p1 259:5 0 5G 0 md
├─md5p2 259:6 0 6G 0 md
├─md5p3 259:7 0 1K 0 md
├─md5p5 259:8 0 6G 0 md
└─md5p6 259:9 0 6G 0 md
sdc 8:32 0 30G 0 disk
└─md5 9:5 0 60G 0 raid5
├─md5p1 259:5 0 5G 0 md
├─md5p2 259:6 0 6G 0 md
├─md5p3 259:7 0 1K 0 md
├─md5p5 259:8 0 6G 0 md
└─md5p6 259:9 0 6G 0 md
sdd 8:48 0 30G 0 disk
└─md5 9:5 0 60G 0 raid5
├─md5p1 259:5 0 5G 0 md
├─md5p2 259:6 0 6G 0 md
├─md5p3 259:7 0 1K 0 md
├─md5p5 259:8 0 6G 0 md
└─md5p6 259:9 0 6G 0 md
sde 8:64 0 40G 0 disk
└─md10 9:10 0 80G 0 raid10
sdf 8:80 0 40G 0 disk
└─md10 9:10 0 80G 0 raid10
sdg 8:96 0 40G 0 disk
└─md10 9:10 0 80G 0 raid10
sdh 8:112 0 40G 0 disk
└─md10 9:10 0 80G 0 raid10
sdi 8:128 0 88G 0 disk
sr0 11:0 1 4.2G 0 rom
6.2格式化
[root@wjl ~]# ls /dev/md5p1
/dev/md5p1
[root@wjl ~]# ls /dev/md5p1 -l
brw-rw---- 1 root disk 259, 5 Mar 16 16:04 /dev/md5p1
#格式化
[root@wjl ~]# mkfs.ext4 /dev/md5p1
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=256 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
#查看uuid号
[root@wjl ~]# blkid /dev/md5p1
/dev/md5p1: UUID="dac1e954-9c70-4a0e-8475-c47d6b92a996" TYPE="ext4"
#进入/etc/fstab填写
UUID="dac1e954-9c70-4a0e-8475-c47d6b92a996" /media/md5p1 ext4 defaults 0 0
#挂载和查看
[root@wjl ~]# mkdir /media/md5p1
[root@wjl ~]# mount -a
[root@wjl ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 39G 8.2G 31G 22% /
devtmpfs 899M 0 899M 0% /dev
tmpfs 911M 0 911M 0% /dev/shm
tmpfs 911M 9.6M 902M 2% /run
tmpfs 911M 0 911M 0% /sys/fs/cgroup
/dev/sda1 1014M 142M 873M 14% /boot
/dev/mapper/centos-home 19G 33M 19G 1% /home
tmpfs 183M 0 183M 0% /run/user/0
/dev/md5p1 4.8G 20M 4.6G 1% /media/md5p1
标签:wjl,512,raid,centos,简介,dev,disk,root
From: https://www.cnblogs.com/shuangmu668/p/17230844.html