0

In md we can scan or assemble an array using UUID:

mdadm --assemble "/dev/md/raid5" --uuid "b9a09187:a1ac838f:b4e90395:d6293c19"

And in ZFS, we have a service for that purpose:

rc-service zfs-import start # OpenRC on Alpine Linux

Is it safe to use device name such as /dev/sda and /dev/sdb to create md and ZFS RAID array? If the names are changed after a reboot, will the command mdadm --assemble and the service zfs-import be able to read the filesystem header on each disk and detect them?

1 Answer 1

0

I can't speak to ZFS, but for mdadm when you create an array you use the device names. This will write a UUID to each component of the array. And it's this UUID that will be used to reconstruct the array on reboot.

eg on my Rocky8 machine I have the following entries in /etc/mdadm.conf

ARRAY /dev/md1 level=raid1 num-devices=2 UUID=319367a0:0bf67279:3b7ded8a:cad6a06c ARRAY /dev/md2 level=raid1 num-devices=2 UUID=49e9de19:e56e702e:dda216de:e6a7ee85 ARRAY /dev/md3 level=raid1 num-devices=2 UUID=f3d8b1d9:2b70cea8:b8a23691:560ed399 ARRAY /dev/md68 level=raid6 num-devices=8 UUID=1784ac2f:cec3f0ec:e0096e7e:43dfd8ba 

The md1 array was created with

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1 

On reboot the md subsystem will scan all devices looking for raid components with the relevant UUID and rebuild the array. It won't matter if the device entry names have changed; it's the UUID that matters.

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.