[DRBD-user] mounting drbd volume

Lars Ellenberg Lars.Ellenberg at linbit.com
Mon Apr 25 15:02:13 CEST 2005

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


/ 2005-04-25 14:46:13 +0500
\ Umair Siddiqi:

you say:
"I'm no expert in linux" =>
IMO, you need to become at least a "power user", though,
if you are going to run and administrate a linux HA cluster.

> So this means, I'll have to copy tmppart to the other server, before
> running the sfdisk on secondary server?
> 
> This is what I get from sfdisk:
> 
> [root at acbl1 root]# more tmppart
> 
> Disk /dev/cciss/c0d0: 35419 cylinders, 255 heads, 63 sectors/track
> Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from
> 0
> 
>    Device Boot Start     End   #cyls    #blocks   Id  System
> /dev/cciss/c0d0p1   *      0+     12      13-    104391   83  Linux
> /dev/cciss/c0d0p2         13    2562    2550   20482875   83  Linux
> /dev/cciss/c0d0p3       2563    5112    2550   20482875   83  Linux
> /dev/cciss/c0d0p4       5113   35418   30306  243432945    f  Win95
> Ext'd (LBA)
> /dev/cciss/c0d0p5       5113+   6387    1275-  10241406   83  Linux
> /dev/cciss/c0d0p6       6388+   7534    1147-   9213246   82  Linux swap
> /dev/cciss/c0d0p7       7535+   7789     255-   2048256   83  Linux
> /dev/cciss/c0d0p8       7790+  35418   27629- 221929911   83  Linux
> 
> 
> Should I go ahead and do this on secondary server. I hope this would not
> mess up my other filesystems

yes it will mess it up: it rewrites the partition table on the other box
to look exactly like the partition table on the first box.

BE CAREFUL.
and, Leroy,
though your advice is good, be careful whom you advise ...
I mean, if a sort of newbie says he has data coruption, and someone whom
he trusts says, well, easiest way to get rid of the data coruption is rm
-rf /, then he might do that. and someone might get killed over it
sooner or later.

so, Leroys advice was correct,
but I'll insert some comments:

- disconnect drbd
- since you are about to mess with the physical devices:
  down drbd completely.
- you might want to use a dedicated meta-disk /dev/whatever[0] in
  your drbd.conf

LEAVE OUT NEXT STEP, if you are not sure about it.
It is reasonable, if you do the recommended thing:
start from scratch, i.e. set up two new boxes
to become your new HA cluster.
But if you start with two existing boxes, or two
not that identical ones, you may mess things up horribly.

- prepare partitions on both sides using identical parameters
    box1# sfdisk -l $PHYSICAL_DISK > tmppart
    box1# scp tmppart box2:

    go to other box, repartition it to look alike...
    box2# sfdisk $PHYSICAL_DISK < tmppart

    where $PHYSICAL_DISK is the physical device
    (lower level device to be used by drbd).

next step will overwrite your data with zeros, DESTROYING all possibly
remaining data on the storage devices! be careful what you type!
obviously don't destroy too much in case you have multiple meta data
blocks on one dedicated meta data device (which, btw, is now deprecated.
use LVM and create one each).  man dd may help.

- clean it using dd:
    (typically the first some MB are enough.)
    dd if=/dev/zero of=$PHYSICAL_DISK
    and, your meta data device, if you have one extra:
    dd if=/dev/zero of=$PHYSICAL_META_DATA_DISK

Assuming you named your resource "D0" in drbd.conf (if you named it WEB,
or DATA or drbd0 or rsc7, or whatever, use that name where I have "D0"
below)

- restart / reconfigure drbd
    # drbdadm attach D0
    # drbdadm invalidate D0
  
- make it primary
    # drbdadm -- --do-what-I-say primary D0

- rebuild the filesystem using mkfs.ext3 /dev/drbd0
- reconnect drbd
    # drbdadm connect D0


	Lars



More information about the drbd-user mailing list