Configuring NFS exports for Heartbeat integration

Okay, now we have our DRBD up and running. Great!! Next step is to set up out NFS export and then install heartbeat so we can have an automatic fail over system.

Lets prepare our NFS first:

On both servers:

# mkdir /drbd

# vi /etc/exports

/drbd/main *(rw)

On server1 only :

# mount /dev/drbd0 /drbd

# mkdir /drbd/main

NFS stores some information about your NFS mounts at /var/lib/nfs and since those information will have to be mirrored we will have to move them to the DRBD device:

# mv /var/lib/nfs/ /drbd/

this might generate an error such as:

mv: cannot remove `/var/lib/nfs/rpc_pipefs/cache': Operation not permitted

mv: cannot remove `/var/lib/nfs/rpc_pipefs/nfsd4_cb': Operation not permitted

mv: cannot remove `/var/lib/nfs/rpc_pipefs/statd': Operation not permitted

mv: cannot remove `/var/lib/nfs/rpc_pipefs/portmap': Operation not permitted

mv: cannot remove `/var/lib/nfs/rpc_pipefs/nfs': Operation not permitted

mv: cannot remove `/var/lib/nfs/rpc_pipefs/mount': Operation not permitted

mv: cannot remove `/var/lib/nfs/rpc_pipefs/lockd': Operation not permitted

but do not worry about it because it will create the directories anyways.

# mv /var/lib/nfs /var/lib/nfsBackup

Then symlink /var/lib/nfs to our /drbd directory:

# ln -s /drbd/nfs/ /var/lib/nfs

# umount /drbd

On server2 only:

# mv /var/lib/nfs/ /var/lib/nfsBackup

# ln -s /drbd/nfs/ /var/lib/nfs

The symbolic link will be broken since the /dev/drbd0 is not mounted. This will work in case of NFS fail-over.

Be the First to Comment!