GNU/Linux: Restore "disappeared" software RAID

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
peter_b
Chatterbox
Posts: 371
Joined: Tue Nov 12, 2013 2:05 am

GNU/Linux: Restore "disappeared" software RAID

Post by peter_b »

It's similar to "Move Linux software RAID1 between machines", I've written in the past.
Yet, it's slightly different... ;)

This HowTo is used in case you had a mirrored Linux Kernel Software RAID-1.
I've had 2 disks mirrored, attached as external USB devices. Both disks are 3TB, therefore GPT partitioned.
No auto-RAID partition, but directly on the disks. This means, for example: "/dev/sda" - instead of "/dev/sda1"

The disks were in an unknown state.

After connecting the drives to the computer, the physical devices showed up. In my case "/dev/sdc" and "/dev/sdd".

Check if the disks still "know" that they belong together somewhat:

Code: Select all

$ sudo blkid
This returns something like this:
/dev/sdc: UUID="3d3e767b-abda-c80f-97b4-4267567fe5a7" LABEL="ferry-1:video_inbox" TYPE="linux_raid_member"
/dev/sdd: UUID="3d3e767b-abda-c80f-97b4-4267567fe5a7" LABEL="ferry-1:video_inbox" TYPE="linux_raid_member"
You can see, that both have the same UUID and are marked "linux_raid_member".

Seems good.
Yet, there is no /dev/mdX device assigned by the OS automatically.

Auto-assemble (--scan) won't work, so we have to tell the Kernel manually to create the md-device and which disks to assign:

Code: Select all

$ sudo mdadm --assemble /dev/md1 /dev/sdd /dev/sdc
NOTE: Replace /dev/md1 and the disk device name according to your setup.

In my case, that brought up the array. Status: "RESYNC PENDING" (of course).
That's it.
User avatar
peter_b
Chatterbox
Posts: 371
Joined: Tue Nov 12, 2013 2:05 am

Make it persistent: Update /etc/mdadm/mdadm.conf

Post by peter_b »

In order to let you system "know" which arrays to assemble during boot, run the following command:

Code: Select all

$ sudo mdadm --examine --scan
This will output one line per array that looks something like this:
ARRAY /dev/md/video_inbox metadata=1.2 UUID=3d3e767b:abdac80f:97b44267:567fe5a7 name=ferry-1:video_inbox
Copy/paste this line to your /etc/mdadm/mdadm.conf (on Debian/Ubuntu).

Now, your system should be able to automatically assemble, run and mount the software RAID partition.
Post Reply