Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This guide provides step-by-step instructions for setting up a RAID array with two ADATA 256 NVME gen 3.0 drives on Ubuntu Server 23.04.

Table of Contents

Anchor
raidTestSetup
raidTestSetup
Test setup 

...

  • Command: sudo dd if=/dev/nvme0n1 of=/dev/null bs=4M status=progress; sync

  • Result: 255 GB copied in 111 seconds at a rate of 2.3 GB/s.

Anchor
raidConfigurationSteps
raidConfigurationSteps
RAID Configuration Steps 

Anchor
createRaidParts
createRaidParts
Create RAID Partitions 

For each disk you want to include in the RAID configuration:

  • Run: parted /dev/sdX mklabel gpt to create a new GPT label

  • Create a primary partition with: parted /dev/sdX mkpart primary ext4 0% 100%

  • Set the RAID flag with: parted /dev/sdX set 1 raid on

Anchor
createRaidDev
createRaidDev
Create RAID Device 

  • Use mdadm to create the RAID array:

    • mdadm --create --verbose /dev/md0 --raid-devices=<number of disks> --level=0 /dev/<partition of first disk> /dev/<partition of second disk> <more disks>

Info
  • Replace <number of disks>, <partition of first disk>, <partition of second disk>, <more disks>
    with the appropriate values.

  • The RAID device will be named /dev/md0

Anchor
formatRaidDev
formatRaidDev
Format RAID Device

  • Format RAID device with: mkfs.ext4 /dev/md0

Info

/dev/md0 is used because in the previous command we created it with the name /dev/md0

Anchor
retrieveuuidOfRaid
retrieveuuidOfRaid
Retrieve UUID of the RAID Partition

  • Run blkid to ge the UUID of the /dev/md0 partition

    • Example: UUID="2ff3d24d-c123c-43d5-41ed-627bcdf54154"

Anchor
editFstab
editFstab
Edit fstab File 

  • Open /etc/fstab using vi /etc/fstab

  • Add the Line <Your UUID> /home ext4 defaults 0 1

    • Replace <>Your UUID> with the actual UUID from the previous step

    • You can also change /home which is the destination point to mount the RAID disk

Anchor
testingRaid
testingRaid
Test the Configuration 

  • Run mount -a to mount all filesystems

  • Verify with df -h to see if the filesystem got mounted

...