Check current status
Remove curent raid
1
2
3
| sudo umount /dev/md0
sudo mdadm --stop /dev/md0
sudo mdadm --remove /dev/md0
|
Show existed linux raid
1
| lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
|
Remove superblock
1
2
| sudo mdadm --zero-superblock /dev/sda
sudo mdadm --zero-superblock /dev/sdb
|
Remove partition table
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| sudo gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): x
Expert command (? for help): z
About to wipe out GPT on /dev/sda. Proceed? (Y/N): Y
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): Y
|
Create Raid5
1
| sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4 /dev/sda /dev/sdb /dev/sdc /dev/sdd
|
Wait a until end, no restart! Check command: cat /proc/mdstat
Create FileSystem
1
2
3
4
5
| sudo mkfs.ext4 -F /dev/md0
sudo mkdir -p /mnt/raid5
sudo mount /dev/md0 /mnt/raid5
echo '/dev/md0 /mnt/raid5 ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
|
Check space
1
| df -h -x devtmpfs -x tmpfs
|
Save the Array Layout
1
| sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
|
To available in early boot process
1
| sudo update-initramfs -u
|