Strange behaviour with unionfs

Oleg Sharoyko osharoiko at
Tue Dec 16 23:18:18 PST 2008


Could please someone check the following sequence of commands in recent

cd /tmp
mkdir sandbox
cd sandbox/
mkdir -p 1
mkdir -p 2/2
mkdir -p 3/3
echo Test > 3/3/test.txt
mount -t unionfs 2 1
mount -t nullfs 3 1/2
cat 1/2/3/test.txt
test -d 1/2
cat 1/2/3/test.txt

I'm running -STABLE with patch for unix sockets (which I converted from
-CURRENT) and it gives me really strange results:

hetzner-srv1, /tmp # cd /tmp
hetzner-srv1, /tmp # mkdir sandbox
hetzner-srv1, /tmp # cd sandbox/
hetzner-srv1, /tmp/sandbox # mkdir -p 1
hetzner-srv1, /tmp/sandbox # mkdir -p 2/2
hetzner-srv1, /tmp/sandbox # mkdir -p 3/3
hetzner-srv1, /tmp/sandbox # echo Test > 3/3/test.txt
hetzner-srv1, /tmp/sandbox # mount -t unionfs 2 1
hetzner-srv1, /tmp/sandbox # mount -t nullfs 3 1/2
hetzner-srv1, /tmp/sandbox # cat 1/2/3/test.txt
cat: 1/2/3/test.txt: No such file or directory
hetzner-srv1, /tmp/sandbox # test -d 1/2
hetzner-srv1, /tmp/sandbox # cat 1/2/3/test.txt
hetzner-srv1, /tmp/sandbox # 

It looks like files in subdirectories of filesystems mounted on top of
unionfs are not visible until I somehow test the mountpoint.

Oleg Sharoyko.
Software and Network Engineer
Computer Center of Rostov State University.

More information about the freebsd-fs mailing list