Where’s my OverlayFS?

The other day I was trying to switch Docker’s storage driver from devicemapper to OverlayFS on my Debian Stretch development machine.

Docker’s instructions suggested first checking whether the machine has the overlay kernel module:

$ lsmod | grep overlay

On my machine, this came up empty. Am I actually missing OverlayFS?! I’m on the latest vanilla Debian Stretch, with kernel version 4.6. OverlayFS was added to the kernel at version 3.18, released over two years ago.

In fact, Linux provides a command specifically to investigate your kernel modules:

$ /sbin/modinfo overlay
filename:       /lib/modules/4.6.0-1-amd64/kernel/fs/overlayfs/overlay.ko
alias:          fs-overlay
license:        GPL
description:    Overlay filesystem
author:         Miklos Szeredi <[email protected]>
intree:         Y
vermagic:       4.6.0-1-amd64 SMP mod_unload modversions 
parm:           check_copy_up:bool
parm:           ovl_check_copy_up:Warn on copy-up when causing process also has a R/O fd open

Rad! So I’ve got OverlayFS after all. I can check that the kernel module loads successfully:

$ /sbin/modprobe overlay

No errors. We’re all good, and lsmod confirms the module is loaded:

$ lsmod | grep overlay
overlay                45056  11

In fact, the kernel waits to load the overlay module until it’s needed, at which point it loads it automatically. So simply following the instructions from the Docker docs works without additional steps. The lsmod | grep overlay check was just a red herring that caused me a false alarm.