<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 15/7/21 20:40, Christophorus Reyhan
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMYEZgFUgHZ5TaakC4RkUOM=osUTYpUgR+H8Pi--pz8XmrpX7w@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">
              <div class="gmail_default" style="font-family:&quot;times
                new roman&quot;,serif">Hello,</div>
              <div class="gmail_default" style="font-family:&quot;times
                new roman&quot;,serif"><br>
              </div>
              <div class="gmail_default" style="font-family:&quot;times
                new roman&quot;,serif">I'm trying to shrink LVM backing
                block device offline because I use internal metadata,
                and I'm following this guide <a
href="https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/#s-shrinking-offline"
                  moz-do-not-send="true">https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/#s-shrinking-offline</a>
                . But it failed at create-md step. <br>
              </div>
              <div class="gmail_default" style="font-family:&quot;times
                new roman&quot;,serif"><br>
              </div>
              <div class="gmail_default" style="font-family:&quot;times
                new roman&quot;,serif"><b>Here's the log for first
                  machine (called ol1):</b></div>
              <div class="gmail_default">
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# e2fsck -f /dev/drbd0 </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">e2fsck 1.42.9 (28-Dec-2013)</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Pass 1: Checking inodes, blocks, and sizes</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Pass 2: Checking directory structure</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Pass 3: Checking directory connectivity</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Pass 4: Checking reference counts</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Pass 5: Checking group summary information</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">/dev/drbd0: 12/51200 files (0.0%
                    non-contiguous), 109774/204732 blocks</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# drbdadm status</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">test role:Primary</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">  disk:UpToDate</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">  ol2 role:Secondary</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">    peer-disk:UpToDate</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif"><br>
                  </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# resize2fs /dev/drbd0 180M</font></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <font face="times new roman, serif">So the filesystem inside your
      DRBD device is going to be 180M</font><br>
    <blockquote type="cite"
cite="mid:CAMYEZgFUgHZ5TaakC4RkUOM=osUTYpUgR+H8Pi--pz8XmrpX7w@mail.gmail.com">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">
              <div class="gmail_default">
                <div class="gmail_default"><font face="times new roman,
                    serif">resize2fs 1.42.9 (28-Dec-2013)</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Resizing the filesystem on /dev/drbd0 to
                    184320 (1k) blocks.</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">The filesystem on /dev/drbd0 is now 184320
                    blocks long.</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif"><br>
                  </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# drbdadm down test</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# drbdadm dump-md test &gt;
                    /tmp/metadata</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Found meta data is "unclean", please apply-al
                    first</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# drbdadm apply-al test </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# drbdadm dump-md test &gt;
                    /tmp/metadata</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# lvreduce -L 180M
                    /dev/mapper/vgdrbd-vol_drbd </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">  WARNING: Reducing active logical volume to
                    180.00 MiB.</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">  THIS MAY DESTROY YOUR DATA (filesystem
                    etc.)</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Do you really want to reduce vgdrbd/vol_drbd?
                    [y/n]: y</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">  Size of logical volume vgdrbd/vol_drbd
                    changed from 200.00 MiB (50 extents) to 180.00 MiB
                    (45 extents).</font></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <font face="times new roman, serif">Also, the size of the volume
      containing both your ext filesystem AND your DRBD data is going to
      be 180M.... </font><br>
    <blockquote type="cite"
cite="mid:CAMYEZgFUgHZ5TaakC4RkUOM=osUTYpUgR+H8Pi--pz8XmrpX7w@mail.gmail.com">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">
              <div class="gmail_default">
                <div class="gmail_default"><font face="times new roman,
                    serif">  Logical volume vgdrbd/vol_drbd successfully
                    resized.</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# vi /tmp/metadata </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# blockdev --getsz
                    /dev/mapper/vgdrbd-vol_drbd </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">368640</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# vi /tmp/metadata </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[root@ol1 drbd.d]# drbdadm create-md test
                    --max-peers=5</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">You want me to create a v09 style
                    flexible-size internal meta data block.</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">There appears to be a v09 flexible-size
                    internal meta data block</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">already in place on /dev/vgdrbd/vol_drbd at
                    byte offset 188739584</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif"><br>
                  </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Do you really want to overwrite the existing
                    meta-data?</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">[need to type 'yes' to confirm] yes</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif"><br>
                  </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">md_offset 188739584</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">al_offset 188706816</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">bm_offset 188674048</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif"><br>
                  </font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">Found ext3 filesystem</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">      184320 kB data area apparently used</font></div>
                <div class="gmail_default"><font face="times new roman,
                    serif">      184252 kB left usable by current
                    configuration</font></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <p><font face="times new roman, serif">As per the messages, there
        isn't enough space to preserve both your filesystem data AND add
        the DRBD data. Either resize your filesystem to 179M, resize the
        LV to 180M, and then after everything is working again, you can
        resize the filesystem to take all available space, and it should
        increase to 184252kB or 179.9+ MB</font></p>
    <p><font face="times new roman, serif">I'm pretty sure the DRBD
        manual has some details on how to calculate exactly how much
        space you will need to leave available for the DRBD metadata,
        but I usually just do the above (make the filesystem smaller
        than my target, and then after DRBD has been resized, increase
        the FS to take up any extra space).</font></p>
    <p><font face="times new roman, serif">Hope that helps...</font></p>
    <p><font face="times new roman, serif">Regards,<br>
        Adam<br>
      </font></p>
    <blockquote type="cite"
cite="mid:CAMYEZgFUgHZ5TaakC4RkUOM=osUTYpUgR+H8Pi--pz8XmrpX7w@mail.gmail.com"></blockquote>
  </body>
</html>