modified: content/2025-10-10-unpotato-webwords-btrfs-cleanup-docker-volumes.rst

This commit is contained in:
Russell Ballestrini 2025-10-12 16:08:58 -04:00
parent 3af4d986a1
commit be6e8c4e78

View file

@ -82,18 +82,68 @@ Wait for async deletion to complete:
sudo btrfs subvolume sync /var/lib/docker
nuclear option
==============
the nuclear option (that actually worked)
=========================================
If manual cleanup doesn't work, stop Docker and remove everything:
After running unpotato, Docker's metadata became corrupted with references to missing BTRFS subvolumes. Simple restarts and partial cleanups failed with errors like:
.. code-block:: bash
failed to register layer: stat /var/lib/docker/btrfs/subvolumes/53a19da3801c895b697625094ebc8f95668a212a4cbc923787ac0c86452d9f60: no such file or directory
The root cause: Docker's image metadata and containerd's content store still referenced layers that no longer existed in BTRFS.
**Partial cleanup attempts that failed:**
.. code-block:: bash
# These didn't fix the corruption:
sudo systemctl restart docker
sudo rm -rf /var/lib/docker/image/btrfs/layerdb/*
sudo rm -rf /var/lib/containerd/io.containerd.content.v1.content/*
**The only solution that worked:**
Complete reset of both Docker and containerd data stores:
.. code-block:: bash
sudo systemctl stop docker
sudo rm -rf /var/lib/docker
sudo systemctl stop containerd
sudo rm -rf /var/lib/docker/*
sudo rm -rf /var/lib/containerd/*
sudo systemctl start containerd
sudo systemctl start docker
This will delete all Docker data including images, containers, and volumes.
This deletes all Docker data including images, containers, volumes, and networks. But it's the only way to recover from corrupted layer metadata after aggressive BTRFS cleanup.
**Automation script:**
.. code-block:: bash
#!/bin/bash
# fix-docker-btrfs.sh - Nuclear reset for corrupted Docker BTRFS
set -e
echo "Stopping Docker daemon..."
systemctl stop docker
echo "Stopping containerd..."
systemctl stop containerd
echo "Removing all Docker btrfs data..."
rm -rf /var/lib/docker/*
echo "Removing all containerd data..."
rm -rf /var/lib/containerd/*
echo "Starting containerd..."
systemctl start containerd
echo "Starting Docker daemon..."
systemctl start docker
echo "Done! Docker has been completely reset."
.. image:: /uploads/2025/10/unpotato.jpg
:alt: unpotato