Recovering Unknown RAID Setup in Linux – Step-by-Step Guide

linuxraidsoftware-raid

I have 2 disks, they are the same make, model + size.
Both of them have Linux RAID partitions on them.
I think they used to be in a software raid1 array together, but I am hesitant to just jump in and try to recreate the array in case I inadvertently cause data loss.
Most of the data that was on these disks is backed up already, but not all. If at all possible I'd prefer not to lose anything that isn't already lost.

YAST has detected that there used to be an array, but it only added 1 of the 2 disks to the "array", and when I tried to mount the array it seemed to think there are no partitions present.

I tried to used mdadm to scan, but it gives:

sudo mdadm --assemble --scan
mdadm: Found some drive for an array that is already active: /dev/md/RedRaid1
mdadm: giving up.
mdadm: No arrays found in config file or automatically

and fdisk of the "array" gives the following:

> sudo fdisk /dev/md127 
[sudo] password for root: 

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The old ext4 signature will be removed by a write command.

Device does not contain a recognized partition table.
The size of this disk is 3.7 TiB (4000784908288 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Created a new DOS disklabel with disk identifier 0xa8841205.

Command (m for help): p
Disk /dev/md127: 3.7 TiB, 4000784908288 bytes, 7814033024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xa8841205

Command (m for help): q

lee@linux-e9uw:~> 

I've included below some screenshots from various partitioning screens in yast.

How can I discover and be confident about what is on the 2 disks and reassemble them into whatever form they used to be in?

All disks in yast
sdb1
sdc1
RedRaid1
used devices
Partitions

Best Answer

Use mdadm --examine on the partitions /dev/sdb1 and /dev/sdc1 to display information about the RAID superblock. This will tell you the Array UUID and what slot the drive was in in the array. For example:

#  mdadm  --examine /dev/sdb1
/dev/sdb1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : 822697f0:058006d2:f0233a55:c6504b36
           Name : localhost.localdomain:0  (local to host localhost.localdomain)
  Creation Time : Wed Jul  3 16:22:07 2019
     Raid Level : raid1
   Raid Devices : 2

 Avail Dev Size : 2095104 (1023.00 MiB 1072.69 MB)
     Array Size : 1047552 (1023.00 MiB 1072.69 MB)
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
   Unused Space : before=1968 sectors, after=0 sectors
          State : clean
    Device UUID : ce3cd8fd:a1f3626c:9f8152cf:9a8cc0bc

    Update Time : Wed Jul  3 16:22:43 2019
  Bad Block Log : 512 entries available at offset 16 sectors
       Checksum : ba1d5d65 - correct
         Events : 17


   Device Role : Active device 0
   Array State : AA ('A' == active, '.' == missing, 'R' == replacing)

In recovery situations like yours, it's very likely that the array wasn't properly stopped, or that someone assembled the thing with only one drive. If the kernel moved the array's sequence number forward, then you're not going to be able to assemble it cleanly with both drives.

As @Shiki and @HBruijn have said, it's likely a mirrored RAID 1. Otherwise, you wouldn't have been able to assemble it and mount that filesystem. If all you need is the data, then just copy it off. If you need to re-form the array, then verify that the other partition was actually part of the same array. If it was, you can add it as a spare with mdadm -a.

Related Topic