[DRBD-user] how to shrink a DRBD partition?

Amos Shapira amos.shapira at gmail.com
Mon Dec 10 18:02:07 CET 2007

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


On 10/12/2007, Florian Haas <florian.haas at linbit.com> wrote:
> On Monday 10 December 2007 13:38:16 Amos Shapira wrote:
> > I found about "drbdadm resize" but it doesn't seem to make any effect on
> > drbd.
>
> "drbdadm resize" should really be renamed "drbdadm enlarge" or "drbdadm
> extend"; it doesn't reduce.
>
> Your recommended approach for shrinking a DRBD device is this:

I did almost everything you said:

> 1. drbdadm down <resource> (on both nodes)

check.

> 2. Shrink filesystem on underlying volume (on one node)

check (actually shrunk on both because I wasn't sure)

> 3. Shrink LV's (on both nodes)

check

> 4. Re-create DRBD meta data, drbdadm create-md <resource> (both nodes)

check

> 5. drbdadm up <resource> (both nodes)

check.

> 6. drbdadm -- --overwrite-data-of-peer primary <resource> (on node where you
> shrunk the file system)

Here I was afraid to do the "--overwrite-data-of-peer" because it said
that the local node is "inconsistent" on both nodes, but it WORKED
once I did as you said:

[root at drbd01 ~]# cat /proc/drbd
version: 8.0.6 (api:86/proto:86)
SVN Revision: 3048 build by buildsvn at c5-x8664-build, 2007-10-25 06:25:16

 1: cs:WFConnection st:Secondary/Unknown ds:Inconsistent/DUnknown C r---
    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
        resync: used:0/31 hits:0 misses:0 starving:0 dirty:0 changed:0
        act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0
[root at drbd01 ~]# drbdadm -- --overwrite-data-of-peer primary drbd1
[root at drbd01 ~]# cat /proc/drbd
version: 8.0.6 (api:86/proto:86)
SVN Revision: 3048 build by buildsvn at c5-x8664-build, 2007-10-25 06:25:16

 1: cs:WFConnection st:Primary/Unknown ds:UpToDate/DUnknown C r---
    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
        resync: used:0/31 hits:0 misses:0 starving:0 dirty:0 changed:0
        act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0
[root at drbd01 ~]# drbdadm restart
Restarting all DRBD resources.

That last restart maybe was premature but I did it because it was
still in WFConnection after the last "drbdadm" call and after it I got
an initial sync running:

[root at drbd01 ~]# cat /proc/drbd
version: 8.0.6 (api:86/proto:86)
SVN Revision: 3048 build by buildsvn at c5-x8664-build, 2007-10-25 06:25:16

 1: cs:SyncSource st:Secondary/Secondary ds:UpToDate/Inconsistent C r---
    ns:169952 nr:0 dw:0 dr:177952 al:0 bm:9 lo:49 pe:864 ua:2047 ap:0
        [==>.................] sync'ed: 11.0% (1406368/1572864)K
        finish: 0:00:50 speed: 27,748 (27,748) K/sec
        resync: used:1/31 hits:86148 misses:11 starving:0 dirty:0 changed:11
        act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0

And now everything is dandy.

> Hope this helps.

It did.

Thanks very much for everything!

Cheers,

--Amos



More information about the drbd-user mailing list