linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Raid 1 usage in a lab
@ 2010-01-28  4:09 Joseph L. Casale
  2010-01-29 10:10 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph L. Casale @ 2010-01-28  4:09 UTC (permalink / raw)
  To: 'linux-raid@vger.kernel.org'

I have a box with a two discs mirrored. Suppose I want to remove the primary
and boot off the secondary alone to test, then roll back to the primary after
the test.

I have been doing this by:

1. Removing sda, booting off the sdb and running:
     # mdadm --grow /dev/md[0|1] --raid-devices=1 --force
     Then test away, shutdown...

2. Remove sdb, install sda only and run:
     # mdadm --grow /dev/md[0|1] --raid-devices=1 --force
     shutdown...

3. Install sdb and reboot, the run:
    # mdadm --manage /dev/md0 --add /dev/sdb1
    # mdadm --grow /dev/md0 --raid-devices=2
 
    # mdadm --manage /dev/md1 --add /dev/sdb2
    # mdadm --grow /dev/md1 --raid-devices=2


Is there a simpler way with less reboots? What criteria does md use to
determine which disc is most recent, even a solo reboot with sda, after
which attaching sdb causes the system to prefer sdb, even though the solo
boot off sda should have made timestamps prove sda most current.

Thanks!
jlc

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

* Re: Raid 1 usage in a lab
  2010-01-28  4:09 Raid 1 usage in a lab Joseph L. Casale
@ 2010-01-29 10:10 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2010-01-29 10:10 UTC (permalink / raw)
  To: Joseph L. Casale; +Cc: 'linux-raid@vger.kernel.org'

On Thu, 28 Jan 2010 04:09:11 +0000
"Joseph L. Casale" <jcasale@activenetwerx.com> wrote:

> I have a box with a two discs mirrored. Suppose I want to remove the primary
> and boot off the secondary alone to test, then roll back to the primary after
> the test.
> 
> I have been doing this by:
> 
> 1. Removing sda, booting off the sdb and running:
>      # mdadm --grow /dev/md[0|1] --raid-devices=1 --force
>      Then test away, shutdown...
> 
> 2. Remove sdb, install sda only and run:
>      # mdadm --grow /dev/md[0|1] --raid-devices=1 --force
>      shutdown...
> 
> 3. Install sdb and reboot, the run:
>     # mdadm --manage /dev/md0 --add /dev/sdb1
>     # mdadm --grow /dev/md0 --raid-devices=2
>  
>     # mdadm --manage /dev/md1 --add /dev/sdb2
>     # mdadm --grow /dev/md1 --raid-devices=2
> 
> 
> Is there a simpler way with less reboots? What criteria does md use to
> determine which disc is most recent, even a solo reboot with sda, after
> which attaching sdb causes the system to prefer sdb, even though the solo
> boot off sda should have made timestamps prove sda most current.

It uses the event count to choose the most recent, not the timestamp.
sda has seen the most events so it is the most recent.

Is your root filesystem on the mirrored pair?
If not, then you don't need any reboots at all.
If it is you should be able to get away with just 1.

1/  mdadm /dev/md[0|1] --fail /dev/sda[1|2]

 now you are running on sdb, sda is untouched.

2a/ if root is not on mirrored pair:
   mdadm -S /dev/md1
   mdadm --zero /dev/sdb2
   mdadm -A /dev/md1 /dev/sda1

2b/ if root is on mirrored pair:
   sync ; sync ; mdadm --zero /dev/sdb1 ; reboot -f -n

   should boot up and assemble /dev/md0 from /dev/sda1

3/ mdadm /dev/md0 --add /dev/sdb1
   mdadm /dev/md1 --add /dev/sdb2


NeilBrown

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

end of thread, other threads:[~2010-01-29 10:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28  4:09 Raid 1 usage in a lab Joseph L. Casale
2010-01-29 10:10 ` Neil Brown

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