博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux RAID10测试
阅读量:5857 次
发布时间:2019-06-19

本文共 7992 字,大约阅读时间需要 26 分钟。

mdadm命令用于管理系统软件RAID硬盘阵列,格式为:"mdadm [模式] <RAID设备名称> [选项] [成员设备名称]"。

mdadm命令能够在Linux系统中创建和管理软件RAID磁盘阵列组,对于其中的理论知识和操作过程是与生产环境保持一致的~mdadm命令的常用参数包括有:

参数 作用
-a 检测设备名称
-n 指定设备数量
-l 指定raid级别
-C 创建
-v 显示过程
-f 模拟设备损坏
-r 移除设备
-Q 查看摘要信息
-D 查看详细信息
-S 停止阵列

一、创建平盘阵列并挂载使用

第1步:使用mdadm命令创建RAID10,名称为"/dev/md0"。

[root@victory dev]# mdadm -Cv /dev/md0 -a yes -n 4 -l 10 /dev/sdb /dev/sdc /dev/sdd /dev/sdemdadm: layout defaults to n2mdadm: layout defaults to n2mdadm: chunk size defaults to 512Kmdadm: size set to 5238784Kmdadm: Defaulting to version 1.2 metadatamdadm: array /dev/md0 started.

第2步:把制作好的RAID磁盘阵列组格式化为xfs格式:

[root@victory dev]# mkfs.xfs /dev/md0 meta-data=/dev/md0               isize=256    agcount=16, agsize=163712 blks         =                       sectsz=512   attr=2, projid32bit=1         =                       crc=0        finobt=0data     =                       bsize=4096   blocks=2619392, imaxpct=25         =                       sunit=128    swidth=256 blksnaming   =version 2              bsize=4096   ascii-ci=0 ftype=0log      =internal log           bsize=4096   blocks=2560, version=2         =                       sectsz=512   sunit=8 blks, lazy-count=1realtime =none                   extsz=4096   blocks=0, rtextents=0[root@victory dev]# fdisk -lDisk /dev/sdd: 5368 MB, 5368709120 bytes, 10485760 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sdc: 5368 MB, 5368709120 bytes, 10485760 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sda: 5368 MB, 5368709120 bytes, 10485760 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x0006ae1e   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048      616447      307200   83  Linux/dev/sda2          616448    10485759     4934656   8e  Linux LVMDisk /dev/sde: 5368 MB, 5368709120 bytes, 10485760 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/rhel-root: 3976 MB, 3976200192 bytes, 7766016 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/rhel-swap: 1073 MB, 1073741824 bytes, 2097152 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/md0: 10.7 GB, 10729029632 bytes, 20955136 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 524288 bytes / 1048576 bytes

第3步:创建挂载点然后把存储设备进行挂载操作,挂载成功后可看到可用空间为10G:

[root@victory dev]# mkdir /fuckRAID[root@victory dev]# mount /dev/md0 /fuckRAID/[root@victory dev]# df -hFilesystem             Size  Used Avail Use% Mounted on/dev/mapper/rhel-root  3.7G  896M  2.9G  24% /devtmpfs               910M     0  910M   0% /devtmpfs                  920M     0  920M   0% /dev/shmtmpfs                  920M  8.4M  912M   1% /runtmpfs                  920M     0  920M   0% /sys/fs/cgroup/dev/sda1              297M  114M  184M  39% /boottmpfs                  184M     0  184M   0% /run/user/0/dev/md0                10G   33M   10G   1% /fuckRAID

第4步:查看/dev/md0磁盘阵列设备组详细信息,并把挂载信息写入到配置文件中永久生效:

[root@victory dev]# mdadm -D /dev/md0/dev/md0:        Version : 1.2  Creation Time : Tue Aug  1 21:59:41 2017     Raid Level : raid10     Array Size : 10477568 (9.99 GiB 10.73 GB)  Used Dev Size : 5238784 (5.00 GiB 5.36 GB)   Raid Devices : 4  Total Devices : 4    Persistence : Superblock is persistent    Update Time : Tue Aug  1 22:07:00 2017          State : clean  Active Devices : 4Working Devices : 4 Failed Devices : 0  Spare Devices : 0         Layout : near=2     Chunk Size : 512K           Name : victory.rusky.com:0  (local to host victory.rusky.com)           UUID : 6829f476:39a119d4:93da652e:83e096e3         Events : 17    Number   Major   Minor   RaidDevice State       0       8       16        0      active sync set-A   /dev/sdb       1       8       32        1      active sync set-B   /dev/sdc       2       8       48        2      active sync set-A   /dev/sdd       3       8       64        3      active sync set-B   /dev/sde[root@victory dev]# vi /etc/fstab ## /etc/fstab# Created by anaconda on Tue Aug  1 04:28:47 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#/dev/mapper/rhel-root   /                       xfs     defaults        0 0UUID=e7987771-c54c-4b36-8a5c-8e71f129c3fe /boot                   xfs     defaults        0 0/dev/mapper/rhel-swap   swap                    swap    defaults        0 0/dev/md0                /fuckRAID               xfs     defaults        0 0

二、模拟损坏磁盘阵列及修复

[root@victory dev]# mdadm /dev/md0 -f /dev/sdbmdadm: set /dev/sdb faulty in /dev/md0[root@victory dev]# mdadm -D /dev/md0/dev/md0:        Version : 1.2  Creation Time : Tue Aug  1 21:59:41 2017     Raid Level : raid10     Array Size : 10477568 (9.99 GiB 10.73 GB)  Used Dev Size : 5238784 (5.00 GiB 5.36 GB)   Raid Devices : 4  Total Devices : 4    Persistence : Superblock is persistent    Update Time : Tue Aug  1 22:26:04 2017          State : clean, degraded  Active Devices : 3Working Devices : 3 Failed Devices : 1  Spare Devices : 0         Layout : near=2     Chunk Size : 512K           Name : victory.rusky.com:0  (local to host victory.rusky.com)           UUID : 6829f476:39a119d4:93da652e:83e096e3         Events : 19    Number   Major   Minor   RaidDevice State       0       0        0        0      removed       1       8       32        1      active sync set-B   /dev/sdc       2       8       48        2      active sync set-A   /dev/sdd       3       8       64        3      active sync set-B   /dev/sde       0       8       16        -      faulty   /dev/sdb[root@victory dev]#
[root@victory ~]# umount /fuckRAID/[root@victory ~]# df -hFilesystem             Size  Used Avail Use% Mounted on/dev/mapper/rhel-root  3.7G  896M  2.9G  24% /devtmpfs               910M     0  910M   0% /devtmpfs                  920M     0  920M   0% /dev/shmtmpfs                  920M  8.4M  912M   1% /runtmpfs                  920M     0  920M   0% /sys/fs/cgroup/dev/sda1              297M  129M  168M  44% /boottmpfs                  184M     0  184M   0% /run/user/0[root@victory ~]# mdadm /dev/md0 -a /dev/sdbmdadm: added /dev/sdb[root@victory ~]# mdadm -D /dev/md0/dev/md0:        Version : 1.2  Creation Time : Tue Aug  1 21:59:41 2017     Raid Level : raid10     Array Size : 10477568 (9.99 GiB 10.73 GB)  Used Dev Size : 5238784 (5.00 GiB 5.36 GB)   Raid Devices : 4  Total Devices : 4    Persistence : Superblock is persistent    Update Time : Tue Aug  1 22:35:18 2017          State : clean, degraded, recovering  Active Devices : 3Working Devices : 4 Failed Devices : 0  Spare Devices : 1         Layout : near=2     Chunk Size : 512K Rebuild Status : 80% complete           Name : victory.rusky.com:0  (local to host victory.rusky.com)           UUID : 6829f476:39a119d4:93da652e:83e096e3         Events : 47    Number   Major   Minor   RaidDevice State       4       8       16        0      spare rebuilding   /dev/sdb       1       8       32        1      active sync set-B   /dev/sdc       2       8       48        2      active sync set-A   /dev/sdd       3       8       64        3      active sync set-B   /dev/sde[root@victory ~]# mount -a

  

转载地址:http://ksojx.baihongyu.com/

你可能感兴趣的文章
发送到快捷方式不见了
查看>>
phinx武林秘籍(上)
查看>>
计算网络带宽需求的正确姿势
查看>>
如何建立云环境下的性能测试策略
查看>>
论网站内容建设策略
查看>>
10月18日云栖精选夜读:解读OpenMessaging开源项目,阿里巴巴发起首个分布式消息领域的国际标准...
查看>>
如何把SVG小图片转换为 html字体图表
查看>>
MongDB的安装和基本操作 二(增删改查)
查看>>
RvmTranslator 3.1 is released
查看>>
WCF的三个名称/命名空间,你是否傻傻分不清楚?
查看>>
解析深度学习的未来十大趋势
查看>>
中桥国际:如何应对客户端计算趋势
查看>>
云栖长卷:一张图看懂云栖七年
查看>>
飞利浦的选择:传统IT系统迁移到云平台
查看>>
Ubuntu支持LinuxONE大型机:为云而生的强强新组合
查看>>
英特尔至强E7 v4上市,剑指Power
查看>>
IT部门不应该推迟的10个项目
查看>>
使用SQL Server 助力解决全行业数字化能力
查看>>
理解Android虚拟机体系结构
查看>>
越想越恐怖:从美国互联网瘫痪说起
查看>>