Using DRBD directly (without a file system)

Some applications require direct access to a block device, without an intermediate file system. Some Oracle and MySQL configurations are an example, as are some Xen setups, or IET. Can you do this with DRBD? Sure you can.

However, you need to fulfill two prerequisites:

  1. Your application can’t access DRBD while it’s in the Secondary role. So, you must make sure DRBD is Primary before your application attempts using that device.
  2. The user in whose context your application runs needs read/write access to that device.

Your cluster manager, when configured properly, normally takes care of item #1 for you. #2 is a little trickier:
Normally, DRBD’s device nodes are owned by root:disk, with permission bits set to 0660 (rw-rw----). So in order to allow your application to use the device, you have two options:

  • Add your application user to the disk group (or whatever group owns the /dev/drbd* devices in your preferred distribution)
  • Change your permissions as set by udev. There are a number of ways to do this, but my preferred way is to add a file in /etc/udev/rules.d, containing a rule that matches KERNEL=="drbd*" and sets OWNER, GROUP, and/or MODE as required.

When you’ve implemented this, as always, don’t forget to test, test, and test. No, one more time.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: