* Recover data from accidentally created raid5 over raid1
@ 2023-04-11 18:11 Moritz Rosin
2023-04-11 19:47 ` John Stoffel
0 siblings, 1 reply; 14+ messages in thread
From: Moritz Rosin @ 2023-04-11 18:11 UTC (permalink / raw)
To: linux-raid
Hey there,
unfortunately I have to admit, that I learned my lesson the hard way
dealing with software raids.
I had a raid1 running reliable over month using two 4TB HDDs.
Since I ran short on free space I tried to convert the raid1 to a raid5
in-place (with the plan to add the 3rd HDD after converting).
That's where my incredibly stupid mistake kicked in.
I followed an internet tutorial that told me to do:
mdadm --create /dev/md0 --level=5 --raid-devices=2 /dev/sdX1 /dev/sdY1
I learned that I re-created a raid5 array instead of converting the
raid1 :-(
Is there any chance to un-do the conversion or restore the data?
Has the process of creation really overwritten data or is there anythins
left on the disk itself that can be rescued?
Any help would be appreciated. Thanks!!!
Moritz
^ permalink raw reply [flat|nested] 14+ messages in thread
* Recover data from accidentally created raid5 over raid1
@ 2023-04-11 18:12 Moritz Rosin
0 siblings, 0 replies; 14+ messages in thread
From: Moritz Rosin @ 2023-04-11 18:12 UTC (permalink / raw)
To: linux-raid
Hey there,
unfortunately I have to admit, that I learned my lesson the hard way
dealing with software raids.
I had a raid1 running reliable over month using two 4TB HDDs.
Since I ran short on free space I tried to convert the raid1 to a raid5
in-place (with the plan to add the 3rd HDD after converting).
That's where my incredibly stupid mistake kicked in.
I followed an internet tutorial that told me to do:
mdadm --create /dev/md0 --level=5 --raid-devices=2 /dev/sdX1 /dev/sdY1
I learned that I re-created a raid5 array instead of converting the
raid1 :-(
Is there any chance to un-do the conversion or restore the data?
Has the process of creation really overwritten data or is there anythins
left on the disk itself that can be rescued?
Any help would be appreciated. Thanks!!!
Moritz
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-11 18:11 Recover data from accidentally created raid5 over raid1 Moritz Rosin
@ 2023-04-11 19:47 ` John Stoffel
2023-04-12 0:18 ` Wol
0 siblings, 1 reply; 14+ messages in thread
From: John Stoffel @ 2023-04-11 19:47 UTC (permalink / raw)
To: Moritz Rosin; +Cc: linux-raid
>>>>> "Moritz" == Moritz Rosin <moritz.rosin@itrosinen.de> writes:
> Hey there,
> unfortunately I have to admit, that I learned my lesson the hard way
> dealing with software raids.
> I had a raid1 running reliable over month using two 4TB HDDs.
> Since I ran short on free space I tried to convert the raid1 to a raid5
> in-place (with the plan to add the 3rd HDD after converting).
> That's where my incredibly stupid mistake kicked in.
> I followed an internet tutorial that told me to do:
> mdadm --create /dev/md0 --level=5 --raid-devices=2 /dev/sdX1 /dev/sdY1
Please share the link to the tutorial so we can maybe shame that
person into fixing it. Or removing it.
> I learned that I re-created a raid5 array instead of converting the
> raid1 :-(
Yeah, I think you're out of luck here. What kind of filesystem did
you have on your setup? Were you using MD -> LVM -> filesystem stack?
Or just a raw filesystem on top of the /dev/md? device?
> Is there any chance to un-do the conversion or restore the data?
> Has the process of creation really overwritten data or is there
> anythins left on the disk itself that can be rescued?
If you have any information on your setup before you did this, then
you might be ok, but honestly, I think you're toast.
John
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-11 19:47 ` John Stoffel
@ 2023-04-12 0:18 ` Wol
2023-04-12 0:26 ` Phil Turmel
2023-04-12 10:22 ` Reindl Harald
0 siblings, 2 replies; 14+ messages in thread
From: Wol @ 2023-04-12 0:18 UTC (permalink / raw)
To: John Stoffel, Moritz Rosin; +Cc: linux-raid, Phil Turmel, NeilBrown
On 11/04/2023 20:47, John Stoffel wrote:
>>>>>> "Moritz" == Moritz Rosin <moritz.rosin@itrosinen.de> writes:
>
>> Hey there,
>> unfortunately I have to admit, that I learned my lesson the hard way
>> dealing with software raids.
>
>> I had a raid1 running reliable over month using two 4TB HDDs.
>> Since I ran short on free space I tried to convert the raid1 to a raid5
>> in-place (with the plan to add the 3rd HDD after converting).
>> That's where my incredibly stupid mistake kicked in.
>
>> I followed an internet tutorial that told me to do:
>> mdadm --create /dev/md0 --level=5 --raid-devices=2 /dev/sdX1 /dev/sdY1
>
> Please share the link to the tutorial so we can maybe shame that
> person into fixing it. Or removing it.
See below. There's no reason why it shouldn't work, PROVIDED nothing has
happened to the mirror since you created it.
>
>> I learned that I re-created a raid5 array instead of converting the
>> raid1 :-(
>
> Yeah, I think you're out of luck here. What kind of filesystem did
> you have on your setup? Were you using MD -> LVM -> filesystem stack?
> Or just a raw filesystem on top of the /dev/md? device?
I dunno. A two-disk raid-5 is the same as a 2-disk mirror. That raid-5
MAY just start and run and you'll be okay. You can try mounting it
read-only and see what happens ...
>
>> Is there any chance to un-do the conversion or restore the data?
>> Has the process of creation really overwritten data or is there
>> anythins left on the disk itself that can be rescued?
>
If the conversion has overwritten the data, it will merely have
overwritten one copy of the data with the other.
> If you have any information on your setup before you did this, then
> you might be ok, but honestly, I think you're toast.
>
It might be a bit of a forensic job, but no I don't think so. Do you
have that third 4TB HDD? If so, MAKE A BACKUP of one of the drives. That
way, you'll have three copies to play with to try and recover the data.
As John says, please give us all the information you can. If you've just
put a file system on top of the array, you should now have three copies
of the filesystem to try and recover. I can't help any further here. but
all you have to do is track down the start of said filesystem, work out
where you tell linux to start a partition so it correctly contains the
filesystem, and then mount said partition. Your data should all be there.
Actually, you might be better off not copying onto drive 3. If you can
work out where your filesystem partition should start, create a
partition on drive 3 and copy the filesystem contents into said partition.
I've cc'd a couple of people I hope can help, but basically, you need to
find out where in the raid array your data has been put, and then work
out how to access it. Your data SHOULD be recoverable, but you've got
some detective work ahead of you.
Cheers,
Wol
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-12 0:18 ` Wol
@ 2023-04-12 0:26 ` Phil Turmel
2023-04-12 10:15 ` Moritz Rosin
2023-04-12 10:22 ` Reindl Harald
1 sibling, 1 reply; 14+ messages in thread
From: Phil Turmel @ 2023-04-12 0:26 UTC (permalink / raw)
To: Wol, John Stoffel, Moritz Rosin; +Cc: linux-raid, NeilBrown
Hi Moritz, et al,
On 4/11/23 20:18, Wol wrote:
> On 11/04/2023 20:47, John Stoffel wrote:
>>>>>>> "Moritz" == Moritz Rosin <moritz.rosin@itrosinen.de> writes:
>>
>>> Hey there,
>>> unfortunately I have to admit, that I learned my lesson the hard way
>>> dealing with software raids.
>>
>>> I had a raid1 running reliable over month using two 4TB HDDs.
>>> Since I ran short on free space I tried to convert the raid1 to a raid5
>>> in-place (with the plan to add the 3rd HDD after converting).
>>> That's where my incredibly stupid mistake kicked in.
>>
>>> I followed an internet tutorial that told me to do:
>>> mdadm --create /dev/md0 --level=5 --raid-devices=2 /dev/sdX1 /dev/sdY1
Ewww.
>> Please share the link to the tutorial so we can maybe shame that
>> person into fixing it. Or removing it.
>
> See below. There's no reason why it shouldn't work, PROVIDED nothing has
> happened to the mirror since you created it.
>>
>>> I learned that I re-created a raid5 array instead of converting the
>>> raid1 :-(
Indeed. It would have sync'd every other chunk in opposite directions
to place "parity" in the right rotation, but otherwise equivalent to a
mirror.
>> Yeah, I think you're out of luck here. What kind of filesystem did
>> you have on your setup? Were you using MD -> LVM -> filesystem stack?
>> Or just a raw filesystem on top of the /dev/md? device?
>
> I dunno. A two-disk raid-5 is the same as a 2-disk mirror. That raid-5
> MAY just start and run and you'll be okay. You can try mounting it
> read-only and see what happens ...
The odds of matching offsets depends entirely on how old the original
raid1 was.
>>> Is there any chance to un-do the conversion or restore the data?
>>> Has the process of creation really overwritten data or is there
>>> anythins left on the disk itself that can be rescued?
>>
> If the conversion has overwritten the data, it will merely have
> overwritten one copy of the data with the other.
Concur.
>> If you have any information on your setup before you did this, then
>> you might be ok, but honestly, I think you're toast.
>>
> It might be a bit of a forensic job, but no I don't think so. Do you
> have that third 4TB HDD? If so, MAKE A BACKUP of one of the drives. That
> way, you'll have three copies to play with to try and recover the data.
This.
> As John says, please give us all the information you can. If you've just
> put a file system on top of the array, you should now have three copies
> of the filesystem to try and recover. I can't help any further here. but
> all you have to do is track down the start of said filesystem, work out
> where you tell linux to start a partition so it correctly contains the
> filesystem, and then mount said partition. Your data should all be there.
The trick will be to determine the offset. Please share as much
information as possible as to the layering of the original setup,
preferable with the fstab contents if available.
> Actually, you might be better off not copying onto drive 3. If you can
> work out where your filesystem partition should start, create a
> partition on drive 3 and copy the filesystem contents into said partition.
Or overlays with dmsetup.
> I've cc'd a couple of people I hope can help, but basically, you need to
> find out where in the raid array your data has been put, and then work
> out how to access it. Your data SHOULD be recoverable, but you've got
> some detective work ahead of you.
Your odds are decent. Again, share all the info you can.
>
> Cheers,
> Wol
Phil
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-12 0:26 ` Phil Turmel
@ 2023-04-12 10:15 ` Moritz Rosin
2023-04-13 6:10 ` Moritz Rosin
0 siblings, 1 reply; 14+ messages in thread
From: Moritz Rosin @ 2023-04-12 10:15 UTC (permalink / raw)
To: Phil Turmel, Wol, John Stoffel, Moritz Rosin; +Cc: linux-raid, NeilBrown
Hi Phil, et.al.,
first of all, thank y'all so much for your thoughts and answers.
I am going to add as much information as possible.
Am 12.04.2023 um 02:26 schrieb Phil Turmel:
> Hi Moritz, et al,
>
> On 4/11/23 20:18, Wol wrote:
>> On 11/04/2023 20:47, John Stoffel wrote:
>>>>>>>> "Moritz" == Moritz Rosin <moritz.rosin@itrosinen.de> writes:
>>>
>>>> Hey there,
>>>> unfortunately I have to admit, that I learned my lesson the hard way
>>>> dealing with software raids.
>>>
>>>> I had a raid1 running reliable over month using two 4TB HDDs.
>>>> Since I ran short on free space I tried to convert the raid1 to a
>>>> raid5
>>>> in-place (with the plan to add the 3rd HDD after converting).
>>>> That's where my incredibly stupid mistake kicked in.
>>>
>>>> I followed an internet tutorial that told me to do:
>>>> mdadm --create /dev/md0 --level=5 --raid-devices=2 /dev/sdX1 /dev/sdY1
>
> Ewww.
>
>>> Please share the link to the tutorial so we can maybe shame that
>>> person into fixing it. Or removing it.
I followed this tutorial, but found similar suggesting to use "mdadm --
create" ->
https://dev.to/csgeek/converting-raid-1-to-raid-5-on-linux-file-systems-k73
>>>
>>
>> See below. There's no reason why it shouldn't work, PROVIDED nothing
>> has happened to the mirror since you created it.
>>>
>>>> I learned that I re-created a raid5 array instead of converting the
>>>> raid1 :-(
>
> Indeed. It would have sync'd every other chunk in opposite directions
> to place "parity" in the right rotation, but otherwise equivalent to a
> mirror.
>
>>> Yeah, I think you're out of luck here. What kind of filesystem did
>>> you have on your setup? Were you using MD -> LVM -> filesystem stack?
>>> Or just a raw filesystem on top of the /dev/md? device?
>>
>> I dunno. A two-disk raid-5 is the same as a 2-disk mirror. That
>> raid-5 MAY just start and run and you'll be okay. You can try
>> mounting it read-only and see what happens ...
>
> The odds of matching offsets depends entirely on how old the original
> raid1 was.
The original raid1 was about 2 years old.
I was using ext4 directly ontop of the array.
>
>
>>>> Is there any chance to un-do the conversion or restore the data?
>>>> Has the process of creation really overwritten data or is there
>>>> anythins left on the disk itself that can be rescued?
>>>
>> If the conversion has overwritten the data, it will merely have
>> overwritten one copy of the data with the other.
>
> Concur.
>
>>> If you have any information on your setup before you did this, then
>>> you might be ok, but honestly, I think you're toast.
>>>
>> It might be a bit of a forensic job, but no I don't think so. Do you
>> have that third 4TB HDD? If so, MAKE A BACKUP of one of the drives.
>> That way, you'll have three copies to play with to try and recover
>> the data.
>
> This.
>
>> As John says, please give us all the information you can. If you've
>> just put a file system on top of the array, you should now have three
>> copies of the filesystem to try and recover. I can't help any further
>> here. but all you have to do is track down the start of said
>> filesystem, work out where you tell linux to start a partition so it
>> correctly contains the filesystem, and then mount said partition.
>> Your data should all be there.
>
> The trick will be to determine the offset. Please share as much
> information as possible as to the layering of the original setup,
> preferable with the fstab contents if available.
Unfortunately I have no output (e.g. of fdisk -l) _bevore_ converting
the array. What I found in the syslogs is pasted here:
https://pastebin.com/iktUtYyt
Output of lsblk: https://pastebin.com/LNyUizGq
Output of fdisk -l (after conversion): https://pastebin.com/LH6ngUjc --
as you can see there is no partition table exitent for "md0"
Output of "mdadm --detail": https://pastebin.com/vYhjphKY
>
>> Actually, you might be better off not copying onto drive 3. If you
>> can work out where your filesystem partition should start, create a
>> partition on drive 3 and copy the filesystem contents into said
>> partition.
>
> Or overlays with dmsetup.
>
>> I've cc'd a couple of people I hope can help, but basically, you need
>> to find out where in the raid array your data has been put, and then
>> work out how to access it. Your data SHOULD be recoverable, but
>> you've got some detective work ahead of you.
>
> Your odds are decent. Again, share all the info you can.
Is there anything else I can provide?
What is a good point to start the detective work?
>
>
>>
>> Cheers,
>> Wol
>
> Phil
Thanks
Moritz
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-12 0:18 ` Wol
2023-04-12 0:26 ` Phil Turmel
@ 2023-04-12 10:22 ` Reindl Harald
2023-04-12 12:21 ` Phil Turmel
1 sibling, 1 reply; 14+ messages in thread
From: Reindl Harald @ 2023-04-12 10:22 UTC (permalink / raw)
To: Wol, John Stoffel, Moritz Rosin; +Cc: linux-raid, Phil Turmel, NeilBrown
Am 12.04.23 um 02:18 schrieb Wol:
> A two-disk raid-5 is the same as a 2-disk mirror
this is completly nonsense like it was nonsense that a RAID10 of 4
drives after remove two drives is the same as a RAID1 and just a
metadata update should be enough
why are you doing that always?
the problem is there are people out there which believe what you are
pretending here and spread that nonsense over the web as there isn't
enough wrong information already out there
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-12 10:22 ` Reindl Harald
@ 2023-04-12 12:21 ` Phil Turmel
2023-04-12 20:22 ` Mark Wagner
0 siblings, 1 reply; 14+ messages in thread
From: Phil Turmel @ 2023-04-12 12:21 UTC (permalink / raw)
To: Reindl Harald, Wol, John Stoffel, Moritz Rosin; +Cc: linux-raid, NeilBrown
Reindl,
On 4/12/23 06:22, Reindl Harald wrote:
>
>
> Am 12.04.23 um 02:18 schrieb Wol:
>> A two-disk raid-5 is the same as a 2-disk mirror
>
> this is completly nonsense like it was nonsense that a RAID10 of 4
> drives after remove two drives is the same as a RAID1 and just a
> metadata update should be enough
>
> why are you doing that always?
>
> the problem is there are people out there which believe what you are
> pretending here and spread that nonsense over the web as there isn't
> enough wrong information already out there
>
What is nonsense? A two-disk raid5 does have exactly the same content
on both disks, just like a mirror. The parity for any given single byte
is that same byte.
Please, just once, limit yourself to *positive* contributions.
Phil
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-12 12:21 ` Phil Turmel
@ 2023-04-12 20:22 ` Mark Wagner
2023-04-13 8:05 ` Wols Lists
0 siblings, 1 reply; 14+ messages in thread
From: Mark Wagner @ 2023-04-12 20:22 UTC (permalink / raw)
To: linux-raid
On Wed, Apr 12, 2023 at 5:45 AM Phil Turmel <philip@turmel.org> wrote:
>
> What is nonsense? A two-disk raid5 does have exactly the same content
> on both disks, just like a mirror. The parity for any given single byte
> is that same byte.
Only if it's using even parity. If it's using odd parity, the second
disk is the inverse of the first.
(I think Linux RAID uses even parity, but if it's documented anywhere,
I haven't found it.)
--
Mark
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-12 10:15 ` Moritz Rosin
@ 2023-04-13 6:10 ` Moritz Rosin
2023-04-13 12:10 ` Phil Turmel
0 siblings, 1 reply; 14+ messages in thread
From: Moritz Rosin @ 2023-04-13 6:10 UTC (permalink / raw)
To: Phil Turmel, Wol, linux-raid, John Stoffel, NeilBrown
Good Morning everyone.
Thank god I have very good news, since I managed to get access to
(hopefully most of) the data.
I want to share the path I took with you for further reference.
First thing I tried was to use "foremost" directly on the raid array
(/dev/md0) that had no partition table.
That was just partially successful since it ran *verry* slowly and
produced mixed results. Many broken files, no dir structure, no
filenames.
But there were files that came out correctly (content wise) - so I had
hope.
Following your advice I then start off on this page:
https://raid.wiki.kernel.org/index.php/Recovering_a_failed_software_RAID
(chapter "Making the harddisks read-only using an overlay file").
With what you assumed, that the data should be there on the raw disks, I
created overlays as explained.
One note here: In step 3 the page used "blockdev --getsize ...." but in
my version (2.36.1) that parameter is marked as "deprecated" an didn't
work. I had to use "blockdev --getsz" instead.
Having the overlays I fiddled around and ended up using "testdisk", let
it analyze the overlay device "/dev/mapper/sdX1". After selecting "EFI
GPT" partition type, it found a partition table I was able to use.
From here on the process was pretty straight forward. testdisk showed
the disk's old file structure and I was able to copy the "lost" files to
a backup hdd.
The process is still running but spot tests were pretty promising that
most of the data can be recovered.
When backup has finished. I will completely re-create the array and
start with a clean setup :-)
Thanks again for your support, input and thoughts.
Best
Moritz
Am 2023-04-12 12:15, schrieb Moritz Rosin:
> Hi Phil, et.al.,
>
> first of all, thank y'all so much for your thoughts and answers.
> I am going to add as much information as possible.
>
> Am 12.04.2023 um 02:26 schrieb Phil Turmel:
>> Hi Moritz, et al,
>>
>> On 4/11/23 20:18, Wol wrote:
>>> On 11/04/2023 20:47, John Stoffel wrote:
>>>>>>>>> "Moritz" == Moritz Rosin <moritz.rosin@itrosinen.de> writes:
>>>>
>>>>> Hey there,
>>>>> unfortunately I have to admit, that I learned my lesson the hard
>>>>> way
>>>>> dealing with software raids.
>>>>
>>>>> I had a raid1 running reliable over month using two 4TB HDDs.
>>>>> Since I ran short on free space I tried to convert the raid1 to a
>>>>> raid5
>>>>> in-place (with the plan to add the 3rd HDD after converting).
>>>>> That's where my incredibly stupid mistake kicked in.
>>>>
>>>>> I followed an internet tutorial that told me to do:
>>>>> mdadm --create /dev/md0 --level=5 --raid-devices=2 /dev/sdX1
>>>>> /dev/sdY1
>>
>> Ewww.
>>
>>>> Please share the link to the tutorial so we can maybe shame that
>>>> person into fixing it. Or removing it.
> I followed this tutorial, but found similar suggesting to use "mdadm --
> create" ->
> https://dev.to/csgeek/converting-raid-1-to-raid-5-on-linux-file-systems-k73
>>>>
>>>
>>> See below. There's no reason why it shouldn't work, PROVIDED nothing
>>> has happened to the mirror since you created it.
>>>>
>>>>> I learned that I re-created a raid5 array instead of converting the
>>>>> raid1 :-(
>>
>> Indeed. It would have sync'd every other chunk in opposite directions
>> to place "parity" in the right rotation, but otherwise equivalent to a
>> mirror.
>>
>>>> Yeah, I think you're out of luck here. What kind of filesystem did
>>>> you have on your setup? Were you using MD -> LVM -> filesystem
>>>> stack?
>>>> Or just a raw filesystem on top of the /dev/md? device?
>>>
>>> I dunno. A two-disk raid-5 is the same as a 2-disk mirror. That
>>> raid-5 MAY just start and run and you'll be okay. You can try
>>> mounting it read-only and see what happens ...
>>
>> The odds of matching offsets depends entirely on how old the original
>> raid1 was.
> The original raid1 was about 2 years old.
> I was using ext4 directly ontop of the array.
>>
>>
>>>>> Is there any chance to un-do the conversion or restore the data?
>>>>> Has the process of creation really overwritten data or is there
>>>>> anythins left on the disk itself that can be rescued?
>>>>
>>> If the conversion has overwritten the data, it will merely have
>>> overwritten one copy of the data with the other.
>>
>> Concur.
>>
>>>> If you have any information on your setup before you did this, then
>>>> you might be ok, but honestly, I think you're toast.
>>>>
>>> It might be a bit of a forensic job, but no I don't think so. Do you
>>> have that third 4TB HDD? If so, MAKE A BACKUP of one of the drives.
>>> That way, you'll have three copies to play with to try and recover
>>> the data.
>>
>> This.
>>
>>> As John says, please give us all the information you can. If you've
>>> just put a file system on top of the array, you should now have three
>>> copies of the filesystem to try and recover. I can't help any further
>>> here. but all you have to do is track down the start of said
>>> filesystem, work out where you tell linux to start a partition so it
>>> correctly contains the filesystem, and then mount said partition.
>>> Your data should all be there.
>>
>> The trick will be to determine the offset. Please share as much
>> information as possible as to the layering of the original setup,
>> preferable with the fstab contents if available.
> Unfortunately I have no output (e.g. of fdisk -l) _bevore_ converting
> the array. What I found in the syslogs is pasted here:
> https://pastebin.com/iktUtYyt
> Output of lsblk: https://pastebin.com/LNyUizGq
> Output of fdisk -l (after conversion): https://pastebin.com/LH6ngUjc --
> as you can see there is no partition table exitent for "md0"
> Output of "mdadm --detail": https://pastebin.com/vYhjphKY
>>
>>> Actually, you might be better off not copying onto drive 3. If you
>>> can work out where your filesystem partition should start, create a
>>> partition on drive 3 and copy the filesystem contents into said
>>> partition.
>>
>> Or overlays with dmsetup.
>>
>>> I've cc'd a couple of people I hope can help, but basically, you need
>>> to find out where in the raid array your data has been put, and then
>>> work out how to access it. Your data SHOULD be recoverable, but
>>> you've got some detective work ahead of you.
>>
>> Your odds are decent. Again, share all the info you can.
> Is there anything else I can provide?
> What is a good point to start the detective work?
>>
>>
>>>
>>> Cheers,
>>> Wol
>>
>> Phil
> Thanks
> Moritz
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-12 20:22 ` Mark Wagner
@ 2023-04-13 8:05 ` Wols Lists
2023-04-13 12:12 ` Phil Turmel
0 siblings, 1 reply; 14+ messages in thread
From: Wols Lists @ 2023-04-13 8:05 UTC (permalink / raw)
To: Mark Wagner, linux-raid
On 12/04/2023 21:22, Mark Wagner wrote:
> On Wed, Apr 12, 2023 at 5:45 AM Phil Turmel <philip@turmel.org> wrote:
>>
>> What is nonsense? A two-disk raid5 does have exactly the same content
>> on both disks, just like a mirror. The parity for any given single byte
>> is that same byte.
>
> Only if it's using even parity. If it's using odd parity, the second
> disk is the inverse of the first.
>
It's documented on the raid wiki (because I think it was documented
there before I started editing it), that the way raid switches between
different raid types is through the fact (accidental or on purpose I
don't know) that most of the two-disk raid types just happen to have an
"identical in practice" disk layout.
So converting between raid-1 and raid-5 is as simple as changing the
config of a raid-1 to a degraded raid-5 and vice versa.
Cheers,
Wol
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-13 6:10 ` Moritz Rosin
@ 2023-04-13 12:10 ` Phil Turmel
0 siblings, 0 replies; 14+ messages in thread
From: Phil Turmel @ 2023-04-13 12:10 UTC (permalink / raw)
To: Moritz Rosin, Wol, linux-raid, John Stoffel, NeilBrown
On 4/13/23 02:10, Moritz Rosin wrote:
> Good Morning everyone.
>
> Thank god I have very good news, since I managed to get access to
> (hopefully most of) the data.
> I want to share the path I took with you for further reference.
>
> First thing I tried was to use "foremost" directly on the raid array
> (/dev/md0) that had no partition table.
> That was just partially successful since it ran *verry* slowly and
> produced mixed results. Many broken files, no dir structure, no filenames.
> But there were files that came out correctly (content wise) - so I had
> hope.
>
> Following your advice I then start off on this page:
> https://raid.wiki.kernel.org/index.php/Recovering_a_failed_software_RAID
> (chapter "Making the harddisks read-only using an overlay file").
> With what you assumed, that the data should be there on the raw disks, I
> created overlays as explained.
> One note here: In step 3 the page used "blockdev --getsize ...." but in
> my version (2.36.1) that parameter is marked as "deprecated" an didn't
> work. I had to use "blockdev --getsz" instead.
>
> Having the overlays I fiddled around and ended up using "testdisk", let
> it analyze the overlay device "/dev/mapper/sdX1". After selecting "EFI
> GPT" partition type, it found a partition table I was able to use.
> From here on the process was pretty straight forward. testdisk showed
> the disk's old file structure and I was able to copy the "lost" files to
> a backup hdd.
> The process is still running but spot tests were pretty promising that
> most of the data can be recovered.
>
> When backup has finished. I will completely re-create the array and
> start with a clean setup :-)
>
> Thanks again for your support, input and thoughts.
>
> Best
> Moritz
Good morning Moritz,
That's great news. Thanks for reporting back.
Phil
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-13 8:05 ` Wols Lists
@ 2023-04-13 12:12 ` Phil Turmel
2023-04-13 14:58 ` Wols Lists
0 siblings, 1 reply; 14+ messages in thread
From: Phil Turmel @ 2023-04-13 12:12 UTC (permalink / raw)
To: Wols Lists, Mark Wagner, linux-raid
On 4/13/23 04:05, Wols Lists wrote:
> On 12/04/2023 21:22, Mark Wagner wrote:
>> On Wed, Apr 12, 2023 at 5:45 AM Phil Turmel <philip@turmel.org> wrote:
>>>
>>> What is nonsense? A two-disk raid5 does have exactly the same content
>>> on both disks, just like a mirror. The parity for any given single byte
>>> is that same byte.
>>
>> Only if it's using even parity. If it's using odd parity, the second
>> disk is the inverse of the first.
>>
> It's documented on the raid wiki (because I think it was documented
> there before I started editing it), that the way raid switches between
> different raid types is through the fact (accidental or on purpose I
> don't know) that most of the two-disk raid types just happen to have an
> "identical in practice" disk layout.
>
> So converting between raid-1 and raid-5 is as simple as changing the
> config of a raid-1 to a degraded raid-5 and vice versa.
Be careful! This is only true for a *two* disk raid.
> Cheers,
> Wol
>
Phil
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Recover data from accidentally created raid5 over raid1
2023-04-13 12:12 ` Phil Turmel
@ 2023-04-13 14:58 ` Wols Lists
0 siblings, 0 replies; 14+ messages in thread
From: Wols Lists @ 2023-04-13 14:58 UTC (permalink / raw)
To: Phil Turmel, Mark Wagner, linux-raid
On 13/04/2023 13:12, Phil Turmel wrote:
> On 4/13/23 04:05, Wols Lists wrote:
>> On 12/04/2023 21:22, Mark Wagner wrote:
>>> On Wed, Apr 12, 2023 at 5:45 AM Phil Turmel <philip@turmel.org> wrote:
>>>>
>>>> What is nonsense? A two-disk raid5 does have exactly the same content
>>>> on both disks, just like a mirror. The parity for any given single
>>>> byte
>>>> is that same byte.
>>>
>>> Only if it's using even parity. If it's using odd parity, the second
>>> disk is the inverse of the first.
>>>
>> It's documented on the raid wiki (because I think it was documented
>> there before I started editing it), that the way raid switches between
>> different raid types is through the fact (accidental or on purpose I
>> don't know) that most of the two-disk raid types just happen to have
>> an "identical in practice" disk layout.
>>
>> So converting between raid-1 and raid-5 is as simple as changing the
>> config of a raid-1 to a degraded raid-5 and vice versa.
>
> Be careful! This is only true for a *two* disk raid.
>
Which is why (and I've tried) mdadm won't let you convert a 3-disk
raid-1 :-)
But yes, two-disk raids only ...
Cheers,
Wol
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-04-13 14:59 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-11 18:11 Recover data from accidentally created raid5 over raid1 Moritz Rosin
2023-04-11 19:47 ` John Stoffel
2023-04-12 0:18 ` Wol
2023-04-12 0:26 ` Phil Turmel
2023-04-12 10:15 ` Moritz Rosin
2023-04-13 6:10 ` Moritz Rosin
2023-04-13 12:10 ` Phil Turmel
2023-04-12 10:22 ` Reindl Harald
2023-04-12 12:21 ` Phil Turmel
2023-04-12 20:22 ` Mark Wagner
2023-04-13 8:05 ` Wols Lists
2023-04-13 12:12 ` Phil Turmel
2023-04-13 14:58 ` Wols Lists
-- strict thread matches above, loose matches on Subject: below --
2023-04-11 18:12 Moritz Rosin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox