[buildd-tools-devel] Bug#813360: Bug#813360: Overlayfs available on newer Linux kernel only

Luca Falavigna dktrkranz at debian.org
Mon Feb 1 15:34:11 UTC 2016


2016-02-01 12:32 GMT+01:00 Johannes Schauer <josch at debian.org>:
> does there exist an easy way to detect at run-time whether overlayfs is
> available on the system?

A dumb method could be checking whether the filesystem is listed in
/proc/filesystems:
$ cat /proc/filesystems | grep overlay
nodev overlay
$

But I think it will return nothing if overlay module is not loaded via
modprobe first, and again it's Linux-specific...

A full check would be like this:
    if system is Linux:
        if /proc/filesystem contains overlayfs:
            overlayfs available
        else if modprobe overlay:
            overlayfs available
        else:
            overlayfs not available
    else:
        overlayfs not available

... but my impression it's not 100% error-proof.

-- 
Cheers,
Luca



More information about the Buildd-tools-devel mailing list