RAID10
🚀 Safe Migration to RAID 10 with Filesystem Change
This README will guide you through the process of migrating a single hard drive to a RAID 10 configuration, switching from ext4 to XFS, without losing your precious data. 📦🔄
🛠️ Prerequisites
Before starting, make sure you have the following:
- Four 16TB hard drives.
- Access to a Linux system with mdadm
installed.
- Complete backup of your data.
📋 Steps to Follow
Step 1: Initial RAID 1 Setup
Create a Degraded RAID 1 🏗️
- Use a new drive and leave space for the original drive to be added later:
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb missing
- Note: Replace
/dev/sdb
with the identifier of the new drive.
Format the RAID 1 with XFS 📄
- Apply the XFS filesystem to the newly created RAID 1:
sudo mkfs.xfs /dev/md0
Mount and Copy Data 🔄
- Mount the RAID and copy data from the original drive:
sudo mkdir /mnt/md0 sudo mount /dev/md0 /mnt/md0 sudo rsync -avh /mnt/original/ /mnt/md0/
Step 2: Add the Original Drive to the RAID 1
Format the Original Drive to XFS and Add it to RAID 💾
- Ensure the original drive is now formatted with XFS and add it to the RAID:
sudo mdadm --manage /dev/md0 --add /dev/sda1
Synchronization ⏱️
- Wait for synchronization to complete by checking the progress:
watch cat /proc/mdstat
Step 3: Expand to RAID 10
Convert RAID 1 to RAID 10 📈
- Add two additional drives and convert the setup to RAID 10:
sudo mdadm --grow /dev/md0 --level=10 --raid-devices=4 /dev/sdc /dev/sdd
Finalize RAID 10 Setup 🔧
- Verify everything is configured correctly:
sudo mdadm --detail /dev/md0
Step 4: Final Filesystem Configuration
Adjust XFS Filesystem 🛠️
- Resize the filesystem to use all available space in RAID 10:
sudo xfs_growfs /dev/md0
Mount RAID 10 📁
- Mount RAID 10 and update
fstab
for automatic mounts:
sudo mkdir /mnt/RAID10 sudo mount /dev/md0 /mnt/RAID10 echo '/dev/md0 /mnt/RAID10 xfs defaults 0 0' | sudo tee -a /etc/fstab
- Mount RAID 10 and update
🎉 Conclusion
Congratulations! 🎉 You have successfully configured a RAID 10 and migrated your data without losing a byte. Now you enjoy a more robust and high-performance system. Be sure to verify the integrity of your data and enjoy your new storage setup. 🚀