首页 > 代码库 > raid10
raid10
建立raid1+0双层架构的方法 先创建raid1再使用创建的raid1创建raid0 [root@ZQ ~]# ll /dev/sd* brw-rw----. 1 root disk 8, 0 Jun 4 05:35 /dev/sda brw-rw----. 1 root disk 8, 1 Jun 4 05:35 /dev/sda1 brw-rw----. 1 root disk 8, 2 Jun 4 05:35 /dev/sda2 brw-rw----. 1 root disk 8, 3 Jun 4 05:35 /dev/sda3 brw-rw----. 1 root disk 8, 16 Jun 4 05:47 /dev/sdb brw-rw----. 1 root disk 8, 17 Jun 4 05:51 /dev/sdb1 brw-rw----. 1 root disk 8, 18 Jun 4 05:51 /dev/sdb2 brw-rw----. 1 root disk 8, 32 Jun 4 06:18 /dev/sdc brw-rw----. 1 root disk 8, 33 Jun 4 06:24 /dev/sdc1 brw-rw----. 1 root disk 8, 34 Jun 4 06:24 /dev/sdc2 brw-rw----. 1 root disk 8, 35 Jun 4 06:24 /dev/sdc3 brw-rw----. 1 root disk 8, 48 Jun 4 05:35 /dev/sdd brw-rw----. 1 root disk 8, 64 Jun 4 21:45 /dev/sde brw-rw----. 1 root disk 8, 65 Jun 4 22:00 /dev/sde1 brw-rw----. 1 root disk 8, 66 Jun 4 22:00 /dev/sde2 brw-rw----. 1 root disk 8, 67 Jun 4 22:00 /dev/sde3 brw-rw----. 1 root disk 8, 68 Jun 4 21:45 /dev/sde4 brw-rw----. 1 root disk 8, 69 Jun 4 22:00 /dev/sde5 brw-rw----. 1 root disk 8, 70 Jun 4 22:06 /dev/sde6 brw-rw----. 1 root disk 8, 80 Jun 4 05:35 /dev/sdf [root@ZQ ~]# fdisk /dev/sdf 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 0x951e738e. 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): 1 First sector (2048-20971519, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1G Partition 1 of type Linux and of size 1 GiB is set Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (2-4, default 2): 2 First sector (2099200-20971519, default 2099200): Using default value 2099200 Last sector, +sectors or +size{K,M,G} (2099200-20971519, default 20971519): +1G Partition 2 of type Linux and of size 1 GiB is set Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): p Partition number (3,4, default 3): 3 First sector (4196352-20971519, default 4196352): Using default value 4196352 Last sector, +sectors or +size{K,M,G} (4196352-20971519, default 20971519): +1G Partition 3 of type Linux and of size 1 GiB is set Command (m for help): n Partition type: p primary (3 primary, 0 extended, 1 free) e extended Select (default e): p Selected partition 4 First sector (6293504-20971519, default 6293504): Using default value 6293504 Last sector, +sectors or +size{K,M,G} (6293504-20971519, default 20971519): +1G Partition 4 of type Linux and of size 1 GiB is set Command (m for help): p Disk /dev/sdf: 10.7 GB, 10737418240 bytes, 20971520 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: 0x951e738e Device Boot Start End Blocks Id System /dev/sdf1 2048 2099199 1048576 83 Linux /dev/sdf2 2099200 4196351 1048576 83 Linux /dev/sdf3 4196352 6293503 1048576 83 Linux /dev/sdf4 6293504 8390655 1048576 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@ZQ ~]# ll /dev/sdf* brw-rw----. 1 root disk 8, 80 Jun 4 22:26 /dev/sdf brw-rw----. 1 root disk 8, 81 Jun 4 22:26 /dev/sdf1 brw-rw----. 1 root disk 8, 82 Jun 4 22:26 /dev/sdf2 brw-rw----. 1 root disk 8, 83 Jun 4 22:26 /dev/sdf3 brw-rw----. 1 root disk 8, 84 Jun 4 22:26 /dev/sdf4 先创建两个底层的 raid1 [root@ZQ ~]# mdadm -C -v /dev/md11 -l 1 -n 2 /dev/sdf{1,2} 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=http://www.mamicode.com/0.90 mdadm: size set to 1047552K Continue creating array? y mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md11 started. [root@ZQ ~]# mdadm -C -v /dev/md12 -l 1 -n 2 /dev/sdf{3,4} 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=http://www.mamicode.com/0.90 mdadm: size set to 1047552K Continue creating array? y mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md12 started. 再创建上层的raid0 [root@ZQ ~]# mdadm -C -v /dev/md10 -l 0 -n 2 /dev/md11 /dev/md12 mdadm: chunk size defaults to 512K mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md10 started. 下面就是格式化挂载,生成配置文件.............. [root@ZQ ~]# cat /proc/mdstat Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] md10 : active raid0 md12[1] md11[0] 2093056 blocks super 1.2 512k chunks md12 : active raid1 sdf4[1] sdf3[0] 1047552 blocks super 1.2 [2/2] [UU] md11 : active raid1 sdf2[1] sdf1[0] 1047552 blocks super 1.2 [2/2] [UU] md5 : active raid5 sde6[5] sde1[0] sde5[3](S) sde3[4] sde2[1] 3142656 blocks super 1.2 level 5, 32k chunk, algorithm 2 [4/4] [UUUU] md1 : active raid1 sdc3[2] sdc2[1] 1047552 blocks super 1.2 [2/2] [UU] md0 : active raid0 sdb2[1] sdb1[0] 2095104 blocks super 1.2 512k chunks [root@ZQ ~]# mdadm -Ds > /etc/mdadm.conf [root@ZQ ~]# cat !$ cat /etc/mdadm.conf ARRAY /dev/md0 metadata=http://www.mamicode.com/1.2 name=ZQ:0 UUID=00d9284f:6fd6b3b0:afc571c6:c5441608 ARRAY /dev/md1 metadata=http://www.mamicode.com/1.2 name=ZQ:1 UUID=137b8247:e0ced5a2:625805ac:e9b31692 ARRAY /dev/md5 metadata=http://www.mamicode.com/1.2 spares=1 name=ZQ:5 UUID=32056d5a:35cf0716:fd761180:cc7b848b ARRAY /dev/md11 metadata=http://www.mamicode.com/1.2 name=ZQ:11 UUID=cdc07c3a:a6b04c76:b343e0bf:14988216 ARRAY /dev/md12 metadata=http://www.mamicode.com/1.2 name=ZQ:12 UUID=54b9071a:bb899ed0:d4ffb87b:226794e1 ARRAY /dev/md10 metadata=http://www.mamicode.com/1.2 name=ZQ:10 UUID=f24de916:0a641485:5c0d2097:fbe976a3 批量停止 必须卸载下来 [root@ZQ ~]# mdadm -Ss mdadm: Cannot get exclusive access to /dev/md5:Perhaps a running process, mounted filesystem or active volume group? mdadm: Cannot get exclusive access to /dev/md1:Perhaps a running process, mounted filesystem or active volume group? mdadm: Cannot get exclusive access to /dev/md0:Perhaps a running process, mounted filesystem or active volume group? unused devices: <none> raid删除 [root@ZQ ~]# fdisk /dev/sda ^C #创建两个分区sda5和sda6 [root@ZQ ~]# mdadm -C -v /dev/md1 -l 1 -n 2 /dev/sd5 /dev/sd6 ^C #创建raid1 [root@ZQ ~]# mdadm -Ds > /etc/mdadm.conf ^C #生成配置文件 开始删除 [root@ZQ ~]# umount /dev/md1 /raid1 ^C #已挂载的就先卸载 [root@ZQ ~]# mdadm -Ss ^C # 停止raid设备 [root@ZQ ~]# rm -rf /etc/mdadm.conf ^C #删除raid 配置文件 [root@ZQ ~]# mdadm --misc --zero -superblock /dev/sda5^C #清除物理磁盘中的raid标识 [root@ZQ ~]# mdadm --misc --zero -superblock /dev/sda6^C #清除物理磁盘中的raid标识 参数说明: mdadm --misc options... devices report on or modify various md related devices #报告或修改各种md相关设备 --zero -superblock: erase the MD superblock from a device #擦除设备中的md超级块
raid10
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。