You are not logged in.

#1 2015-12-20 12:00:53

stewbond
Member
Registered: 2015-05-12
Posts: 32

[Solved] Recovering RAID1 disk

EDIT: while waiting for an answer, I continued to refine my question and continue investigating.  I figured out the problem.  I've described my solution below in case anyone else finds this page and it is useful to them.

A disk (RAID1) in my NAS failed, so I've pulled out the good disk and put it in my Arch box (no RAID on my Arch box).  I need some help mounting it.

It shows up in the fdisk:

stew ~ $ sudo fdisk -l /dev/sda
Disk /dev/sda: 2.7 TiB, 3000592982016 bytes, 5860533168 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: gpt
Disk identifier: DC938244-6D75-4504-8477-C7D563F6D9C4

Device       Start        End    Sectors  Size Type
/dev/sda1      256    4980735    4980480  2.4G Linux RAID
/dev/sda2  4980736    9175039    4194304    2G Linux RAID
/dev/sda3  9437184 5860528064 5851090881  2.7T Linux RAID

/dev/sda3 is the partition I want to mount, but:

stew ~ $ sudo mount /dev/sda3 /mnt/test
mount: unknown filesystem type 'linux_raid_member'

Some research tells me that I need to use mdadm.  mdadm is responsible for assembling multiple physical devices using the appropriate RAID protocol into a single virtual device that can be understood by the rest of the system.  I had thought I understood that RAID1 was just a normal file-system, duplicated accross disks, but it apparently isn't that simple, there is still the RAID layer which isn't recognized as ext4.

stew ~ $ sudo mdadm --examine /dev/sda3
/dev/sda3:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : 28fb78a3:a5947c85:5579c7d5:dd646ebc
           Name : Vulcan:2
  Creation Time : Thu Feb 14 21:57:08 2013
     Raid Level : raid1
   Raid Devices : 2

 Avail Dev Size : 5851088833 (2790.02 GiB 2995.76 GB)
     Array Size : 2925544256 (2790.02 GiB 2995.76 GB)
  Used Dev Size : 5851088512 (2790.02 GiB 2995.76 GB)
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
   Unused Space : before=1968 sectors, after=321 sectors
          State : clean
    Device UUID : 85c259a4:6fdab97e:001c12ef:2078e725

    Update Time : Tue Dec  1 13:54:19 2015
       Checksum : 9328e7fb - correct
         Events : 2168384

   Device Role : Active device 0
   Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
stew ~ $ sudo mdadm --assemble --scan
mdadm: No arrays found in config file or automatically
stew ~ $ sudo mdadm --query --detail /dev/sda3
mdadm: /dev/sda3 does not appear to be an md device
stew ~ $ sudo mdadm --assemble --run /dev/md0 /dev/sda3
mdadm: /dev/sda3 is busy - skipping

So why is the device busy? A little extra investigation tells me that it is in an array already (md127):

stew ~ $ cat /proc/mdstat
Personalities : 
md127 : inactive sda3[0](S)
      2925544416 blocks super 1.2
       
unused devices: <none>
stew ~ $ sudo mdadm --assemble --run /dev/md127 /dev/sda3
mdadm: /dev/sda3 is busy - skipping

So that didn't work... but wait... does md127 already exist?

stew ~ $ ls /dev/md*
/dev/md127

Okay, so now what?  Since we already have an array, let's rebuild and mount that:

stew ~ $ sudo mdadm --stop /dev/md127
mdadm: stopped /dev/md127
stew ~ $ sudo mdadm --assemble /dev/md127 /dev/sda3 --run
mdadm: /dev/md127 has been started with 1 drive (out of 2).
stew ~ $ cat /proc/mdstat
Personalities : [raid1] 
md127 : active raid1 sda3[0]
      2925544256 blocks super 1.2 [2/1] [U_]
      
unused devices: <none>
stew ~ $ sudo mount /dev/md127 /mnt/test

SUCCESS!  DATA RECOVERED!

Last edited by stewbond (2015-12-31 14:56:00)

Offline

#2 2015-12-20 12:54:04

stewbond
Member
Registered: 2015-05-12
Posts: 32

Re: [Solved] Recovering RAID1 disk

No need to reply,  I've figured it out and added appropriate details above.  To summarize:

stew ~ $ cat /proc/mdstat
Personalities : 
md127 : inactive sda3[0](S)
      2925544416 blocks super 1.2
       
unused devices: <none>
stew ~ $ sudo mdadm --stop /dev/md127
mdadm: stopped /dev/md127
stew ~ $ sudo mdadm --assemble /dev/md127 /dev/sda3 --run
mdadm: /dev/md127 has been started with 1 drive (out of 2).
stew ~ $ sudo mount /dev/md127 /mnt/test

Offline

Board footer

Powered by FluxBB