If a resource uses a shared device, all information should be present in /etc/ha.d/haresources to specify how this device should be loaded. For this purpose, you can use two scripts, which are both in the subdirectory /etc/ha.d/resource.d.
Note From haresources, you can refer to scripts at two different locations. The scripts may be stored in /etc/init.d or in /etc/ha.d/resource.d. Both types of scripts are in a syntax that is understood by Heartbeat natively.
The first of these scripts is the script with the name datadisk (which actually is a link to the drbddisk script). This script has an important task: it activates the DRBD device on the host where the resources will be loaded. While loading the DRBD device on this host, the datadisk script will make it the primary device on this host. In this way, the other host cannot write to the DRBD device, and all data written to the device will be synchronized immediately to the other node. In the line where the shared resource is defined, you see that the datadisk script takes one argument, which is the name of the DRBD device. To separate the name of the script from the names of its arguments, use two colons.
After specifying what device is used as the shared storage, next the resource load script needs to define how that device is to be activated. Note that this task has to be connected to the loading of the resource on a server and cannot occur in /etc/fstab; if it were handled in /etc/fstab, it would be impossible to migrate the shared device from one node to the other. To mount the shared device, the Filesystem script (notice the capital F!), which is in /etc/ha.d/resource.d, is used. This script takes three parameters when called from haresources: the complete device name of the shared device, the directory on which the shared device must be loaded, and finally the name of the file system that must be used to mount the device. Here also, the script is separated from its arguments by using two colons, as shown in the previous example.
Was this article helpful?