User Tools

Site Tools


raid:mdadm:add_a_disk_to_an_existing_array

RAID - mdadm - Add a disk to an existing array

Add a new disk to an array, possibly replacing a failed one:

mdadm --add /dev/md0 /dev/sdb1

Add a disk using its UUID

Check the UUIDs of the partitions

ls -l /dev/disk/by-partuuid/

returns:

lrwxrwxrwx 1 root root 10 Sep  4 14:49 526e2405-0124-4baa-805f-335369588ddd -> ../../sda1
lrwxrwxrwx 1 root root 10 Sep  4 14:49 5d426ea0-5795-4165-863d-1ed947dc77fd -> ../../sda2
lrwxrwxrwx 1 root root 10 Sep  4 14:49 8e53314c-0814-46cd-9f13-c2bb2b7a14b6 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Sep  4 14:49 90412d26-ebec-4996-96d6-a7a6c702e57e -> ../../sdc1

Add /dev/sdc1 using its UUID

mdadm /dev/md0 --add /dev/disk/by-partuuid/90412d26-ebec-4996-96d6-a7a6c702e57e

returns:

mdadm: added /dev/disk/by-partuuid/90412d26-ebec-4996-96d6-a7a6c702e57e

Check the details of the RAID array

mdadm --detail /dev/md0

returns:

 

NOTE: It reports /dev/sdc1 instead of the UUID.

This is not a problem.

mdadm allows disks to be moved around freely in the machine, regardless of how you add the disk to the array.

  • It tracks the disks by the RAID metadata (superblocks) stored on the disk.
  • The default config, specified in /etc/mdadm/mdadm.conf, usually is normally DEVICE partitions, which means to look at all partitions (on all disks) checking for RAID superblocks.
    • It checks for a match of the array name or UUID (depending on what is in that config file.
raid/mdadm/add_a_disk_to_an_existing_array.txt · Last modified: 2021/09/26 13:17 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki