Debian DRBD: How to resize drbd and OCFS2 online

root's picture

So, we need to increase the following OCFS2 partition which sits on a drbd volume (which sits on lvm2 volume).
The grow steps have to be taken in the right order: lvm2, drbd and ocfs2.

This tutorial comes in text (below) and in youtube video (also below).
Enjoy ;)

1. Increase LVM partition on ALL NODES

Command: lvresize -L+20G /dev/dockervg/data

22:24:07 root@sonic:~# df -h /docker/DATA
Filesystem      Size  Used Avail Use% Mounted on
/dev/drbd0      100G   92G  8.3G  92% /docker/DATA
22:24:58 root@sonic:~# lvscan | grep data
  ACTIVE            '/dev/dockervg/data' [100.00 GiB] inherit
22:25:12 root@sonic:~# pvscan | grep dockervg
  PV /dev/sdb1   VG dockervg        lvm2 [150.00 GiB / 34.50 GiB free]
22:26:16 root@sonic:~# lvresize -L+20G /dev/dockervg/data
  Size of logical volume dockervg/data changed from 100.00 GiB (25600 extents) to 120.00 GiB (30720 extents).
  Logical volume dockervg/data successfully resized.
22:26:26 root@sonic:~# lvscan | grep data
  ACTIVE            '/dev/dockervg/data' [120.00 GiB] inherit
22:15:39 root@jupiter:~# lvscan | grep data
  ACTIVE            '/dev/dockervg/data' [100.00 GiB] inherit
22:15:49 root@jupiter:~# pvscan | grep dockervg
  PV /dev/sdb1   VG dockervg        lvm2 [150.00 GiB / 29.50 GiB free]
  Total: 3 [179.75 GiB] / in use: 3 [179.75 GiB] / in no VG: 0 [0   ]
22:15:54 root@jupiter:~# lvresize -L+20G /dev/dockervg/data
  Size of logical volume dockervg/data changed from 100.00 GiB (25600 extents) to 120.00 GiB (30720 extents).
  Logical volume dockervg/data successfully resized.
22:16:09 root@jupiter:~# lvscan | grep data
  ACTIVE            '/dev/dockervg/data' [120.00 GiB] inherit

2. Increase DRBD partition on ONE NODE

Command: drbdadm resize dockerdata

22:27:30 root@sonic:~# drbdadm resize dockerdata
22:27:58 root@sonic:~# cat /proc/drbd
version: 8.4.7 (api:1/proto:86-101)
srcversion: F9342B04878A5D3C98CAB6D 
 0: cs:SyncSource ro:Primary/Primary ds:UpToDate/Inconsistent C r-----
    ns:28664141 nr:85711265 dw:114213910 dr:169548504 al:14361 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:d oos:20962160
	[>....................] sync'ed:  0.1% (20468/20480)M
	finish: 3:01:57 speed: 1,872 (1,872) K/sec

As you can see, sync started so you will have to wait for it to finish.

07:21:13 root@sonic:~# cat /proc/drbd
version: 8.4.7 (api:1/proto:86-101)
srcversion: F9342B04878A5D3C98CAB6D 
 0: cs:Connected ro:Primary/Primary ds:UpToDate/UpToDate C r-----
    ns:49740791 nr:87059269 dw:115676404 dr:194735194 al:14390 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:d oos:0

3. Increase OCFS2 filesystemon ONE NODE

Command: tunefs.ocfs2 -S /dev/drbd0

08:08:26 root@sonic:~# df -h /docker/DATA
Filesystem      Size  Used Avail Use% Mounted on
/dev/drbd0      100G   92G  8.2G  92% /docker/DATA
08:08:53 root@sonic:~# tunefs.ocfs2 -S /dev/drbd0
08:09:08 root@sonic:~# df -h /docker/DATA
Filesystem      Size  Used Avail Use% Mounted on
/dev/drbd0      120G   92G   29G  77% /docker/DATA
08:05:22 root@jupiter:~# df -h /docker/DATA
Filesystem      Size  Used Avail Use% Mounted on
/dev/drbd0      120G   92G   29G  77% /docker/DATA

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.