LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Recovering Data from Remaining RAID 1 Disk (https://www.linuxquestions.org/questions/linux-software-2/recovering-data-from-remaining-raid-1-disk-723225/)

nko 05-02-2009 08:48 PM

Recovering Data from Remaining RAID 1 Disk
 
Hello,

A while back, I had a PC with two hard drives configured in a RAID 1 array with mdadm. I stored a lot of data there, though nothing too important. The OS installation went south at one point and I installed something over it. I left the RAID array untouched but notably didn't backup my mdadm.conf.

A year or so later, I now have a new PC with a new OS installation and only one of the disks remaining :-) I would like to mount the remaining disk, pull the data off and start using the disk for other purposes. Everything I'm reading tells me that I'm fine as long as I either have or recreate mdadm.conf AND as long as I go buy another disk to replace the missing one.

I've also read allusions to the ability to tell mdadm to mount an array with "missing disks" but haven't seen any instructions on how to do so. I've tried just popping the disk in and mounting it like a regular disk but mount refuses to do so, citing that it is of type "Linux RAID" or something thereof.

Is there a way to mount this disk and get the data?

Quakeboy02 05-02-2009 09:28 PM

I think that you should be able to just mount it as a normal, non-raid, disk. Have you tried that? Use read only, of course.

nko 05-02-2009 09:32 PM

Yeah, doesn't let me. It isn't EXT3, it's "Linux RAID". That was my first guess :-)

tommylovell 05-02-2009 09:37 PM

Do a 'cat /proc/mdstat'. Your system may have recognized the drive when you booted up.
'fdisk -l' might show it as well.

If it is there, you can mount the "md" device shown in the cat (assuming you originally put your filesystem directly on it).
Example: 'mount /dev/md0 /<desiredmountpoint>'

If you put an LVM PV on top of it, it is only slightly more work (unless you have a VG name conflist).
You would 'pvscan', 'vgscan', 'vgchange -ay', 'lvs', then mount the LV.

If this isn't the case, let me know.

nko 05-02-2009 09:56 PM

Thanks for the pointers! It is definitely not LVM- just an FS. I wasn't able to mount. Here's my console output:

Code:

root@localhost:/# cat /proc/mdstat
Personalities :
md0 : inactive sdc1[1](S)
      78148096 blocks
     
unused devices: <none>
root@localhost:/# fdisk -l

Disk /dev/sda: 4034 MB, 4034838528 bytes
255 heads, 63 sectors/track, 490 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb698b698

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        462    3710983+  83  Linux
/dev/sda2            463        490      224910    5  Extended
/dev/sda5            463        490      224878+  82  Linux swap / Solaris

Disk /dev/sdc: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x415a13b8

  Device Boot      Start        End      Blocks  Id  System
/dev/sdc1              1        9729    78148161  83  Linux
root@localhost:/# mount /dev/md0 /mnt/md0
mount: you must specify the filesystem type
root@localhost:/# mount /dev/md0 /mnt/md0 -t autofs
mount: wrong fs type, bad option, bad superblock on /dev/md0,
      missing codepage or helper program, or other error
      (could this be the IDE device where you in fact use
      ide-scsi so that sr0 or sda or so is needed?)
      In some cases useful info is found in syslog - try
      dmesg | tail  or so

root@localhost:/# mount /dev/md0 /mnt/md0 -t ext3
mount: wrong fs type, bad option, bad superblock on /dev/md0,
      missing codepage or helper program, or other error
      (could this be the IDE device where you in fact use
      ide-scsi so that sr0 or sda or so is needed?)
      In some cases useful info is found in syslog - try
      dmesg | tail  or so

root@localhost:/#


Quakeboy02 05-02-2009 10:51 PM

You should be trying to mount /dev/sdc1, not /dev/md0.

nko 05-02-2009 10:57 PM

Code:

root@localhost:/# mount /dev/sdc1 /mnt/md0
mount: unknown filesystem type 'linux_raid_member'
root@localhost:/# mount /dev/sdc1 /mnt/md0 -t ext3
mount: /dev/sdc1 already mounted or /mnt/md0 busy
root@localhost:/#


tommylovell 05-02-2009 10:58 PM

Quote:

Originally Posted by nko (Post 3528142)
Thanks for the pointers! It is definitely not LVM- just an FS. I wasn't able to mount. Here's my console output:

Code:

root@localhost:/# cat /proc/mdstat
Personalities :
md0 : inactive sdc1[1](S)
      78148096 blocks
     
unused devices: <none>


Try 'mdadm --assemble --scan' and see if that makes md0 active. If it becomes active, then your 'mount /dev/md0 /mnt/md0
' should work.

(--scan says to use /proc/mdstat and /etc/mdadm.conf to look for eligible devices to assemble into a RAID array, and since your /proc/mdstat has your device, you should be good.)

If the md0 device doesn't become active, try 'mdadm --assemble --scan --run'.

Finally, if that doesn't work, you'll need to create an /etc/mdadm.conf file.

Typically you 'mdadm --examine --scan > /etc/mdadm.conf'

The resulting file contains something like this:

ARRAY /dev/md0 level=raid1 num-devices=2 UUID=397c7395:9c3c48fa:68e69357:c9f2169f

(The UUID will of course be different.)

You can edit it so it looks like this:
Code:

DEVICE partitions
MAILADDR root

ARRAY /dev/md0 level=raid1 num-devices=2 UUID=397c7395:9c3c48fa:68e69357:c9f2169f

or this:
Code:

DEVICE partitions
MAILADDR root

ARRAY /dev/md0 level=raid1 num-devices=2 devices=/dev/sdc1,missing

And then try 'mdadm --assemble --run'.

Let us know the results.

nko 05-02-2009 11:36 PM

Wow. Just had to assemble / scan and mount. That was faster, more concise tech support than any I've received from a lot of expensive vendors. Thanks, Tommy!

ljw1004 01-12-2012 02:27 PM

I used a different technique...

SCENARIO: My old RAID1 computer had failed, and I had only one of the two disks remaining. I wanted to recover its contents. I put it into an external hard drive enclosure and plugged it into the USB drive. I did
Code:

fdisk -l
and discovered that the USB drive was under /dev/sdc3 (based on what I recognized as its size).

First I tried
Code:

mkdir /mnt/old
mount /dev/sdc3 /mnt/old

but it said mount: unknown filesystem type 'linux_raid_member'. Fair enough. That's because /dev/sdc3 was a RAID partition.

But I knew that on my old computer I'd assembled the raid array out of two RAID partitions on two disks and then formatted the raid array as EXT3. So I tried
Code:

mount -o ro -t ext3 /dev/sdc3 /mnt/old
but it said mount: /dev/hdb1 already mounted or /mnt/fat32/ busy. Fair enough. That's because the MDADM subsystem is in charge of mounting the raid partitions and exposing them as /dev/md partitions.

Finding this thread, I tried
Code:

cat /proc/mdstat
It said md125 : inactive sdc3[1](S) 2104500 blocks super 1.0. So this thread was correct: MDADM had indeed grabbed hold of sdc3; but because sdc3's mirror pair wasn't present, it meant that MDADM hadn't been able to offer it up to me as some /dev/md.


I tried "mdadm --assemble --scan --run" as per this thread, but didn't make headway. In the end I found an easier solution:
Code:

mdadm --stop /dev/md125
mount /dev/sdc3 /mnt/old

It said mdadm: stopped /dev/md125 and then it let me mount it okay.


Conclusion: by stopping MDADM from grabbing ownership of the raid partition, I was able to mount it as its underlying ext3 just fine.


(Incidentally, I was also able to plug the drive into my Windows machine and use "Disk Internals Linux Reader" to read it. I image that the Linux Reader might just be ignoring the RAID aspect, and treating it directly as EXT3).

tommylovell 01-12-2012 03:16 PM

Interesting.

The --stop tells mdadm to remove its metadata (which is at the end of the partition). So then, because it is RAID1, it just becomes your normal, run of the mill, partition that can be mounted. (This would not work with any other RAID type, but in the case of RAID1, all the data is there.)

Cool technique. Good one to remember.

LinuxSpiff 01-23-2012 03:35 PM

Cool technique not successful
 
Post moved : http://www.linuxquestions.org/questi...-drive-925485/

tommylovell 01-23-2012 07:03 PM

LinuxSpiff, you need to open a new post. Tacking your question onto the end of an old post is frowned upon and it will get limited visibility (it's not on the zero reply queue, which is what many people watch...).

If you open a new thread, you can refer to this thread for background. The first question I would ask you is to confirm that your RAID array is RAID1. So put that detail in your new post. You can then edit this post to remove the content and refer it to your new post.

altsai 07-26-2012 04:24 AM

Many Thanks! Tommy,
It did help me a lot:

"Try 'mdadm --assemble --scan' and see if that makes md0 active. If it becomes active, then your 'mount /dev/md0 /mnt/md0
' should work.
"

tkalfaoglu 10-17-2013 10:24 PM

I have a similar case where RAID1 disks have gone askew.
Unbeknowns to me, /dev/sdb now has NEWER stuff than /dev/sda , because for some months, sda was offline.
Now, sda became online, and sdb is off the raid. How can I recover the contents of sdb?
thanks! -t

didiw 01-18-2014 07:44 AM

Hi,

Quote:

Originally Posted by tkalfaoglu (Post 5047836)
I have a similar case where RAID1 disks have gone askew.
Unbeknowns to me, /dev/sdb now has NEWER stuff than /dev/sda , because for some months, sda was offline.
Now, sda became online, and sdb is off the raid. How can I recover the contents of sdb?
thanks! -t

I don't know, if your problem is already solved. Just in case you still need help, here is my advice:
Stop the raid, then start the raid with just /dev/sdb and add /dev/sda.
Code:

mdadm --stop <raiddev>
mdadm --assemble ---run -v /dev/mdx /dev/sdb
mdadm --add -v /dev/mdx /dev/sda

This should solve your problem, that you get your newest data back.

Regards
didiw

TekMach 08-12-2014 07:58 PM

thanks!
 
tommylovell, your advice "Try 'mdadm --assemble --scan'" worked for me to mount the one good disk remaining of a degraded linux raid 1 pair. I know this thread is old but I just had to say thanks! System saw it immediately afterwards as an ext4 partition.

archibaldrazmott 11-13-2014 11:29 PM

Quote:

Originally Posted by ljw1004 (Post 4573036)
I used a different technique...
(...)
Conclusion: by stopping MDADM from grabbing ownership of the raid partition, I was able to mount it as its underlying ext3 just fine.

Thanks a lot, ljw1004. Stopping mdadm from using the FS was indeed the solution.
I had to specify the FS type to mount it though,
Code:

mount -t ext4 /dev/sdc3 /mnt/oldstuff -o ro

skris88 01-10-2016 09:43 PM

Trying to recover a RAID1 (mirror) NAS drive
 
I'm new on this forum and to Linux so please accept my apologies if I am posting in the wrong thread.

My NAS electronics died (after 7 years).

I was informed (by a unverified web site) that my Thecus NAS uses the XFS file system and that, being RAID1, I should be able to access the data simply off one of the two mirrored drives on my Linux Mint system.

I installed XFS support and tried to mount the drive directly but was unsuccessful. Below is what I just tried...

All assistance will be greatly appreciated.

Thanks,
skris88


Code:

dell-mint ~ # fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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
Disk identifier: 0x000c82a0

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *        2048      976895      487424  83  Linux
/dev/sda2          976896    49805311    24414208  83  Linux
/dev/sda3        49807358  976771071  463481857    5  Extended
/dev/sda5        49807360    59570175    4881408  82  Linux swap / Solaris
/dev/sda6        59572224    79101951    9764864  83  Linux
/dev/sda7        79104000    98633727    9764864  83  Linux
/dev/sda8        98635776  976771071  439067648    b  W95 FAT32

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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
Disk identifier: 0x00000000

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              1  1953525167  976762583+  ee  GPT
Partition 1 does not start on a physical sector boundary.

Disk /dev/sdc: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders, total 1250263728 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
Disk identifier: 0x00003411

  Device Boot      Start        End      Blocks  Id  System
/dev/sdc1            2048  1250263039  625130496    7  HPFS/NTFS/exFAT

Disk /dev/md10: 2047 MB, 2047868928 bytes
2 heads, 4 sectors/track, 499968 cylinders, total 3999744 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
Alignment offset: 3072 bytes
Disk identifier: 0x00000000

Disk /dev/md10 doesn't contain a valid partition table

Disk /dev/md0: 998.2 GB, 998155157504 bytes
2 heads, 4 sectors/track, 243690224 cylinders, total 1949521792 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
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/mapper/vg0-lv0: 948.1 GB, 948114030592 bytes
255 heads, 63 sectors/track, 115268 cylinders, total 1851785216 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
Disk identifier: 0x00000000

Disk /dev/mapper/vg0-lv0 doesn't contain a valid partition table

dell-mint ~ # mdadm --assemble --scan
mdadm: /dev/md10 has been started with 1 drive (out of 2).
mdadm: /dev/md0 has been started with 1 drive (out of 2)

dell-mint ~ # mount /dev/md10 /media/nas-hdd
/dev/md10 looks like swapspace - not mounted
mount: you must specify the filesystem type

dell-mint ~ # mount /dev/md0 /media/nas-hdd
mount: unknown filesystem type 'LVM2_member'



All times are GMT -5. The time now is 06:59 AM.