Translate

2025/07/01

Create RAID 5 Arrays with mdadm on Ubuntu 22.04

 To create a RAID 5 array with mdadm on Ubuntu 22.04, first install the mdadm package, identify your available disks using lsblk, and then use the mdadm --create command with the --level=5 and --raid-devices options to build the array, followed by formatting and mounting the new RAID device. 

Steps to Create a RAID 5 Array with mdadm on Ubuntu 22.04: 
  1. Install mdadm:
If mdadm is not already installed, open your terminal and run:
Code
    sudo apt update    sudo apt install mdadm
 
  1. Identify Available Disks:
Use lsblk to list all available disks and identify the ones you want to include in your RAID 5 array. Be careful to select the correct disks, as the process will erase any data on them. 
Code
    lsblk
  1. Create the RAID 5 Array: 
Execute the mdadm --create command to build the RAID 5 array. Replace /dev/md0 with your desired RAID device name (e.g., /dev/md0/dev/md1, etc.), 3 with the number of devices in your array, and /dev/sda/dev/sdb/dev/sdc with the actual device names you identified in the previous step. For RAID 5, you need a minimum of three devices. 
Code
    sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sda /dev/sdb /dev/sdc
 
  1. Verify RAID Creation:
You can check the status of your newly created RAID array with: 
Code
    sudo mdadm --detail /dev/md0
 
  1. Format the RAID 5 Array:
Create a filesystem on the RAID array, for example, ext4: 
Code
    sudo mkfs.ext4 /dev/md0
 
  1. Mount the RAID 5 Array:
Create a mount point and then mount the RAID array: 
Code
    sudo mkdir /mnt/raid5    sudo mount /dev/md0 /mnt/raid5
 
  1. Configure Automatic Mount on Boot (Optional):
To ensure the RAID array mounts automatically on boot, add an entry to your /etc/fstab file: 
Code
    echo "/dev/md0 /mnt/raid5 ext4 defaults 0 0" | sudo tee -a /etc/fstab
 

No comments:

10 Powerful Benefits of Castor Leaves You Probably Didn’t Know About

  10 Powerful Benefits of Castor Leaves You Probably Didn’t Know About Castor leaves, often overshadowed by castor oil, are packed with heal...