<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Snapshot on inetshell</title><link>https://inet.sh/en/tags/snapshot/</link><description>Recent content in Snapshot on inetshell</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 25 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://inet.sh/en/tags/snapshot/index.xml" rel="self" type="application/rss+xml"/><item><title>Proxmox: VM is locked (snapshot-delete), cannot remove the snapshot</title><link>https://inet.sh/en/posts/proxmox/vm-is-locked-snapshot-delete/</link><pubDate>Fri, 25 Sep 2026 00:00:00 +0000</pubDate><guid>https://inet.sh/en/posts/proxmox/vm-is-locked-snapshot-delete/</guid><description>A Proxmox VE snapshot that will not delete and leaves the VM with &amp;#39;VM is locked (snapshot-delete)&amp;#39;: qm unlock, qm delsnapshot --force, cleaning the orphaned snapshot on ZFS, LVM-thin, Ceph or qcow2, and editing the .conf by hand if needed. Same for LXC with pct.</description><content:encoded><![CDATA[<h2 id="tldr">TL;DR</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">qm unlock <span class="m">102</span>
</span></span><span class="line"><span class="cl">qm delsnapshot <span class="m">102</span> initial_snapshot --force
</span></span></code></pre></td></tr></table>
</div>
</div><p><code>--force</code> removes the snapshot from the configuration file even if the disk snapshot no longer exists or fails to delete. For containers it is the same with <code>pct unlock</code> and <code>pct delsnapshot 102 &lt;name&gt; --force</code>.</p>
<h2 id="the-error">The error</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">TASK ERROR: VM is locked (snapshot-delete)
</span></span></code></pre></td></tr></table>
</div>
</div><p>And if you look at the previous attempt in the task log, the underlying failure is usually that the storage no longer has that snapshot:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">could not find any snapshots to destroy; check snapshot names.      # ZFS
</span></span><span class="line"><span class="cl">Failed to find logical volume &#34;pve/snap_vm-102-disk-0_initial_snapshot&#34;   # LVM-thin
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="why-it-happens">Why it happens</h2>
<p>Deleting a snapshot is two steps: first the snapshot of each disk is destroyed on the storage (<code>zfs destroy</code>, <code>lvremove</code>, <code>rbd snap rm</code>, internal qcow2 snapshot), then the <code>[name]</code> section is removed from <code>/etc/pve/qemu-server/102.conf</code>. Meanwhile Proxmox writes <code>lock: snapshot-delete</code> into that file.</p>
<p>If the first step fails, the lock stays and every retry dies at the same point. Typical causes:</p>
<ul>
<li>Someone removed the snapshot on the storage from outside (<code>zfs destroy</code>, a replication or pruning policy).</li>
<li>The task was interrupted (node reboot, storage that dropped halfway).</li>
<li>The disk was moved to another storage and the snapshot stayed on the old one.</li>
</ul>
<h2 id="procedure">Procedure</h2>
<ol>
<li>
<p>Confirm there is no live task for that VM: in the GUI, the node&rsquo;s <strong>Tasks</strong>, the delete task must be finished or failed. A <code>qm unlock</code> while the task is running can corrupt the snapshot.</p>
</li>
<li>
<p>Remove the lock and force the delete:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">qm unlock <span class="m">102</span>
</span></span><span class="line"><span class="cl">qm listsnapshot <span class="m">102</span>
</span></span><span class="line"><span class="cl">qm delsnapshot <span class="m">102</span> initial_snapshot --force
</span></span></code></pre></td></tr></table>
</div>
</div></li>
<li>
<p>Check the config: no <code>lock:</code> and no snapshot section.</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">grep -nE <span class="s1">&#39;^(lock:|\[|parent:)&#39;</span> /etc/pve/qemu-server/102.conf
</span></span></code></pre></td></tr></table>
</div>
</div></li>
<li>
<p>Clean whatever is left on the storage (space that does not free itself):</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># ZFS</span>
</span></span><span class="line"><span class="cl">zfs list -t snapshot -r rpool/data <span class="p">|</span> grep vm-102
</span></span><span class="line"><span class="cl">zfs destroy rpool/data/vm-102-disk-0@initial_snapshot
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># LVM-thin</span>
</span></span><span class="line"><span class="cl">lvs <span class="p">|</span> grep snap_vm-102
</span></span><span class="line"><span class="cl">lvremove pve/snap_vm-102-disk-0_initial_snapshot
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Ceph RBD</span>
</span></span><span class="line"><span class="cl">rbd snap ls cephpool/vm-102-disk-0
</span></span><span class="line"><span class="cl">rbd snap rm cephpool/vm-102-disk-0@initial_snapshot
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># qcow2 on a directory or NFS (VM powered off)</span>
</span></span><span class="line"><span class="cl">qemu-img snapshot -l /var/lib/vz/images/102/vm-102-disk-0.qcow2
</span></span><span class="line"><span class="cl">qemu-img snapshot -d initial_snapshot /var/lib/vz/images/102/vm-102-disk-0.qcow2
</span></span></code></pre></td></tr></table>
</div>
</div><p>If the snapshot included RAM there is also a <code>vm-102-state-initial_snapshot</code> volume on the same storage; <code>--force</code> tries to delete it, and if it could not, remove it by hand.</p>
</li>
</ol>
<h2 id="plan-b-edit-the-conf">Plan B: edit the .conf</h2>
<p>If it will not go even with <code>--force</code>, Proxmox staff themselves say the file can be edited by hand. In <code>/etc/pve/qemu-server/102.conf</code>:</p>
<ol>
<li>Delete the <code>lock: snapshot-delete</code> line.</li>
<li>Delete the whole snapshot section: from <code>[initial_snapshot]</code> to the next <code>[...]</code> header or the end of the file.</li>
<li>If another section (the current one or a child snapshot) has <code>parent: initial_snapshot</code>, remove that line or point it at the grandparent if there was a chain.</li>
</ol>
<p>Save, and <code>qm config 102</code> must answer without complaints. Then the storage cleanup from step 4.</p>
<h2 id="other-locks">Other locks</h2>
<p><code>qm unlock</code> works for any lock left hanging; the rule is the same: first confirm the task that set it is dead.</p>
<table>
  <thead>
      <tr>
          <th><code>lock:</code></th>
          <th>Set by</th>
          <th>Before unlocking</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>backup</code></td>
          <td>vzdump</td>
          <td><code>ps aux | grep vzdump</code>; a slow backup to NFS looks stuck and is not</td>
      </tr>
      <tr>
          <td><code>snapshot</code></td>
          <td>snapshot creation</td>
          <td>The task under Tasks must be finished</td>
      </tr>
      <tr>
          <td><code>snapshot-delete</code></td>
          <td>snapshot deletion</td>
          <td>This post</td>
      </tr>
      <tr>
          <td><code>clone</code>, <code>migrate</code>, <code>rollback</code></td>
          <td>the matching operation</td>
          <td>Check it is not still running on the target node</td>
      </tr>
  </tbody>
</table>
<h2 id="traps">Traps</h2>
<ul>
<li><strong><code>qm</code> is per node.</strong> In a cluster, run everything on the node where the VM lives; the <code>.conf</code> is shared, but ZFS/LVM cleanup is local.</li>
<li><strong>A ZFS <code>hold</code></strong> blocks <code>zfs destroy</code> and triggers exactly this scenario; check with <code>zfs holds</code> before blaming Proxmox. Details in <a href="/en/posts/zfs/hold-protect-snapshot/">protect a snapshot with hold</a>.</li>
<li><strong>Space does not come back on its own.</strong> <code>--force</code> cleans the config, not the storage; step 4 is not optional if you care about the space.</li>
</ul>
<p>References: Proxmox forum threads <a href="https://forum.proxmox.com/threads/cannot-remove-snapshot-vm-is-locked-snapshot-delete.37567/">37567</a> and <a href="https://forum.proxmox.com/threads/removing-snapshots-not-possible.38248/">38248</a>.</p>
]]></content:encoded></item></channel></rss>