Re: MDRaid Rollback

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

 



Hello,

On Wed, Mar 24, 2021 at 01:04:07PM +0200, Shaun Glass wrote:
> Would just like to know if it is possible at all to break a mirror and
> convert a md device back to its original state without losing data ?

The default metadata version (1.2) is placed at the start of an
array, so even if zeroed this will prevent the array member being
used as the filesystem that is on top of it.

If you have metadata version 0,9 or 1.0 which are at the end then I
don't see why it wouldn't work. I've never done it though so try it
out first on loop devices.

Don't forget to "mdadm --zero-superblock /dev/sda1" (or whatever
devices) for the member device that you have failed out of the
array, so it is no longer treated as part of an array,

But, this being a RAID-1 you have at least two devices so wouldn't
it be safer to:

- Fail out one device
- Zero that device
- Create new filesystem on the removed device
- Copy data onto it from the still-running array that is currently
  degraded
- Use new filesystem for whatever you wanted

?

Depending on what you are trying to achieve you could also import
the broken our device as ANOTHER MD RAID-1 array so both arrays are
running degraded (and now divergent).

Finally, if you are on superblock versions 1.1 or 1.2 you may be
able to work out the offset into the device and use a loop device to
skip that, so treating it as a normal filesystem:

    https://raid.wiki.kernel.org/index.php/RAID_superblock_formats#The_version-1_Superblock_Format

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting



[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