245 字
1 分钟

Tinkering Log: Converting RAID1 to RAID0 on OP Du Fu with mdadm

Terminal window
Full command set do NOT blindly copy-paste; adjust according to your own disk layout
lsblk
df -h
cat /proc/mdstat # check current RAID level and member disks
mdadm /dev/md1 --fail /dev/sdb2 # tell the system this disk has failed
mdadm /dev/md1 --remove /dev/sdb2 # hot-remove the disk
Since RAID1 mirrors data, removing either disk after sync completes will not cause downtime
Check whether your array is /dev/md1 or /dev/md2 using lsblk or df -h; mine happens to be md1
wipefs -a /dev/sdb2 ## wipe the partition data on sdb2 – adapt to your own output!
mdadm --grow /dev/md1 --level=0 # convert to RAID0
# Add the previously removed disk as the second device and start the conversion
mdadm --grow /dev/md1 --level=0 --raid-devices=2 --add /dev/sdb2
## Once you run these commands, the conversion starts in the background and will take quite a while
During this period you can use `watch cat /proc/mdstat` to monitor progress. It will first convert to RAID4,
then to RAID0. This takes a long time, so it’s best to let it run overnight and check it in the morning.
cat /proc/mdstat # check conversion progress and RAID level
watch cat /proc/mdstat
cat /proc/mdstat
resize2fs /dev/md1 ## recalculate filesystem size
df -h ## verify success
reboot ## reboot
Tinkering Log: Converting RAID1 to RAID0 on OP Du Fu with mdadm
https://catcat.blog/en/op-raid1-to-raid0.html
作者
猫猫博客
发布于
2023-06-19
许可协议
CC BY-NC-SA 4.0