lxc/lxcfs logo

lxc/lxcfs

Free

FUSE filesystem for LXC

FreeFree tier
Type
Open Source

About lxc/lxcfs

LXCFS is a small FUSE filesystem designed to make Linux containers feel more like virtual machines. It ensures that critical files in procfs (such as /proc/cpuinfo, /proc/meminfo, /proc/uptime, /proc/stat, /proc/diskstats, /proc/swaps, /proc/slabinfo, and /proc/pressure/*) and /sys/devices/system/cpu/online display container-aware values — reflecting the container’s own uptime and resource view rather than the host’s. Originally created as a side project of LXC, it is usable by any container runtime. LXCFS is split into a shared library (liblxcfs) and a binary, allowing in-place upgrades without restarting containers by sending SIGUSR1 to reload the library (glibc only; musl requires a full restart). Building requires fuse3 and uses the meson build system.

Key Features

Makes /proc/cpuinfo, /proc/diskstats, /proc/meminfo, /proc/stat, /proc/swaps, /proc/uptime, /proc/slabinfo, and /proc/pressure/* container-aware
Provides container-aware view of /sys/devices/system/cpu/online
Deprecated: container-aware cgroupfs tree for systems without cgroup namespace support
Upgrade without restarting containers via shared library reload (SIGUSR1 to lxcfs process)
Requires FUSE3 for compilation and operation
Built with meson build system

Pros & Cons

Pros
  • Containers report their own resource stats, improving VM-like behavior
  • No container restart needed for LXCFS upgrades (on glibc)
  • Small, focused FUSE filesystem with minimal overhead
  • Works with any container runtime, not just LXC
Cons
  • Container-aware cgroupfs feature is deprecated and relies on kernel cgroup namespaces for best security
  • On musl-based systems (e.g., Alpine), LXCFS upgrades require a full restart of all containers using it
  • Requires FUSE3, which may not be available on older distributions
  • Only addresses procfs/sysfs files; does not virtualize other filesystem views

Best For

Making Linux containers feel more like virtual machines for resource reportingAccurate procfs data inside containers (e.g., uptime, memory, CPU info)Improving compatibility with legacy software that reads host procfs files directlyEnhancing container isolation by preventing host resource leakage

FAQ

How can I upgrade LXCFS without restarting containers?
Send SIGUSR1 to the running lxcfs process. It will then dlclose the old liblxcfs shared library and dlopen the new one. You must first delete the old library file and copy the new one into place before sending the signal.
Does LXCFS work on musl-based systems?
Musl does not fully support dlclose/dlopen unloading, so LXCFS on musl requires a complete restart of both the lxcfs process and all containers using it to upgrade.