2

I have a RAID5 set up for my storage drives on my Nixos 23.11 machine. I followed this guide to set up the RAID (and I followed it very closely).

I have just reinstalled Linux on my boot drive (completely separate to the RAID). In doing so I deleted the partition table on the boot drive (not sure if relevant but including this just in case) and I have lost the fstab capturing where to mount the raid.

I can see the individual drives, but my machine doesn't appear to be detecting them as a RAID.

lsblk -f returns:

NAME        FSTYPE            FSVER LABEL   UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                             
└─sda1      linux_raid_member 1.2   B450M:0 4ef7e3d8-79e0-a3ac-fb9b-b2bd953f2c83                
sdb                                                                                             
└─sdb1      linux_raid_member 1.2   B450M:0 4ef7e3d8-79e0-a3ac-fb9b-b2bd953f2c83                
sdc                                                                                             
└─sdc1      linux_raid_member 1.2   B450M:0 4ef7e3d8-79e0-a3ac-fb9b-b2bd953f2c83                
nvme0n1                                                                                         
├─nvme0n1p1 vfat              FAT32         860A-D453                             480.6M     6% /boot
├─nvme0n1p2 ext4              1.0           efec7ddd-c7d4-429a-8e5a-c94945640a98  402.1G     4% /nix/store
│                                                                                               /
└─nvme0n1p3 swap              1     swap    ad4eeb5c-8e55-4407-86bf-71cb677054f9                [SWAP]

sda1, 2 and 3 are the members of the RAID.

cat /proc/mdstat says there is no such file.

mdadm --examine /dev/sda1 gives me

/dev/sda1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : 4ef7e3d8:79e0a3ac:fb9bb2bd:953f2c83
           Name : B450M:0  (local to host B450M)
  Creation Time : Sat Oct  9 18:43:49 2021
     Raid Level : raid5
   Raid Devices : 3

Avail Dev Size : 11720738816 sectors (5.46 TiB 6.00 TB) Array Size : 11720738816 KiB (10.92 TiB 12.00 TB) Data Offset : 264192 sectors Super Offset : 8 sectors Unused Space : before=264112 sectors, after=0 sectors State : clean Device UUID : 31e30b98:04318ab6:782fc433:6e8c3997

Internal Bitmap : 8 sectors from superblock Update Time : Fri Apr 5 11:31:28 2024 Bad Block Log : 512 entries available at offset 32 sectors Checksum : f644ea83 - correct Events : 10699

     Layout : left-symmetric
 Chunk Size : 512K

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

I've tried following a dozen guides, but none quite seem to be capturing my situation. I feel like I need to use mdadm --assemble the disks, but I'm not sure how to do this.

Any help appreciated.

1 Answers1

2

Managed to fix it. mdadm --assemble --scan recovered the partition and allowed me to mount it again, all the data was there. Then I just had to add this to fstab (or the nixos equivalent).

I was so close to an answer, but I'll leave this here for posterity.