Thread (4 messages) 4 messages, 4 authors, 2013-09-06

Re: Problem halting raid 1

From: Tregaron Bayly <hidden>
Date: 2013-09-06 16:09:20

On 09/06/2013 06:19 AM, NeilBrown wrote:
quoted
What I want to do is to completely remove the array so I can mount the
individual partitions anywhere else without the need of mdadm (and
access the data created when the array was running).
If the array uses 0.90 or 1.0 metadata, then having stopped the array you can
simply mount the component devices

If it uses 1.1 or 1.2 you can only access the data via md.
I've mounted filesystems outside of mdadm with version 1.1 and 1.2 metadata.  It just requires a little linux jiggery-pokery.

1) Get the data offset using mdadm -E

/dev/sda:
           Magic : a92b4efc
         Version : 1.2
     Feature Map : 0x0
      Array UUID : 0f9091ac:202b80dc:31e8820b:f2faeb31
            Name : array_3529
   Creation Time : Sat Jul 27 20:53:55 2013
      Raid Level : raid1
    Raid Devices : 2

  Avail Dev Size : 4194041856 (1999.88 GiB 2147.35 GB)
      Array Size : 2097020736 (1999.87 GiB 2147.35 GB)
   Used Dev Size : 4194041472 (1999.87 GiB 2147.35 GB)
     Data Offset : 262144 sectors
    Super Offset : 8 sectors
           State : clean
     Device UUID : 7f91df10:05450594:32823f26:924d31ad

     Update Time : Mon Sep  2 22:18:19 2013
        Checksum : f9f956af - correct
          Events : 69985


    Device Role : Active device 0
    Array State : A. ('A' == active, '.' == missing)

2) Multiply the data offset by 512 to convert sectors to bytes

262144 * 512 = 134217728

3) Setup the disk as a loopback device with the data offset

losetup --offset 134217728 /dev/loop1 /dev/sda

4) Now use the loopback device - it looks just like the md device would.

kpartx -a /dev/loop1
mount -o ro /dev/mapper/loop1p1 /mnt/foo

Of course you have to realize that any modifications you make to the filesystem are not mirrored - you will be forced to resync the mirror if you make any modifications to disk at all.

My $0.02

Tregaron

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help