Skip to contentSkip to conversation

Read data from disk that was part of RAID1 array

DISCUSSION Peter Sangas 4 participants 6 messages Mar 16, 2017 – Mar 20, 2017 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi,

My setup:

Linux green 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 16.04.2 LTS

mdadm -V
mdadm - v3.3 - 3rd September 2013

I have only one disk from a RAID1 array and I would like to read data from one of the partitions. This there a way to mount this and read the data?

Thanks,
Pete

#1 lore raw

Am 16.03.2017 um 23:18 schrieb Peter Sangas:

Quoted 6 lines

My setup:

Linux green 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 16.04.2 LTS

Quoted 6 lines

mdadm -V
mdadm - v3.3 - 3rd September 2013

I have only one disk from a RAID1 array and I would like to read data from one of the partitions. This there a way to mount this and read the data?

you only need one disk to start a RAID1
RAID1 are ust mirrors

just assemble the RAID1 or most likely you can mount the partitions as they are

#2 lore raw
In reply to Peter Sangas
Quoted 4 lines

From: Peter Sangas [mailto:[email protected]]
I have only one disk from a RAID1 array and I would like to read data from

one of the

Quoted 1 line

partitions. This there a way to mount this and read the data?

This worked for me:

mdadm --create /dev/md10 -l 1 -n 2 /dev/sda missing md10 is chosen to
avoid conflicts with existing RAID1

mount /dev/md10 /mnt

#3 lore raw
Quoted 5 lines · Peter Sangas
Quoted 4 lines

From: Peter Sangas [mailto:[email protected]]
I have only one disk from a RAID1 array and I would like to read data from

one of the

Quoted 9 lines
Quoted 1 line

partitions. This there a way to mount this and read the data?

This worked for me:

mdadm --create /dev/md10 -l 1 -n 2 /dev/sda missing md10 is chosen to
avoid conflicts with existing RAID1

mount /dev/md10 /mnt

NEVER NEVER NEVER use --create !!!

YOU WERE LUCKY !!!

Use something like --assemble --force, which will set up a working array if it can. If that had been an old array, with a different offset or superblock or the like, you would have trashed the superblock and created a new array, which thought that the data in the array was somewhere other than where it really was.

At which point, it would have been "go to your backups" or a major forensic recovery.

Cheers,
Wol

#4 lore raw
Quoted 5 lines

From: Wols Lists [mailto:[email protected]] NEVER NEVER NEVER use --create !!!

Use something like --assemble --force, which will set up a working array

if it can.

OK, I tried this command but received an error:

mdadm --assemble --force /dev/md10 /dev/sdc

"Cannot assemble mbr metadata in /dev/sdc, no superblock"

What command do you suggest...?

Quoted 1 line

If that had been an old array, with a different offset or superblock or

the like...

by "old" do you mean an array created using a different superblock format other than 1.2?

Thanks,
Pete

#5 lore raw
Quoted 7 lines · Peter Sangas
Quoted 5 lines

From: Wols Lists [mailto:[email protected]] NEVER NEVER NEVER use --create !!!

Use something like --assemble --force, which will set up a working array

if it can.

Quoted 8 lines

OK, I tried this command but received an error:

mdadm --assemble --force /dev/md10 /dev/sdc

"Cannot assemble mbr metadata in /dev/sdc, no superblock"

What command do you suggest...?

That makes it sound like something had trashed the superblock, or maybe it was sdc1, or something. Anyways, it worked for you, so hopefully the question is academic.

Quoted 8 lines
Quoted 3 lines

If that had been an old array, with a different offset or superblock or

the like...

by "old" do you mean an array created using a different superblock format other than 1.2?

Yes. The superblock format is v1. Whether it's v1.0, v1.1 or v1.2 depends on where the superblock is found. So if, for example, the array had been created with a v1.0 superblock, the data would probably have started at offset 2048, with the superblock at the end of the disk. v1.2 puts the superblock near the start, maybe offset 4096? So you would have smashed some of your data, and also told the array to look in the wrong place for the start of the data.

That's why --create is so dangerous - pick the wrong version and you can damage the data, but even if you pick the right version, all the default offsets and things have changed over the years (that's assuming they haven't also been modified by general array management), so you can easily lose where the data area starts.

Cheers,
Wol