Linux: Resizing OCFS2/DRBD/LVM filesystem/volumes.

Recently I had to figure out how to resize an OCFS2 filesystem which used DRBD to synchronize the data to cluster members.  The DRBD devices are backed by LVM2 volumes.

To preform such a resize, the following conceptual steps are performed, in the following order:

  • (On each node) the LVM volumes are expanded.  This provides the space to expand the DRBD devices.
  • The DRBD devices are resized.
  • The OCFS2 filesystem is expanded.

If you have current versions of the software (OCFS2 v1.4.0+), this entire process can be performed online, in most cases.  Unfortunately, in my case, I could not perform the online resize since one of my nodes was down at the time I needed to expand the volume (DRBD will only allow online resizing if the nodes are in the "Connected" state).  However, I will cover both online and offline resizing in this article.