2

So through a shell script gone sideways I accidentally deleted my mdadm raid5 (3 HDDs) and the partitions from the disks (so disks still connected according to lsblk as {sdb|sdc|sdd}).

I have not tried anything since realizing the raid and partitions are gone to not dig my hole deeper, but come across tools like "testdisk" for linux recovery in my web search for which I'm not sure how I should go about recovery if the raid is not recoverable.

Is there a way to reassemble the raid or at least make the data on one of the disks accessible so I can copy it to another disk?

50x
  • 21
  • 1
  • did you wipe the partition table only or mdadm metadata as well? do you still have syslogs that would have some info regarding your setup? if you're looking for generic advice on mdadm recovery it's here https://unix.stackexchange.com/a/131927/30851 but it requires you to know some details or spend time guessing... – frostschutz Apr 04 '23 at 19:41
  • it seems that mdadm metadata is lost as well. is it necessary to recover the raid to be able to try file recovery? – 50x Apr 04 '23 at 20:15
  • 1
    Absolutely you need to recover the RAID first – roaima Apr 04 '23 at 20:29
  • how would you go about recovering the raid if the partitions are the deleted and the mdadm metadata was lost? do I create an empty primary partition on all 3 disks and then create a raid5 for them from scratch AND THEN try to recover files with something like testdisk? – 50x Apr 04 '23 at 21:07
  • 1
    is the filesystem metadata also lost? how much did you overwrite? why do we have to ask every thing in the comments…? right now only you know what happened, how is anyone to answer…? it all depends on the individual situation. if the data was not encrypted you can deduce raid layout from it - or just try blindly and see if you can find a setting where your data appears intact. requires correct layout chunksize and alignment. sorry, its difficult to recover data and even more difficult to do it remotely – frostschutz Apr 04 '23 at 21:43
  • and yeah in general the raid has to be running (with the correct layout and settings) before you can recover much of your data. because raid distributes data across drives in chunks, if you try to recover anything from a single disk, whatever you find won't be larger than the raid chunksize. its all in bits and pieces unless raid puts it together – frostschutz Apr 04 '23 at 21:46

0 Answers0