大网数据广告活动
服务器运维问答

Is it possible to convert RAID1 to RAID0 without system reinstalation?

· 52CE 我爱测

I bought the E3-SSD-3-32 server from the SoYouStart offer. There is a 3x120 GB SSD drive. Unfortunately, after some time, there was a lack of disk space. Is there any way to convert RAID1 to RAID0? The operating system is Debian …

问题原文

原帖链接 · jogiboy · CC BY-SA 4.0

I bought the E3-SSD-3-32 server from the SoYouStart offer. There is a 3x120 GB SSD drive. Unfortunately, after some time, there was a lack of disk space. Is there any way to convert RAID1 to RAID0? The operating system is Debian 9.

web1@ns510077:~$ cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty]
md1 : active raid1 sdc1[2] sdb1[1] sda1[0]
      20478912 blocks [3/3] [UUU]

md2 : active raid1 sdc2[2] sdb2[1] sda2[0]
      96211904 blocks [3/3] [UUU]

unused devices: <none>

web1@ns510077:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        20G  1.6G   17G   9% /
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G     0   16G   0% /dev/shm
tmpfs            16G  530M   16G   4% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/md2         91G   77G  9.3G  90% /var

社区高分解答

原帖链接 · nmr · CC BY-SA 4.0

Building on Strepsils's clues, for a RAID1 md volume named /dev/md2, and two partitions named /dev/nvme0n1p2 and /dev/nvme1n1p2:

  1. Remove the mirror: sudo mdadm /dev/md2 --fail /dev/nvme1n1p2, then sudo mdadm /dev/md2 --remove /dev/nvme1n1p2 (from https://www.thegeekdiary.com/centos-rhel-how-to-remove-a-mirror-with-mdadm/)

  2. Extend to raid0: sudo mdadm /dev/md2 --grow --level=0

  3. Add the second disk back: sudo mdadm --grow /dev/md2 --level=0 --raid-devices=2 --add /dev/nvme1n1p2 (Note that this will change md2 to raid4?! and automatically start reshaping. From https://serverfault.com/a/1077269/167906)

  4. Wait for reshape to finish (watch cat /proc/mdstat) (~90 minutes for an md volume that began life as a 1TB raid1 on 2 fast SSDs)

  5. /dev/md2 will automatically become raid0 after reshape is finished.

  6. Grow file system: sudo resize2fs /dev/md2

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-06-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。