The DRBD is a kernel module that was merged with 2.6.33 version kernel on 8 December 2009. DRBD provides the data replication between two nodes at real time. I was experimenting with the DRBD and other HA applications and came to a situation in which I need to resize the DRBD device. I thought I will share that with others.
1. Resize the low level device first. In my case that is an LVM partition.
[root@ha2 ~]# lvextend -L+1G /dev/vg1/vps1
Extending logical volume vps1 to 5.00 GB
Logical volume vps1 successfully resized
Extending logical volume vps1 to 5.00 GB
Logical volume vps1 successfully resized
You need to do that at both the nodes.
2. Resize the DRBD device.
[root@ha2 ~]# drbdadm resize r1
I executed that command at the node where the DRBD is running as primary device.
3. Resize the file system on the DRBD device.
[root@ha2 ~]# resize2fs /dev/drbd1
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/drbd1 is mounted on /vps/vps1;
on-line resizing required
Performing an on-line resize of /dev/drbd1 to 1310671
(4k) blocks.
The filesystem on /dev/drbd1 is now 1310671 blocks long.
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/drbd1 is mounted on /vps/vps1;
on-line resizing required
Performing an on-line resize of /dev/drbd1 to 1310671
(4k) blocks.
The filesystem on /dev/drbd1 is now 1310671 blocks long.
That was done at the node where the DRBD is at primary role.
After finishing those steps. You can see increase in the DRBD size.
[root@ha2 ~]# df -h | grep drbd
/dev/drbd1 5.0G 607M 4.1G 13% /vps/vps1
/dev/drbd1 5.0G 607M 4.1G 13% /vps/vps1








Keep posting stuff like this i really like it
Great information! I’ve been looking for something like this for a while now. Thanks!
Good fill someone in on and this enter helped me alot in my college assignement. Thank you as your information.
This a truly great post and may be one that you should followed up to see how things go
Discovered your site via yahoo the other day and absolutely like it so much. Continue the fantastic work.
thanks for the post. just one question, is it normal that drbd does a sync on the secondary node ? what about this status ?
ns:224207444 nr:112 dw:222541360 dr:738494193 al:60755 bm:105 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:101553696
[>....................] sync’ed: 3.2% (99172/102396)M delay_probe: 0
finish: 1:49:54 speed: 15,200 (20,248) K/sec
Thanks
Yes, DRDB will sync the data to the slave after the first setup and also after changing anything.