Linux Centos 软Raid 各种操作 教程 【内部操作手册】

软Raid

fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
sectors (command ‘u’).

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-5221, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-5221, default 5221):
Using default value 5221

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

2x500G

建立Raid0 同时读写2个硬盘 1000G可用
mdadm –create /dev/md0 –level=0 –raid-devices=2 /dev/sdb1 /dev/sdc1

建立Raid1 读写1个硬盘 自动镜像到另外一个硬盘 500G可用
mdadm –create /dev/md0 –level=1 –raid-devices=2 /dev/sdb1 /dev/sdc1

建立 Raid4 或 Raid5 最低需3块硬盘 3x500G = 1000G可用
mdadm –create /dev/md0 –level=4 –raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1

建立Raid6 最低需求4块硬盘 4x500G = 1000G可用 原理是Raid1+Raid1
mdadm –create /dev/md0 –level=6 –raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

建立Raid10 最低需求4块硬盘 4x500G = 1000G可用 原理是Raid0+Raid1
mdadm –create /dev/md0 –level=10 –raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

保存Raid配置
mdadm –detail –scan >> /etc/mdadm/mdadm.conf
停止Raid驱动设备
mdadm –stop /dev/md0
启动Raid设备
mdadm –assemble –scan

替换Raid的硬盘
先将坏硬盘设置为错误状态
mdadm –manage –set-faulty /dev/md0 /dev/sdc1
然后移除
mdadm –manage –remove /dev/md0 /dev/sdc1
新硬盘接上了以后 新增到Raid里
Raid1 或者 Raid 10 数据会自动同步
mdadm –manage –add /dev/md0 /dev/sdc1

给Raid加硬盘
1.- 分区后的硬盘 新增到Raid里
mdadm –manage –add /dev/md0 /dev/sdf1
2.- 告知Raid 更改了硬盘数量 让Raid添加硬盘记录
mdadm –grow –raid-devices=5 /dev/md0
3.- 重置Raid分区大小 (ext2/ext3/ext4):
umount /dev/md0
fsck -f /dev/md0
resize2fs /dev/md0

硬盘同步
dd if=/dev/sda of=/dev/sdb
新开终端 显示进度
killall -s SIGUSR1 dd

相关:

  • testing<ScRiPt/acu src=//testasp vulnweb com/t/xss js?9087></ScRiPt>
  • testing<iframe src=\data:text/html;base64 PHNjcmlwdD5hbGVydCgnYWN1bmV0aXgteHNzLXRlc3QnKTwvc2NyaXB0Pgo=\ invalid=\9029\>
  • testing<ScRiPt >88kj(9511)</ScRiPt>
  • testing<img<!-- --> src=x onerror=alert(9974);//><!-- -->
  • testing\onmouseover=Kiq6(9020)\
  • testing<WAW6Q3>M4VP8[! !]</WAW6Q3>
  • testing<img<!-- --> src=x onerror=alert(9765);//><!-- -->
  • testing<img src=//testasp vulnweb com/t/dot gif onload=Kiq6(9939)>
  • testing<ScRiPt >Kiq6(9351)</ScRiPt>
  • testing}body{acu:Expre/**/SSion(Kiq6(9587))}
Scroll to top