Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a way to query a mounted overlay filesystem (overlayfs) in order to check it's upper and lower directory, but until now I haven't found any suitable command for that. Is there is a way to do such a check ?

I mounted the overlayfs with a command like the one below:

mount -t overlayfs -o lowerdir=/mnt/root-ro,upperdir=/data/root-rw overlayfs-root ${rootmnt}

The mount command didn't give me enough information:

root@ubuntu12:~# mount -l
overlayfs-root on / type overlayfs (rw)
/dev/sda1 on /mnt/root-ro type ext4 (ro,relatime,data=ordered) [ROOT]
/dev/sdb1 on /data type ext4 (rw,errors=remount-ro) [DATA]
share|improve this question
Which type of "overlay" filesystem are you using? – Celada May 15 '13 at 17:36
I'm using overlayfs – enzo2 May 17 '13 at 6:08
Oh! I didn't realize there was a filesystem actualy called "overlayfs". I'm only familiar with aufs and unionfs. The latter two do provide an easy way to query what their underlying branches are, but I wouldn't know about overlayfs. – Celada May 17 '13 at 14:49
Please Celada, tell me about the method suitable for aufs and unionfs so I can check if something similar is working also for overlayfs – enzo2 May 20 '13 at 6:26
aufs: Under /sys/fs/aufs can be found one directory per instance of currently mounted aufs filesystem. Inside each directory, there are files br0, br1, and so on, which contain the names of each of the branches of that aufs instance. – Celada May 20 '13 at 20:04

The kernel exposes the (full list of) mount options via /proc/mounts. For overlayfs, this includes the lowerdir and upperdir options:

$ cd /tmp
$ mkdir lower upper overlay
$ sudo mount -t overlayfs -o lowerdir=/tmp/lower,upperdir=/tmp/upper none /tmp/overlay
$ tail -n 1 /proc/mounts
none /tmp/overlay overlayfs rw,relatime,lowerdir=/tmp/lower,upperdir=/tmp/upper 0 0

In the general case, parsing this can be tricky as the paths themselves may contain spaces and commas which are used as field separators in the filesystem information. If you can assume that there are no spaces or commas in the paths, you might be able to manage with something like:

$ LOWER=$(tail -n 1 /proc/mounts | egrep -om1 'lowerdir=[^, ]*' | sed s/lowerdir=//)
$ UPPER=$(tail -n 1 /proc/mounts | egrep -om1 'upperdir=[^, ]*' | sed s/upperdir=//)
$ echo $LOWER $UPPER
/tmp/lower /tmp/upper
share|improve this answer
note that in Ubuntu you would need to add mkdir workdir and add workdir=/tmp/workdir to the options in the mount command. – Programster Nov 30 '15 at 17:12

mount will itself list your directory as overlayfs type, and upperdir and lowerdir in mount options.

share|improve this answer
I see that some tutorial told that, that moiunt will shoe the detail of mounted overlayfs, but in practise, on ubuntu 12, the mount give me not enought info. – enzo2 May 24 '13 at 8:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.