Re: Recover array after I panicked

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 27, 2017 at 09:57:20PM +0200, Patrik Dahlström wrote:
> Success! Using a 126M as data offset gave me valid data for the 5 disk
> raid and using linear device mapping I'm able to access my data again.

Nice.

> Some is probably corrupted from my previous destructive recovery
> attempts, but it seems like most of the data is still there and
> accessible. I will start backup up the most essential data now.

If nothing else happened, I'd expect it to be intact (or at least 
not any more corrupt than it would be after a regular power loss).
If you encounter any files with corrupted contents, you could use 
`filefrag` or `hdparm --fibmap` to determine where it is physically 
located and then perhaps see if that's anywhere near your danger zone. 
It could still mean you didn't choose the correct X for linear mapping.

But of course, I don't know everything that happened. :-P

> > This is only a way to get read access at the data, making the raid 
> > work as a standalone again (resume reshape with lost raid metadata) 
> > is another problem, to be tackled after you backed up your data ;)
> 
> Now, how do we do this?

Well, there's an elegant approach that works beautifully and perfectly 
and entirely risk free... and then there's a simple, stupid, quick&dirty.
Only problem is, I'm way too lazy to describe the elegant one. Shucks.

The quick and dirty method is... grow using dd from 5disk raid (overlay)
to 6disk raid (no overlay) starting from the correct offset (verify!). 
That resumes your reshape in an offline-ish, hackish manner, and once 
it's done you have the whole thing. That's the theory anyway.

Pseudocode:

mdadm --create /dev/md5 --assume-clean /dev/overlay/{a,b,c}
mdadm --create /dev/md6 --assume-clean /dev/{a,b,c,d} # +1 drive
losetup --offset=X /dev/loop55 /dev/md5
losetup --offset=X /dev/loop66 /dev/md6
cmp /dev/loop55 /dev/loop66 # much identical, so wow
dd bs=1M status=progress if=/dev/loop55 of=/dev/loop66

It's dangerous, okay?
I didn't tell you to do it, okay?
Don't blame me, okay?
Backup your stuff first, okay?

As this writes to your drives, you have only one shot to get it right.
You're not allowed to mount until dd is done. It's an offline operation.
If dd were to be aborted for any reason, the offset would shift to X+n.
If dd were to encounter write errors without aborting, corruption ensues.

Regards
Andreas Klauer
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux