0

I'm facing an issue with my RAID 0 setup on Linux. I've created a RAID 0 array with 4 disks, but after a few hours of activity and several system reboots, Linux changes the /dev/sd* directives used in the RAID creation. This causes the array to become unsynchronized and ultimately breaks the RAID.

Is there a way to persist the /dev/sd* mappings across reboots to prevent this issue? Any help would be greatly appreciated!

Obs: using mdadm.

3
  • 1
    Don't put device names and the like in your mdadm.conf... just the UUID is sufficient. Don't use unpartitioned drives. If it's not that, please show mdadm examine, mdstat, dmesg error messages, etc... Commented Jun 26, 2024 at 21:23
  • Oh, raid 0 also has a special case if the devices are not the same size (raid0.default_layout) but that only affects older arrays (or arrays created using old versions of mdadm.) However if that was the issue it should be obvious from error message... Commented Jun 26, 2024 at 21:29
  • Bear in mind that for four disks in a RAID0, if any one disk fails you've lost the entire array - and its content. Statistically, your RAID0 will fail four times sooner than the failure rate for one disk. You do have backups of your data don't you? Commented Jun 27, 2024 at 7:37

1 Answer 1

1

You shouldn't be specifying specific disk devices in your mdadm configuration. When you build an array, mdadm uniquely labels the drives and it can re-assemble the array automatically. It doesn't care about device names the kernel assigns to the drives.

For example, on my system I have two RAID1 arrays, and /etc/mdadm.conf looks like this:

MAILADDR root
AUTO +imsm +1.x -all
ARRAY /dev/md/fedora level=raid1 num-devices=2 UUID=88b07d7f:52a9034a:6a5aabb3:5887aa31
ARRAY /dev/md/fedora00 level=raid1 num-devices=2 UUID=115a16d6:8c769b7e:221465fc:980cc0e1

You'll note that it doesn't list specific devices at all.

This article covers the process well.

1
  • I created the ARRAY again this time by passing the disks as /dev/disk/by-uuid instead of /dev/sda, and so far there haven't been any issues. As you showed in your mdadm.conf, I kept it like this: ARRAY /dev/md0 metadata=1.2 name=nextcloudLocal:0 UUID=f1481868:fd42a9f5:7e1c0e50 If any problems arise, I'll post the logs here. Thank you very much! Commented Jun 27, 2024 at 0:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.