Cri File System Tools Link < TOP >
# Get container PID crictl inspect <container> | grep pid nsenter -t <pid> -m bash Inside, check for broken symlinks find / -type l -xtype l 2>/dev/null
Every time you run a container, remember: that root filesystem is an elegant chain of links. When a container starts, the runtime resolves a series of snapshots, binds them with overlayfs, and presents a unified tree. When storage fails, it is often a broken or misdirected link. cri file system tools link
systemctl stop containerd mv /var/lib/containerd /mnt/new-disk/containerd ln -s /mnt/new-disk/containerd /var/lib/containerd systemctl start containerd Ensure the link is absolute and permissions (owner root:root , mode 0755 ) match. Advanced: Manipulating CRI Snapshots with Hard Links for Fast Cloning Hard links are not just for files—they can be used at the directory level (via cp -al ) to create instant clones of container root filesystems without copying data. This is a powerful technique when you need multiple copies of a snapshot for testing. # Get container PID crictl inspect <container> |
If your cluster uses containerd, ctr provides direct access to namespaces and snapshots. If your cluster uses containerd, ctr provides direct
Introduction: The Hidden Complexity of Container Filesystems In the world of containerized applications, the storage layer is often treated as a black box. Developers run docker run or kubectl apply , and somehow, the files appear. But beneath the surface lies a sophisticated ecosystem of snapshots, layers, and mount points. For those managing Kubernetes clusters using the Container Runtime Interface (CRI), understanding CRI file system tools and the critical role of the link (symbolic or hard link) is not just an advanced skill—it is a necessity for debugging, performance tuning, and disaster recovery.
/var/lib/containers/storage/overlay/<layer-id>/merged -> /var/lib/containers/storage/overlay/<layer-id>/../<parent-id>/merged Scenario 1: "No such file or directory" inside a container Even though the file exists in the image, the container cannot see it. This is often due to a broken symbolic link in a lower layer .
ctr namespace ls # List namespaces (e.g., k8s.io) ctr -n k8s.io snapshot ls # Show all snapshots (image layers) ctr -n k8s.io snapshot mount <key> /mnt # Mount a snapshot to inspect Snapshots are immutable directories linked together via overlayfs. Each snapshot has a "parent" link to the previous layer. 3. crio-status – CRI-O’s Inspection Tool For CRI-O users, crio-status dumps storage and runtime information.