<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Eric and list,</p>
    <p>I had another production VM start pausing itself.  This one had
      been running for more than 4 years on a 60G LVM volume.  It has
      had the occasional snapshot during that time though all have been
      "removed" using the virt-manager gui so I used qemu-img as you
      suggested.<br>
    </p>
    <p><tt># qemu-img convert /dev/trk-kvm-02-vg/rt44 -O qcow2
        /mnt/scratch/rt44.qcow2</tt><br>
    </p>
    <p>dd'd the qcow2 image back on to the LV after testing it boots OK
      directly from the image and it is in production again. <br>
    </p>
    <p>The VM itself reports ample space available:</p>
    <p> <tt>$ df -h</tt><tt><br>
      </tt><tt>Filesystem                       Size  Used Avail Use%
        Mounted on</tt><tt><br>
      </tt><tt>udev                             3.9G     0  3.9G   0%
        /dev</tt><tt><br>
      </tt><tt>tmpfs                            789M  8.8M  780M   2%
        /run</tt><tt><br>
      </tt><tt>/dev/mapper/RT--vg-root           51G   21G   28G  42% /</tt><tt><br>
      </tt><tt>tmpfs                            3.9G     0  3.9G   0%
        /dev/shm</tt><tt><br>
      </tt><tt>tmpfs                            5.0M     0  5.0M   0%
        /run/lock</tt><tt><br>
      </tt><tt>tmpfs                            3.9G     0  3.9G   0%
        /sys/fs/cgroup</tt><tt><br>
      </tt><tt>/dev/vda1                        472M  155M  293M  35%
        /boot</tt><tt><br>
      </tt><tt>192.168.0.16:/volume1/fileLevel  8.1T  2.5T  5.6T  31%
        /mnt/nfs/fileLevel</tt><tt><br>
      </tt><tt>tmpfs                            789M     0  789M   0%
        /run/user/1000</tt><br>
    </p>
    <p>I would prefer to not get caught out again with this machine
      pausing, how can I determine how much space is being used up by
      'deleted' internal snapshots?  Do you have any suggested reading
      on this?</p>
    <p>If I extend the LVM volume but not the guest file system will
      snapshots be "at the end" of the LV and "outside" the guest file
      system?</p>
    <p>If I were to expand the guest's ext4 file system I would want to
      do it unmounted and from a live CD but I'm having a heck of a time
      getting my live distro to use the virtio disk drivers.  Any advice
      there?</p>
    <p>sincerely<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" height="60" border="0" align="bottom"
            width="198">
        </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 2018-05-01 02:31 PM, Eric Blake
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:aa233c98-b041-d916-3f36-0ec4f6aa7741@redhat.com">On
      05/01/2018 04:17 PM, Paul O'Rorke wrote:
      <br>
      <blockquote type="cite">I have been using internal snapshots on
        production qcow2 images for a couple of years, admittedly as
        infrequently as possible with one exception and that exception
        has had multiple snapshots taken and removed using
        virt-manager's GUI.
        <br>
        <br>
        I was unaware of this:
        <br>
        <blockquote type="cite">There are some technical downsides to
          <br>
          internal snapshots IIUC, such as inability to free the space
          used by the
          <br>
          internal snapshot when it is deleted,
          <br>
        </blockquote>
      </blockquote>
      <br>
      This is not an insurmountable difficulty, just one that no one has
      spent time coding up.
      <br>
      <br>
      <blockquote type="cite">
        <br>
        This might explain why this VM recently kept going into a paused
        state and I had to extend the volume to get it to stay up.  This
        VM is used for testing our software in SharePoint and we make
        heavy use of snapshots.  Is there nothing I can to do recover
        that space?
        <br>
      </blockquote>
      <br>
      If you have no internal snapshots, you can do a 'qemu-img convert'
      to copy just the portion of the image that is actively in use; the
      copy will use less disk space than the original because it got rid
      of the now-unused space.  'virt-sparsify' from libguestfs takes
      this one step further, by also removing unused space within the
      guest filesystem itself.
      <br>
      <br>
      In fact, even if you do have internal snapshots, there is probably
      a sequence of 'qemu-img convert' invocations that can ultimately
      convert all of your internal snapshots into an external chain of
      snapshots; but I don't have a ready formula off-hand to point to
      (experiment on an image you don't care about, before doing it on
      your production image).
      <br>
      <br>
      <blockquote type="cite">What would be the best practice then for a
        VM that needs to be able to create and remove snapshots on a
        regular basis?
        <br>
      </blockquote>
      <br>
      In a managed environment, external snapshots probably have the
      most support for creating and later merging portions of a chain of
      snapshots, although we could still improve libvirt to make this
      feel like more of a first class citizen.
      <br>
      <br>
    </blockquote>
    <br>
  </body>
</html>