containerd Snapshot Drivers

Snapshotters manage how container image layers are stored and mounted. Learn about overlayfs, native, devicemapper, zfs, btrfs, and how to choose the right driver for your workload.

overlayfs native zfs btrfs
What are Snapshotters?

Snapshotters (also called snapshot drivers) are the components in containerd that manage the storage of container image layers and container writable layers. They implement copy-on-write (CoW) filesystem technologies to efficiently store and mount container layers.

When you pull a container image, containerd unpacks each layer and stores it using the snapshotter. When you start a container, the snapshotter creates a writable layer on top of the read-only image layers. Each snapshot driver has different performance characteristics, storage requirements, and capabilities.

The snapshotter is one of the most important performance factors in container runtime. Choosing the right driver can significantly impact container startup time and I/O performance.
Snapshot Drivers Comparison

overlayfs

Filesystem: ext4, xfs (with d_type)
Performance: Excellent
Use Case: Most workloads
Recommended

native

Filesystem: Any
Performance: Poor (no CoW)
Use Case: Testing
Testing Only

devicemapper

Filesystem: Direct-lvm
Performance: Fair
Use Case: Legacy systems
Deprecated

zfs

Filesystem: ZFS
Performance: Good
Use Case: ZFS filesystems
Enterprise

btrfs

Filesystem: Btrfs
Performance: Good
Use Case: Btrfs filesystems
Enterprise

overlay (legacy)

Filesystem: Any
Performance: Fair
Use Case: Deprecated (pre-overlayfs)
Deprecated
overlayfs: The Default and Recommended Driver

overlayfs is the default snapshot driver for containerd. It uses the Linux kernel's overlay filesystem to efficiently manage container layers. It provides excellent performance with minimal overhead.

# Check if overlayfs is supported grep overlay /proc/filesystems # Check d_type support (overlayfs requires d_type) xfs_info /var/lib/containerd | grep ftype # ftype=1 means d_type is supported # Configure overlayfs in containerd # /etc/containerd/config.toml [plugins."io.containerd.snapshotter.v1.overlayfs"] root_path = "/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs" # View overlayfs mounts mount | grep overlay # Check overlayfs usage du -sh /var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/
overlayfs is the best choice for most users. It's fast, stable, and the default on all modern Linux distributions.
native: Simple Copy-Based Driver

The native driver does not implement copy-on-write. Each layer is a complete copy of the parent layer. This consumes significant disk space but is useful for testing or filesystems that don't support CoW.

# Configure native snapshotter [plugins."io.containerd.snapshotter.v1.native"] root_path = "/var/lib/containerd/io.containerd.snapshotter.v1.native" # Use native snapshotter ctr image pull --snapshotter=native docker.io/library/nginx:alpine # Check disk usage (warning: large!) du -sh /var/lib/containerd/io.containerd.snapshotter.v1.native/
native snapshotter consumes significant disk space. Only use for testing or when no other driver is available.
zfs: Enterprise-Grade Snapshot Support

The zfs snapshotter uses ZFS datasets and clones to implement efficient container layering. It's an excellent choice for ZFS filesystems with built-in compression, deduplication, and snapshot features.

# Create ZFS pool for containerd sudo zpool create -f dockerpool /dev/sdb # Create ZFS dataset sudo zfs create dockerpool/containerd sudo zfs set mountpoint=/var/lib/containerd dockerpool/containerd # Configure containerd to use zfs [plugins."io.containerd.snapshotter.v1.zfs"] root_path = "/var/lib/containerd/io.containerd.snapshotter.v1.zfs" # Use zfs snapshotter ctr image pull --snapshotter=zfs docker.io/library/nginx:alpine # Check ZFS datasets zfs list zfs list -t snapshot
btrfs: Native Btrfs Snapshot Support

The btrfs snapshotter uses Btrfs subvolumes and snapshots to implement container layering. It's a good choice for Btrfs filesystems with built-in CoW features.

# Create Btrfs filesystem sudo mkfs.btrfs /dev/sdb sudo mount /dev/sdb /var/lib/containerd # Configure containerd to use btrfs [plugins."io.containerd.snapshotter.v1.btrfs"] root_path = "/var/lib/containerd/io.containerd.snapshotter.v1.btrfs" # Use btrfs snapshotter ctr image pull --snapshotter=btrfs docker.io/library/nginx:alpine # Check Btrfs subvolumes sudo btrfs subvolume list /var/lib/containerd
devicemapper: Legacy Driver (Deprecated)

The devicemapper driver uses thin provisioning to manage container layers. It was the default driver for Docker on CentOS/RHEL 7 but is now deprecated in favor of overlayfs.

# Configure devicemapper (deprecated) [plugins."io.containerd.snapshotter.v1.devicemapper"] root_path = "/var/lib/containerd/io.containerd.snapshotter.v1.devicemapper" pool_name = "docker-thinpool" # Check devicemapper status sudo dmsetup table # Important: devicemapper is deprecated. Use overlayfs instead.
devicemapper is deprecated. Do not use it for new installations. Migrate to overlayfs if possible.
Configuring Snapshot Drivers
# Check current snapshotter ctr snapshot ls containerd config dump | grep snapshotter # Set default snapshotter in config.toml [plugins."io.containerd.grpc.v1.cri".containerd] snapshotter = "overlayfs" # Use different snapshotter for specific operations ctr image pull --snapshotter=overlayfs docker.io/library/nginx:alpine ctr image pull --snapshotter=zfs docker.io/library/postgres:15 # Check snapshotter usage ctr snapshot ls ctr snapshot usage
Performance Considerations
  • overlayfs: Best performance, low overhead. Recommended for most workloads.
  • zfs: Good performance with additional features (compression, deduplication).
  • btrfs: Good performance with built-in CoW and snapshot features.
  • native: Poor performance, high disk usage. Only for testing.
  • devicemapper: Fair performance, deprecated.
For I/O-intensive workloads, overlayfs on fast storage (SSD/NVMe) provides the best performance. zfs and btrfs add features at the cost of slight overhead.
Troubleshooting Snapshot Issues
# Check disk space (common issue) df -h /var/lib/containerd # Clean up old snapshots ctr snapshot rm $(ctr snapshot ls -q) # Check snapshot mount points mount | grep containerd # Inspect a specific snapshot ctr snapshot info # View snapshot usage per namespace for ns in $(ctr namespace ls -q); do echo "=== Namespace: $ns ===" ctr -n $ns snapshot ls done # Reset containerd storage (dangerous) sudo systemctl stop containerd sudo rm -rf /var/lib/containerd sudo systemctl start containerd
Frequently Asked Questions
Which snapshot driver should I use?
Use overlayfs for most Linux systems. It's the default, fastest, and most stable. Use zfs or btrfs if you're already using those filesystems and need their advanced features.
Can I change snapshot drivers without losing data?
No. Changing the snapshot driver requires removing all images and containers (or migrating data manually). Backup important data before switching drivers.
Why is my snapshotter using so much disk space?
Run `ctr snapshot ls` and `ctr image ls` to see unused snapshots and images. Run `ctr snapshot rm` to remove old snapshots. The native driver uses significantly more space than overlayfs.
Does overlayfs work on all Linux distributions?
overlayfs requires Linux kernel 4.0+ and filesystem with d_type support (ext4, xfs). Most modern distributions (Ubuntu 20.04+, Debian 10+, CentOS 8+, Fedora) support it.
Can I use different snapshot drivers for different containers?
Yes! You can specify the snapshotter per container using the `--snapshotter` flag with `ctr run` or `ctr image pull`. Each container can use a different snapshotter.
How do I check which snapshotter containerd is using?
Run `containerd config dump | grep snapshotter` or check `ctr snapshot ls` to see the default snapshotter.
Is devicemapper still supported?
devicemapper is deprecated and no longer recommended. Use overlayfs for new installations. Some legacy systems may still use it.
Does the snapshotter affect container performance?
Yes! The snapshotter significantly affects I/O performance, especially for write-heavy workloads. overlayfs provides the best performance. zfs and btrfs add features but have slightly higher overhead.
Previous: containerd Namespaces Next: ctr Commands

Choosing the right snapshot driver is essential for performance and storage efficiency. overlayfs is the best choice for most users.