This episode breaks down LXC storage: the dir, btrfs, ZFS, LVM, and loop backends along with lxc-create --bdev/--fstype; then image management via the download template, cloning with lxc-copy, and snapshots with lxc-snapshot.

In episode 7 your container has resource limits. Now the next question: where does the container live? In episode 8 we break down LXC storage — from the backends that determine how the rootfs is stored, to the images that are the source of new containers. The backend decision here determines speed, disk usage, and how efficient your snapshots will be later (episode 9).
LXC supports several backends for storing container rootfs. Each has a different philosophy:
The simplest backend and the default: the rootfs is just a regular directory at /var/lib/lxc/<name>/rootfs. Easy to back up (just cp -a), but no native snapshot support — every snapshot is a full copy.
grep lxc.rootfs.path /var/lib/lxc/c1/configAn output of dir:/var/lib/lxc/c1/rootfs indicates the dir backend.
Both filesystems have built-in snapshots that are nearly instant and disk-efficient (copy-on-write). If the LXC rootfs sits on a btrfs/zfs volume, lxc-snapshot uses its native mechanism — snapshots become cheap, fast, and nestable. This is the best choice for homelabs and snapshot-intensive production.
With LVM, each container is its own logical volume. LVM snapshots are also native, but usually single (not nested) and require careful volume management. Suitable for environments that already use LVM as their storage standard.
The loop backend uses a disk image file that's loop-mounted as a filesystem. Flexible for experiments and portability, but with lower performance, and snapshots depend on the filesystem inside.
The backend is chosen via --bdev and the filesystem via --fstype:
lxc-create -n c2 -B dir -t download -- -d debian -r bookworm -a amd64lxc-create -n c3 -B btrfs -t download -- -d ubuntu -r 24.04 -a amd64-B bdev / --bdev <type> — choose the backend (dir, btrfs, zfs, lvm, loop).--fstype <fs> — the filesystem inside (e.g. ext4 for loop/LVM, btrfs for the btrfs backend).Tip
The backend can't be casually changed once a container is created. Before deciding, ask first: how often will you snapshot (btrfs/zfs), is your storage already standardized on LVM, or do you just want simple and portable (dir)? This decision is cheap now, expensive if changed later.
The download template fetches images from the official linuxcontainers.org image server. These images can be thought of as "base images" — minimal rootfs ready to be customized. The most flexible way to choose:
lxc-create -n placeholder -t download -- --listThe selected image can be a specific release (e.g. Ubuntu 24.04, Debian bookworm) and architecture (amd64, arm64).
lxc-copy creates a new container from an existing one — like copying a template. It's faster than re-downloading an image. Basic example:
lxc-copy -n c1 -N c4The difference between a full copy and a snapshot clone will be covered in episode 9.
lxc-snapshot saves a container's state at a point in time, so you can go back (rollback) if something breaks:
lxc-snapshot -n c1With the dir backend, this snapshot is a full copy; with btrfs/zfs, it uses the native snapshot that's nearly instant.
Note
Key concept: an image is a source for creating new containers, while a snapshot is a recording of an existing container's state. Images point forward (scale out), snapshots point backward (rollback). Episode 9 will dive into snapshots and clones specifically.
Monitor how much storage each container uses:
du -sh /var/lib/lxc/*/rootfsIf you use ZFS, use zfs list -t all to see volumes and their snapshots:
zfs list -t all | grep -E "lxc|containers"Key takeaways:
dir (simple), btrfs/zfs (native snapshots), LVM (volume-based), and loop (disk image file).lxc-create -B <bdev> --fstype <fs> determines how the rootfs is stored.download template fetches images from the official image server.lxc-copy creates new containers from existing ones; lxc-snapshot records a state for rollback.In the next episode 9 we'll focus on snapshots & clones — lxc-snapshot -n c1 -L to list snapshots, lxc-copy -n c1 -N c2 for a full copy, and -s for a disk-efficient snapshot clone. This is the most valuable skill for homelab and production operations.