[DRBD-user] LVM volumes not persistent after reboot when using /dev/drbd0 as the device

jeffb jeffb at umci.com
Sat Apr 29 00:13:14 CEST 2006

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


We've had this problem before too. In our case, it wasn't really a
problem with drbd or with LVM, it was just a start order problem. Most
distro's have lvm start very early because the system might need those
block devices to finish booting. I think under Redhat, and under
Ubuntu/Debian the LVM stuff ran right out of sysinit.... before any of
the other startup scripts ran. When LVM runs, it does some auto
detection of existing devices (it tags the drives when setting up, and
looks for those tags later to autodetect lvm devices), and sets them up
on boot. If drbd isn't running, then it might not be able to see the
device, or worse it might see the wrong device and try to use it...
seriously messing with drbd later... 

The two things you've got to do:
#1) Make sure you change your lvm.conf file to keep lvm from trying to
use the "real" device...you don't want lvm to use /dev/sdc directly when
lvm was setup on /dev/drbd0.. The meta data will make a real mess of
things.

#2) Find where your system does it's lvm detection routine at startup
(probably not in a normal startup script), and them do something to make
sure that those functions aren't run until after drbd. You could put
drbd before instead, but then you'd have to mess with moving network
startup stuff, and a whole bunch of other junk.  We ended up just
creating an lvm start/stop script, just like other services use so that
we could easily bring things up and down when we wanted (and when we
upgrade the OS, we can probably bring that forward easily too.

If you'd like a copy of the script just let me know.. I'm not sure if we
really did it generically enough to apply to other distro's as well, but
it might have something usefull.

-Jeff

On Fri, 2006-04-28 at 16:12 -0400, Williams, John wrote:
> I have a situation where, after a reboot, the volumes that I created
> under LVM2 do not exist. Here is my configuration..
> 
>  
> 
>  
> 
> Kernel version 2.6.16.9
> 
> LVM version:     2.01.04 (2005-02-09)
> 
> Library version: 1.01.04 (2005-08-02)
> 
> Driver version:  4.5.0
> 
> Drbd version 0.7.17
> 
>  
> 
> I created a physical volume on /dev/md2 of my hard drive. I then
> created a volume group called rootvg. I then created several logical
> volumes, two of which are called drbdpv00 and drbdpv04. In the /dev
> directory I have device files drbd0 and drbd4 with a major number of
> 147.
> 
>  
> 
> My drbd.conf looks like this:
> 
>  
> 
>  
> 
> resource drbdpv00 {
> 
>     # use the synchronous protocol
> 
>     protocol C;
> 
>     startup {
> 
>         wfc-timeout 5;
> 
>         degr-wfc-timeout 120;
> 
>     }
> 
>     syncer {
> 
>         rate 20M;
> 
>         group 0;
> 
>     }
> 
>     on node1 {
> 
>         device /dev/drbd0;
> 
>         disk /dev/rootvg/drbdpv00;
> 
>         meta-disk /dev/rootvg/drbdmeta[0];
> 
>         address 192.168.0.171:7790;
> 
>     }
> 
>     on node2 {
> 
>         device /dev/drbd0;
> 
>         disk /dev/rootvg/drbdpv00;
> 
>         meta-disk /dev/rootvg/drbdmeta[0];
> 
>         address 192.168.0.172:7790;
> 
>     }
> 
>  
> 
>  
> 
> This should allow /dev/drbd0 and /dev/drbd4 to use actual disk space
> for creating volumes.
> 
>  
> 
>  
> 
> Node1 is up and working perfectly. This was an actual working linux
> cluster before a botched upgrade on node2, thus I had to rebuild it
> after it became unbootable.
> 
>  
> 
> On node2 I could not create a physical volume until I unhooked the
> crossover cable between the two nodes and made node2 primary. I would
> get a read only error. After making node2 primary, I was able to
> create the physical volumes on /dev/drbd0 and dev/drbd4 with no
> problem. I created volume groups and logical volumes under that
> physical volume. I rebooted node2 and when the machine came back up,
> the physical volumes were gone. Node2 was back in a secondary state as
> far as drbd was concerned, which I did expect. When the machine was
> rebooting, drbd came back up fine.
> 
>  
> 
> I would appreciate any help you could offer on this, as I am at wits
> end.
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> _______________________________________________
> drbd-user mailing list
> drbd-user at lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/drbd-user




More information about the drbd-user mailing list