Re: Several questions about enbd

[email protected] (Peter T. Breuer)
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
Peter T. Breuer <[email protected]> wrote:
> > Ok. What's the purpose of reassemble? Wouldn't just raidstart be enough?
> 
> I am afraid you are currently more familiar with the scripts than I am.
> I would have to go look, and it is late. I'll answer over the w/e.


I believe that this is what using mdadm instead of raidtls looks like
.... (untested).



diff -ur resource.d.org/enbd-primary resource.d/enbd-primary
--- resource.d.org/enbd-primary	Sun Feb 13 21:03:09 2005
+++ resource.d/enbd-primary	Mon Feb 14 00:37:17 2005
@@ -2,6 +2,7 @@
 # This file is "/etc/ha.d/resources.d/enbd-primary". It should be on
 # both secondary and primary in the failover pair.
 
+NBD=/dev/nd/a
 MD=/dev/md0
 MNT=/mnt
 MNTOPTIONS=""
@@ -39,14 +41,11 @@
            /etc/init.d/nbd restart client $NBDID
 
            sleep 2
-           mkraid --really-force --dangerous-no-resync $MD
-           raidsetfaulty $MD $PRIMARYPARTITION
+           mdadm -C -f --run $MD -l 1 -n 2 -x 0 $NBD/0 missing
            sleep 1
-           raidstop $MD
            sleep 1
-           raidstart $MD
            sleep 1
-           raidhotadd $MD $PRIMARYPARTITION
+           mdadm -a $MD $PRIMARYPARTITION
            mount -t $MNTTYPE $MD $MNT $MNTOPTIONS
         echo "."
 }
@@ -54,7 +58,7 @@
 primaryside_client_stop () {
         echo -n "Stopping enbd-primary and umounting"
             umount $MNT
-            raidstop $MD
+            mdadm -S $MD
 
             # kill primary
             /etc/init.d/nbd stop client $NBDID
diff -ur resource.d.org/enbd-secondary resource.d/enbd-secondary
--- resource.d.org/enbd-secondary	Sun Feb 13 21:22:01 2005
+++ resource.d/enbd-secondary	Sun Feb 13 21:28:18 2005
@@ -7,13 +7,16 @@
 
 MNT=/mnt
 MNTOPTIONS=""
-FSTYPE="ext3"
+MNTTYPE="ext3"
 
-PRIMARY="mahler"
 SECONDARY="strauss"
+SECONDARYPARTITION=/users/image
+
+PRIMARY="mahler"
+PRIMARYPARTITION=/dev/sda12
+
 
 NBDID="one"
-SECONDARYPARTITION=/users/image
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin;/usr/local/sbin:/usr/local/bin
 
@@ -25,7 +28,7 @@
 primaryside_server_start () {
         echo -n "Starting enbd-secondary takeover"
             # remove NBD component from raid mirror
-            raidsetfaulty $MD $NBD/0
+            mdadm -f $MD $NBD/0
             # shut down NBD primary daemon
             /etc/init.d/nbd stop client $NBDID
             # kill any lingering requests on the device
@@ -45,7 +49,7 @@
            fuser -muk $MNT
            umount $MNT
            # stop the whole raid device
-           raidstop $MD
+           mdadm -S $MD
            sleep 1
            # we need to make sure that the nbd-secondary is up
            # wait the 5s for the NBD device to reenable itself after
@@ -58,16 +63,13 @@
            # restart the raid device, but without resync. We will
            # then mark the nbd device fault and reintegrate it, 
            # causing a resync over the net
-           mkraid --really-force --dangerous-no-resync $MD
-           raidsetfaulty $MD $NBD/0
+           mdadm -C -f --run $MD -l 1 -n 2 -x 0 missing $PRIMARYPARTITION
            sleep 1
-           raidstop $MD
            sleep 1
-           raidstart $MD
            sleep 1
-           raidhotadd $MD $NBD/0
+           mdadm -a $MD $NBD/0
 
-           mount -t $FSTYPE $MD $MNT $MNTOPTIONS
+           mount -t $MNTTYPE $MD $MNT $MNTOPTIONS
         echo "."
 }
 

I just glanced through it to familiarize myself with it ... I don't see
why one has to run "create" (-C) all the time instead of "assemble"
(-A), but I can imagine that with the less precise raidtools only to
hand it was easier to do that way. With mdadm there should be
sufficient control to allow -A. Notice that I could get rid of many of
the commands.

In particular with mdadm one can start an array running in degraded
mode. I hope I did it right above.


I need to add a token to show which end had the server when both went
down :-). Isn't this handled by heartbeat, somehow? Surely it's
heartbeats's business! Can you look that up?

Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.