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.
- Install
mdadm:
mdadm is not already installed, open your terminal and run:- Identify Available Disks:
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. - Create the RAID 5 Array:
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. - Verify RAID Creation:
- Format the RAID 5 Array:
ext4: - Mount the RAID 5 Array:
- Configure Automatic Mount on Boot (Optional):
/etc/fstab file: :max_bytes(150000):strip_icc():format(webp)/Ubuntu_GDM_logo_alternative-5a0a01210d327a00369204f8.png)
:max_bytes(150000):strip_icc():format(webp)/virtualbox1-56a5ab153df78cf7728954ff.png)
:max_bytes(150000):strip_icc():format(webp)/ubuntudownload-5806edee3df78cbc28ac054c.png)
:max_bytes(150000):strip_icc():format(webp)/installvirtualbox5b-56a5ab193df78cf772895515.png)
:max_bytes(150000):strip_icc():format(webp)/createvirtualmachine1b-56a5ab195f9b58b7d0dde738.png)