Migrating from a single disk setup to RAID-1 on Ubuntu Linux involves a series of steps to ensure a smooth transition. Here’s a basic guide:
- Backup Data:
- Before making any changes, back up your important data. While the process is generally safe, it’s always wise to have a backup in case of unexpected issues.
- Install mdadm:
- Ensure that the
mdadm
(Multiple Device Admin) package is installed. This tool is used for managing Linux software RAID devices.
sudo apt-get install mdadm
- Ensure that the
- Identify Disks:
- Identify the disks you want to use for the RAID-1 array. You can use tools like
fdisk
orlsblk
to list available disks.
sudo fdisk -l
- Identify the disks you want to use for the RAID-1 array. You can use tools like
- Partition Disks:
- Use
fdisk
orparted
to create partitions on the new disks. Make sure the partitions have the same size.
- Use
- Create RAID-1 Array:
- Use
mdadm
to create the RAID-1 array. Replace/dev/sdX1
and/dev/sdY1
with your actual partition names.
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdX1 /dev/sdY1
- Use
- Monitor RAID Status:
- Monitor the RAID array creation process and check its status.
watch cat /proc/mdstat
Once the process is complete, you should see a line indicating that the RAID array is active and synced.
- Create Filesystem:
- Create a filesystem on the new RAID array.
sudo mkfs.ext4 /dev/md0
- Mount RAID Array:
- Create a mount point and mount the RAID array.
sudo mkdir /mnt/raid sudo mount /dev/md0 /mnt/raid
- Update /etc/mdadm/mdadm.conf:
- Update the
mdadm.conf
file to include information about your RAID array.
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
- Update the
- Update /etc/fstab:
- Update the
/etc/fstab
file to automatically mount the RAID array on boot.
echo '/dev/md0 /mnt/raid ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
- Update the
- Reboot:
- Reboot your system to ensure that the RAID array is mounted correctly.
sudo reboot
- Verify:
- After rebooting, check the RAID array status.
cat /proc/mdstat
Ensure that the array is still active and synced.
Always adapt the commands according to your specific disk names and requirements. This guide provides a basic overview, and it’s essential to understand the specifics of your system before proceeding.