<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Well (ironically?) you have me wondering if my approach may have
      issues I simply have not encountered, possibly due to good luck,
      so I am interested in hearing from others whether I should
      reconsider my approach...</p>
    <p>I received a lot of invaluable help from the list, and in
      particualr one very helpful gentleman named Simon Ironside back in
      2013 when I initially set this up.  Thanks again Simon if you are
      still on this list.:
      <blockquote type="cite">On 23/07/2013 18:11, Charles Lyons -
        ConnetU wrote:
        <br>
        <br>
        <blockquote type="cite" style="color: #000000;">If we snapshot
          the LV itself, presumably we'll get a copy not only of
          <br>
          the VM's volume block data but also of DRBD metadata on the LV
          (which I
          <br>
          understand is stored in the end/final segment(s) of the LV).
          <br>
        </blockquote>
        <br>
        Yes, assuming you are using internal metadata. I'm doing exactly
        this too.
        <br>
        <br>
        <blockquote type="cite" style="color: #000000;">(1) Is there any
          danger of this process not giving a DRBD-consistent
          <br>
          snapshot? Is there anything within DRBD which needs to be
          flushed/synced
          <br>
          prior to starting the snapshot (as is the practice with SQL)?
          <br>
        </blockquote>
        <br>
        I've found it to be 100% reliable, it worked absolutely fine
        when I really needed it.
        <br>
        <br>
        <blockquote type="cite" style="color: #000000;">(2) How is best
          to restore an image file of the LV, assuming the VM is
          <br>
          offline and, if necessary, the DRBD resource can be
          <br>
          detached/disconnected on each/both side(s)?
          <br>
        </blockquote>
        <br>
        I treat it more or less like a new resource. I do the below,
        this works but is perhaps OTT:
        <br>
        <br>
        # Shutdown the VM
        <br>
        drbdadm secondary &lt;resource&gt; # on the primary node
        <br>
        drbdadm down &lt;resource&gt;    # on both nodes
        <br>
        # Restore the LV image to the LV on one node
        <br>
        drbdadm create-md &lt;resource&gt; # on both nodes
        <br>
        drbdadm up &lt;resource&gt; # on both nodes
        <br>
        drbdadm -- -o primary &lt;resource&gt; # on the node I restored
        <br>
        # Start the VM
        <br>
        <br>
        Because you have new metadata on both nodes, there will be a
        full resync doing the above.
        <br>
        <br>
        I suppose, but have not tried and proven, that this could be
        simplified by just doing:
        <br>
        <br>
        # Shutdown the VM
        <br>
        # Restore the LV image to the DRBD resource in primary role.
        <br>
        # Start the VM
        <br>
        <br>
        The LV image will of course be longer than the DRBD resource but
        the extra is the metadata at the end of the volume which we're
        not interested in anyway. Because you write to the DRBD resource
        rather than the underlying LV, the sync to the secondary is
        already happening during your restore.
        <br>
        <br>
        <blockquote type="cite" style="color: #000000;">(3) Presumably
          it doesn't matter if the snapshot is taken on the primary
          <br>
          or secondary?
          <br>
        </blockquote>
        <br>
        With protocol C, it doesn't matter.
        <br>
        <br>
        <blockquote type="cite" style="color: #000000;">Second related
          topic: if we've got an existing snapshot, can we use this
          <br>
          as the basis for creating a totally new DRBD resource... i.e.
          creating a
          <br>
          new LV of identical size, dd the image to the LV and then
          create a new
          <br>
          DRBD resource on top. Is there anything in the metadata (like
          global
          <br>
          UUIDs) which could be duplicated and confuse DRBD? If so, is
          there a
          <br>
          recommended way to "reset" the metadata prior to attaching so
          it will
          <br>
          appear as a totally new pre-seeded volume?
          <br>
        </blockquote>
        <br>
        Yes, using the method I described above (drbdadm create-md
        &lt;resource&gt;) you'll have fresh metadata on both sides.
        You'll be prompted before it overwrites the existing metadata.
        <br>
        <br>
        HTH,
        <br>
        Simon
      </blockquote>
    </p>
    <p>I have not had to do more than 3 or 4 restores of production
      servers since then and in each case took the simple road:</p>
    <p># Shutdown the VM
      <br>
      # Restore the LV image to the DRBD resource in primary role.
      [I use DD for this]<br>
      # Start the VM <br>
    </p>
    <p>I have even had success restoring directly to the primary,
      snapshots of running machines.  Perhaps I have just been lucky. 
      The restore includes the internal metadata as it was when the
      snapshot was taken and I am writing to the upper DRBD device and
      it gets replicated as I write it.  Now I realize I don't really
      appreciate the potential risks in that.</p>
    <p>Can anyone with a more in depth knowledge comment on this?  <br>
    </p>
    <div class="moz-signature">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <title></title>
      <p><b>Paul O'Rorke</b><br>
        <b>Tracker Software Products (Canada) Limited </b><br>
        <a href="http://www.tracker-software.com/">www.tracker-software.com</a><br>
        Tel:
        +1 (250) 324 1621<br>
        Fax: +1 (250) 324 1623<br>
        <br>
        <a href="http://www.tracker-software.com/"> <img
src="https://www.tracker-software.com/fckfiles/image/images/resellers/logo/TrackerSofwareProducts_Logo_330x100.png"
            name="image.png" width="198" height="60" border="0"
            align="bottom">
        </a>
        <br>
        <br>
        Support:
        <br>
        <a href="http://www.tracker-software.com/support">http://www.tracker-software.com/support
        </a><br>
        Download latest Releases
        <br>
        <a href="http://www.tracker-software.com/downloads/">http://www.tracker-software.com/downloads/</a></p>
      <p><br>
        <br>
      </p>
      <p style="margin-bottom: 0cm; line-height: 100%"><br>
      </p>
    </div>
    <div class="moz-cite-prefix">On 2020-01-29 12:14 a.m., d tbsky
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAC6SzHJHrPiXB70bY25mNy62Pwb+vf+9owLceEQ-wbYoxOTw3Q@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">Paul O'Rorke &lt;<a
              href="mailto:paul@tracker-software.com"
              moz-do-not-send="true">paul@tracker-software.com</a>&gt;<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            <div>
              <p>I don't know what others do, I just do essentially what
                you said, but without stopping the DRBD service.  I
                simply restore the snapshot to the primary DRBD block
                device, not the backing device and let DRBD do it's
                magic in the background.</p>
              <p> </p>
            </div>
          </blockquote>
          <div> </div>
          <div>   thanks a lot for your hint. with lvm under drbd, I
            think it's not easy to restore the snapshot directly to
            drbd. unless I dd the snapshot to drbd?  but it's not
            efficient. what's you method to restore snapshot to drbd?<br>
          </div>
          <div> </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>