linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem halting raid 1
@ 2013-09-06 10:42 Miguel Corberán Ruiz
  2013-09-06 11:38 ` Phil Turmel
  2013-09-06 12:19 ` NeilBrown
  0 siblings, 2 replies; 5+ messages in thread
From: Miguel Corberán Ruiz @ 2013-09-06 10:42 UTC (permalink / raw)
  To: linux-raid

Hello,
I am having a problem stopping an array. When I use the command "mdadm
--stop /dev/md0" the array disappears completely. It does not even
appear under /dev/m..

Then, when I try "mdadm --remove /dev/md0" bash tells me that /dev/md0
does not exist. So, after stopping the array with "mdadm --stop ..",
"cat /proc/mdstat" says that there is no array running. From what I
read the array should be visible but in a halted/stopped/deactivated
state. And then one can proceed to remove it.

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).

Any help will be appreciated. Thank you in advance,
Miguel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem halting raid 1
  2013-09-06 10:42 Problem halting raid 1 Miguel Corberán Ruiz
@ 2013-09-06 11:38 ` Phil Turmel
       [not found]   ` <CABcjxUMBp=oZ7Dg65ZK4ft-Jix4kAi=VV3juE1KWRkw8RnYKyQ@mail.gmail.com>
  2013-09-06 12:19 ` NeilBrown
  1 sibling, 1 reply; 5+ messages in thread
From: Phil Turmel @ 2013-09-06 11:38 UTC (permalink / raw)
  To: Miguel Corberán Ruiz; +Cc: linux-raid

Good morning Miguel,

On 09/06/2013 06:42 AM, Miguel Corberán Ruiz wrote:
> Hello,
> I am having a problem stopping an array. When I use the command "mdadm
> --stop /dev/md0" the array disappears completely. It does not even
> appear under /dev/m..

This is the expected behavior.

> Then, when I try "mdadm --remove /dev/md0" bash tells me that /dev/md0
> does not exist. So, after stopping the array with "mdadm --stop ..",
> "cat /proc/mdstat" says that there is no array running. From what I
> read the array should be visible but in a halted/stopped/deactivated
> state. And then one can proceed to remove it.

The --remove action is used to remove a failed member from an array, not
an array itself.

> 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).

You would use --zero-superblock on each member device to make it
"forget" what array it belonged to.

HTH,

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem halting raid 1
       [not found]   ` <CABcjxUMBp=oZ7Dg65ZK4ft-Jix4kAi=VV3juE1KWRkw8RnYKyQ@mail.gmail.com>
@ 2013-09-06 12:18     ` Phil Turmel
  0 siblings, 0 replies; 5+ messages in thread
From: Phil Turmel @ 2013-09-06 12:18 UTC (permalink / raw)
  To: Miguel Corberán Ruiz; +Cc: linux-raid

Hi Miguel,

[Top posting repaired. Please don't do that.]
[linux-raid added back to CC:.  Use reply-to-all on kernel.org lists.]

On 09/06/2013 07:57 AM, Miguel Corberán Ruiz wrote:
> On Fri, Sep 6, 2013 at 1:38 PM, Phil Turmel <philip@turmel.org> wrote:
>> Good morning Miguel,
>>
>> On 09/06/2013 06:42 AM, Miguel Corberán Ruiz wrote:
>>> Hello,
>>> I am having a problem stopping an array. When I use the command "mdadm
>>> --stop /dev/md0" the array disappears completely. It does not even
>>> appear under /dev/m..
>>
>> This is the expected behavior.
>>
>>> Then, when I try "mdadm --remove /dev/md0" bash tells me that /dev/md0
>>> does not exist. So, after stopping the array with "mdadm --stop ..",
>>> "cat /proc/mdstat" says that there is no array running. From what I
>>> read the array should be visible but in a halted/stopped/deactivated
>>> state. And then one can proceed to remove it.
>>
>> The --remove action is used to remove a failed member from an array, not
>> an array itself.
>>
>>> 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).
>>
>> You would use --zero-superblock on each member device to make it
>> "forget" what array it belonged to.

> Hello Phil and thank you for answering,
> If that is the expected behaviour, there are many sites with wrong
> information since the advice to first stop the array and then remove
> it:
>
>
http://blogging.dragon.org.uk/index.php/mini-howtos/howto-remove-raid-arrays
>
> http://en.wikipedia.org/wiki/Mdadm

Those two are wrong.

>
https://wiki.archlinux.org/index.php/RAID#Removing_device.2C_stop_using_the_array

This one is correct.

> In the mdadm man page, for the --stop option, it says: "deactivate
> array, releasing all resources."
> It doesn't say that the array is removed or deleted.

Because the array still exists on the disks.  It is just "turned off".

> As for the md superblock zeroing, I have tried to stop, remove and
> zero the superblock of an individual device. But afterwards the
> device's filesystem appears as unknown and I cannot mount it to access
> the data.
>
> So, accepting things as they are, how can I see the data in a device
> which pertained to an array without creating a degraded array with it?

You can't, except in one special case.

The special case is when you had a simple mirror and you now want to use
one of its members by itself (permanently).  If the raid used version
0.9 or version 1.0 metadata, just zeroing the metadata will do what you
want (with some wasted space at the end of the partition).

If the raid used version 1.1 or 1.2 metadata, the contents of the array
are offset from the start of the array member.  You have to shift the
data to the start of the partition, or change the partition definition
to start at the right spot.

HTH,

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem halting raid 1
  2013-09-06 10:42 Problem halting raid 1 Miguel Corberán Ruiz
  2013-09-06 11:38 ` Phil Turmel
@ 2013-09-06 12:19 ` NeilBrown
  2013-09-06 16:09   ` Tregaron Bayly
  1 sibling, 1 reply; 5+ messages in thread
From: NeilBrown @ 2013-09-06 12:19 UTC (permalink / raw)
  To: Miguel Corberán Ruiz; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]

On Fri, 6 Sep 2013 12:42:23 +0200 Miguel Corberán Ruiz <migcorrui@gmail.com>
wrote:

> Hello,
> I am having a problem stopping an array. When I use the command "mdadm
> --stop /dev/md0" the array disappears completely. It does not even
> appear under /dev/m..
> 
> Then, when I try "mdadm --remove /dev/md0" bash tells me that /dev/md0
> does not exist. So, after stopping the array with "mdadm --stop ..",
> "cat /proc/mdstat" says that there is no array running. From what I
> read the array should be visible but in a halted/stopped/deactivated
> state. And then one can proceed to remove it.
> 
> 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.

The version is listed at the top of "mdadm --examine /dev/sdXX" or "mdadm
--detail /dev/md0" output.

NeilBrown

> 
> Any help will be appreciated. Thank you in advance,
> Miguel
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem halting raid 1
  2013-09-06 12:19 ` NeilBrown
@ 2013-09-06 16:09   ` Tregaron Bayly
  0 siblings, 0 replies; 5+ messages in thread
From: Tregaron Bayly @ 2013-09-06 16:09 UTC (permalink / raw)
  To: NeilBrown; +Cc: Miguel Corberán Ruiz, linux-raid

On 09/06/2013 06:19 AM, NeilBrown wrote:

>> 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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-06 16:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06 10:42 Problem halting raid 1 Miguel Corberán Ruiz
2013-09-06 11:38 ` Phil Turmel
     [not found]   ` <CABcjxUMBp=oZ7Dg65ZK4ft-Jix4kAi=VV3juE1KWRkw8RnYKyQ@mail.gmail.com>
2013-09-06 12:18     ` Phil Turmel
2013-09-06 12:19 ` NeilBrown
2013-09-06 16:09   ` Tregaron Bayly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).