Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.
On Thu, Jun 21, 2012 at 06:05:00PM +0800, Lyre wrote: > Hi: > > I have two box with drbds build on lvm. At the very beginning, box A > as primary & box B as secondary. > > box A crashed while doing background sync from A to B, then I do a > lvm merge to rollback the drbds on B to an consistent status and > bring up the disk. > > After box A recover, is it safe to discard data (drbdadm -- > --discard-my-data ) on box A , so that I cant resync from box B (new > primary) to box A(new secondary) ? or should I do a full sync ? > > And what about discard data on box B? I need to make a few assumptions here. Your before-resync-target handler took a snapshot on B below DRBD before that resync. You decided to "roll back", do a snapshot merge, which also happens below DRBD. Then you made this DRBD primary. When you reconnect a recoverd A and B, you will need to do a full sync. Rolling back to the before-resync-target safety snapshot on B is to be used only as a last resort, if you determine that the good copy on crashed A is lost, in which case you'd need to setup a new A, and need a full sync anyways. As I understand your timeline: Normal operation, UpToDate/UpToDate A0 -- B0 Disconnect A0| B0 A continues to modify data A1| B0 Reconnect, B takes a snapthot, then starts the resync, while A is still modifying data. A2 - B-SyncTarget, snap: B0==A0 Crash of A during resync, while A was still being modified A3 - B-SyncTarget, B0==A0 A3: crashed, but actually the UpToDate good data. B-SyncTarget: inconsistent, half recent and good, half old data. B0: old consistent data, from when the first disconnect happened. DRBD has a bitmap of differing blocks A3 vs B-SyncTarget. You now roll back to B0 == A0, old consistent data before the first disconnect. DRBD does not have bitmap information tracking differing blocks between A3 and B0 ... Thus you will need a full sync. If you have in-depth understanding of both lvm snapshots and DRBD, you could create a bitmap before the snapshot merge that should be good enough to do a bitmap base resync later, after some DRBD meta data maniplulation. I'd only go there if absolutely necessary. Depending on wether you have internal or external meta data, and what exactly happened, DRBD may or may not be able to detect that it needs the full sync on its own, but it will likely to refuse to be connected without --discard-my-data on A. I'd suggest to "invalidate" A while being disconnected, or even re-create the drbd meta data on A, before connecting it to B. -- : Lars Ellenberg : LINBIT | Your Way to High Availability : DRBD/HA support and consulting http://www.linbit.com