Get the App
SLTechnology News&Howtos  ›  Network Security  › 

RAID implementation

Shulou Source: shulou.com Published: 2022-06-01 05:31:05 10月04日 Update

Implement soft raid

1. Fdisk t fd / / modify disk partition type fd

2. Create a raid device

Create a RAID5,5 block hard disk 4 blocks do RAID,1 block do idle hard disk (replace the hard disk)

Mdadm-C / dev/md0-a yes-l 5-n 4-x1 / dev/sd {bmeme creco dje Ji f}

-n #: use # block devices to create this RAID

-l #: indicates the level of RAID to be created

-a {yes | no}: automatically creates the device file for the target RAID device

-c CHUNK_SIZE: indicates the block size

-x #: indicates the number of free disks

Mdadm-D / dev/md0

-D: display the details of the raid letter

Cat / proc/mdstat / / observe the status of md:

3. Mkfs.ext4 / dev/md0 / / format raid devices

4 、 vim / etc/fstab

UUID= "b92ddd51-c555-4948-b1d5-8563b697a2f1" / mnt/raid ext4 defaults 0 0

5. Mdadm-Ds / dev/md0 > / etc/mdadm.conf generate configuration file

Mdadm-S / dev/md0 stop raid

Mdadm-A / dev/md0 starts raid

Out of service: mdadm-S / dev/md0

Activation: mdadm-A-s / dev/md0 activation

Forced startup: mdadm-R / dev/md0

6. Testing

Mdadm / dev/md0-f / dev/sdf1 simulated damage

Mdadm / dev/md0-r / dev/sdf1 Delete member

Mdadm / dev/md0-a / dev/sdf1 increased

Mdadm-G / dev/md0-n 6-a / dev/sdd4 add members

Note: if prompted by mdadm: Failed to initiate reshape! Indicates that the disk expansion (reshape) function does not support reducing the number of devices. Centos7 will have such an error.

7. Delete raid

Umount / mnt/raid

Mdadm-S / dev/md0 stop raid

Rm-f / etc/mdadm.conf

Vi / etc/fstab

Fdisk / dev/sda

Mdadm-- zero-superblock / dev/sdd1 / / Delete raid information

Tags: Device number hard disk block member file activation disk idle information function size format status target type level force prompt support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Docker MySQL Shulou Tech Info macOS