0

I have a Debian Jessie box that lost the RAID volume that had the OS, so I booted Live USB to try to recover the attached SAS controlled external drive bay which has my data RAID6 and it sees 3 of the 4 like:

>: cat /proc/mdstat
Personalities :
md0 : inactive sda1[0](S) sdc1[2](S) sdb1[1](S)
  11718349824 blocks super 1.2

unused devices: <none>

and again:

>: mdadm -D /dev/md0
/dev/md0:
    Version : 1.2
 Raid Level : raid0
Total Devices : 3
Persistence : Superblock is persistent

      State : inactive

       Name : backup1:0
       UUID : a7946015:259ae101:1fed525f:5766e9d5
     Events : 381

Number   Major   Minor   RaidDevice

   -       8        1        -        /dev/sda1
   -       8       17        -        /dev/sdb1
   -       8       33        -        /dev/sdc1

So it thinks it's a weird RAID0? Is there a way to tell it to use this as a RAID6 again, but not delete data and not mark drives as spares? I'm thinking something like:

mdadm --stop /dev/md0
mdadm --create /dev/md0 --level=6 --raid-devices=4 --chunk=64 --name=backup1:0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 --assume-clean

even though /dev/sdd1 isn't being shown. It almost seems like I need to re-assemble with some flags to avoid rewriting data, or manually remove/add each disk from md0 (but you need multiple disks for RAID6 so how do you do that?) fdisk for /dev/sdd shows:

Disk /dev/sdd: 3.7 TiB, 3999999721472 bytes, 7812499456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 27419FEB-5830-4C44-9DC9-00828D0F115A

Device     Start        End    Sectors  Size Type
/dev/sdd1   2048 7812497407 7812495360  3.7T Linux RAID

So there's a raid partition there like I expect, though when I examine it, it shows:

mdadm --examine /dev/sdd1
mdadm: No md superblock detected on /dev/sdd1.

unlike other drives:

mdadm --examine /dev/sdc1
/dev/sdc1:
      Magic : a92b4efc
    Version : 1.2
Feature Map : 0x1
 Array UUID : a7946015:259ae101:1fed525f:5766e9d5
       Name : backup1:0
Creation Time : Tue Jul 19 17:34:55 2016
 Raid Level : raid6
Raid Devices : 4

Avail Dev Size : 7812233216 (3725.16 GiB 3999.86 GB)
 Array Size : 7812233216 (7450.33 GiB 7999.73 GB)
Data Offset : 262144 sectors
Super Offset : 8 sectors
Unused Space : before=262056 sectors, after=0 sectors
      State : active
Device UUID : 4d1d775e:eef629d4:03f15e09:f1762443

Internal Bitmap : 8 sectors from superblock
Update Time : Tue Jul 19 18:17:36 2016
Bad Block Log : 512 entries available at offset 72 sectors
   Checksum : 8365777c - correct
     Events : 381

     Layout : left-symmetric
 Chunk Size : 512K

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

I guess during the rebuild it could repair /dev/sdd1? Am I approaching this right? I don't want to overwrite data basically.

0

Okay, I stopped the /dev/md0 and then created it as raid6 like:

mdadm --stop /dev/md0
mdadm: stopped /dev/md0
root@debian:/home/user >: cat /proc/mdstat
Personalities :
unused devices: <none>

root@debian:/home/user >: mdadm --create /dev/md0 --level=6 --raid-devices=4 --chunk=64 --name=backup1:0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 --assume-clean
mdadm: /dev/sda1 appears to be part of a raid array:
   level=raid6 devices=4 ctime=Tue Jul 19 17:34:55 2016
mdadm: /dev/sdb1 appears to be part of a raid array:
   level=raid6 devices=4 ctime=Tue Jul 19 17:34:55 2016
mdadm: /dev/sdc1 appears to be part of a raid array:
   level=raid6 devices=4 ctime=Tue Jul 19 17:34:55 2016
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

root@debian:/home/user >: cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid6 sdd1[3] sdc1[2] sdb1[1] sda1[0]
  7812233216 blocks super 1.2 level 6, 64k chunk, algorithm 2 [4/4] [UUUU]
  bitmap: 30/30 pages [120KB], 65536KB chunk

unused devices: <none>

Here's more detail on the re-assembled RAID:

mdadm -D /dev/md0
/dev/md0:
    Version : 1.2
Creation Time : Thu Mar  1 22:04:57 2018
 Raid Level : raid6
 Array Size : 7812233216 (7450.33 GiB 7999.73 GB)
Used Dev Size : 3906116608 (3725.16 GiB 3999.86 GB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Intent Bitmap : Internal

Update Time : Thu Mar  1 22:04:57 2018
      State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0

     Layout : left-symmetric
 Chunk Size : 64K

       Name : backup1:0
       UUID : c3ef766b:2fe9581a:5a906461:d52ee71e
     Events : 0

Number   Major   Minor   RaidDevice State
   0       8        1        0      active sync   /dev/sda1
   1       8       17        1      active sync   /dev/sdb1
   2       8       33        2      active sync   /dev/sdc1
   3       8       49        3      active sync   /dev/sdd1

So I guess it worked! Now when I go to mount it, it says

root@debian:/home/user >: mount /dev/md0 raid6
mount: unknown filesystem type 'LVM2_member'

So now I have to figure out how to rebuild LVM stuff, but that's a separate issue. I hope this helps someone else working through something like this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.