Ubuntu 11 (bullseye)下扩展MD RAID5阵列执行umount后阵列丢失的恢复求助
Hey there, sorry to hear you ran into this frustrating issue when trying to expand your RAID5 array. Let’s walk through getting your array back online first, then finish the expansion properly.
第一步:找回并重新装配RAID阵列
First, let’s check if mdadm can still detect the existing RAID metadata on your disks. Run these commands to scan for RAID signatures:
sudo mdadm --detail --scan sudo mdadm -E /dev/sdb1 /dev/sdc1 /dev/sde1
The second command will show metadata info for each of your original RAID partitions. Look for lines like UUID and RAID Level : raid5 to confirm these belong to your missing array.
Once you confirm the disks/partitions, reassemble the array (replace /dev/md0 with your actual RAID device name if it was different):
sudo mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 /dev/sde1
If you get an error about missing devices, double-check you’re using the correct partition paths from your lsblk output.
第二步:验证并挂载阵列
After assembling, verify the array status:
cat /proc/mdstat
You should see the array listed with active raid5 and a sync process (if needed). Next, run a file system check to make sure everything’s intact (replace /dev/md0 with your RAID device):
sudo e2fsck -f /dev/md0
Once that completes successfully, mount the array back to its original mount point (replace /your/mount/path with where it was mounted before, e.g., /mnt/raid):
sudo mount /dev/md0 /your/mount/path
You can confirm it’s mounted with lsblk again—you should see the RAID device listed with the mount point now.
第三步:继续完成RAID扩容
Now that your array is back, let’s finish adding the new 2TB disk (/dev/sdd):
Create a RAID partition on the new disk:
Usefdiskorpartedto create a partition matching the size and type of your existing RAID partitions. Forfdisk:sudo fdisk /dev/sdd- Press
nto create a new partition, select primary, use the full disk space. - Press
tto change the partition type, enterfdfor Linux RAID. - Press
wto write the changes.
You’ll now have/dev/sdd1as the new RAID partition.
- Press
Add the new partition to the RAID array:
sudo mdadm --add /dev/md0 /dev/sdd1Grow the RAID array to 4 devices:
sudo mdadm --grow /dev/md0 --raid-devices=4This will start a reshape process—check progress with
cat /proc/mdstat. Don’t interrupt this, it can take a while depending on disk speed.Expand the file system to use the new space:
Once the reshape is done, expand the file system (for ext3/ext4):sudo resize2fs /dev/md0
Important Notes
- Backup first: If you have critical data, make sure you have a backup before running any of these commands—RAID operations can go wrong if interrupted.
- Double-check device names: Always confirm you’re targeting the correct disks/partitions to avoid accidental data loss.
- Monitor sync/reshape progress: Use
cat /proc/mdstatto keep an eye on the process; it’ll show a percentage complete.
备注:内容来源于stack exchange,提问作者Eitan

