I have two CentOS7 VMs in Primary/Secondary state.
My goal is to increase DRBD block size.

for that I did these steps:
1. added new HD.
2. created new Partition with fdisk - formatted as LVM (/dev/sdc1)
3. added the new partition to vg:
vgextend vg_DRBD /dev/sdc1
4. increased lv:
lvresize -l +2559 /dev/vg_DRBD/lv_DRBD /dev/sdc1

[root@localhost]# pvs
  PV         VG             Fmt  Attr PSize  PFree
  /dev/sdb1  vg_DRBD lvm2 a--  10.00g    0
  /dev/sdc1  vg_DRBD lvm2 a--  10.00g    0 

[root@localhost admin]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_DRBD/lv_DRBD
  LV Name                lv_DRBD
  VG Name                vg_DRBD
  LV Write Access        read/write
  LV Creation host, time localhost, 2017-02-26 15:49:05 +0000
  LV Status              available
  # open                 2
  LV Size                19.99 GiB
  Current LE             5118
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

after I checked that indeed LV has grown I continued.
5.resize drbd block on one node:
drbdadm resize r0

    [root@localhost admin]# drbd-overview  
0:r0/0  Connected Primary/Secondary UpToDate/UpToDate /drbd_data ext4 9.9G 338M 9.0G 4%

from this output I realized that the DRBD block didn't grow.
so I tried to update filesystem:
6. update filesystem, run on the primary node:

 [root@localhost admin]# resize2fs /dev/vg_DRBD/lv_DRBD
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Device or resource busy while trying to open /dev/vg_DRBD/lv_DRBD
Couldn't find valid filesystem superblock.

I get the error above, that says the resouce is busy.
So I run this on the secondary node and I get the same error. but nothing use it!
I read this problem happens sometimes if there is an error with the filesystem, I tried to fix it and destroy the filesystem (like change permissions to ???) so I returned the snapshot back.

I want to increase the block Online without any data loss, do you have any idea what I'm doing wrong?

Thank you,

  • If resizing from the Primary doesn't work, the DRBD configuration might be helpful. – Matt Kereczman Mar 17 '17 at 16:43
  • can you be more specific when you write DRBD configuration please? – Bar Mar 20 '17 at 12:09
  • /etc/drbd.d/*.res and /etc/drbd.d/global_common.conf – Matt Kereczman Mar 20 '17 at 21:08

It solved!

I have service which use drbd to store data.
My first goal was to increase drbd size while keep this service alive.
Unfortunately I needed to stop this service and afterward did the above in my question while changing /dev/vg_DRBD/lv_DRBD to /dev/drbd0.

@Matt Kereczman thank you!!


First: You should NEVER touch the backing disk of a DRBD device (meaning, don't grow fs on your backing LVM, only grow the FS on /dev/drbd0). Otherwise, you're going to make changes to the data that aren't replicated to the peer, which will definitely come back to bite you.

To correct any damage that may have already been done, you can run: # drbdadm verify r0. See the DRBD user's guide for more details on that. https://docs.linbit.com/doc/users-guide-84/s-use-online-verify/

Second: Please try growing your device from the node in the Primary role. Also, watch the logs generated while doing this (/var/log/messages) for any clues as to why it might be failing, but you should see it begin resyncing the new 10G.

Then run your resize2fs on /dev/drbd0.

  • when try resizing, the output of the log was : EXT4-fs warning (device drbd0): ext4_resize_begin:44: There are errors in the filesystem, so online resizing is not allowed . something that I've already knew, if you have any more suggestions I'll be glad, thank you :) – Bar Mar 20 '17 at 12:22
  • maybe run fsck /dev/drbd0 to clean up those errors – Matt Kereczman Mar 24 '17 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.