<s>
In	O
computer	B-General_Concept
operating	I-General_Concept
systems	I-General_Concept
,	O
union	O
mounting	O
is	O
a	O
way	O
of	O
combining	O
multiple	O
directories	O
into	O
one	O
that	O
appears	O
to	O
contain	O
their	O
combined	O
contents	O
.	O
</s>
<s>
Union	O
mounting	O
is	O
supported	O
in	O
Linux	B-Operating_System
,	O
BSD	B-Operating_System
and	O
several	O
of	O
its	O
successors	O
,	O
and	O
Plan	B-Operating_System
9	I-Operating_System
,	O
with	O
similar	O
but	O
subtly	O
different	O
behavior	O
.	O
</s>
<s>
As	O
an	O
example	O
application	O
of	O
union	O
mounting	O
,	O
consider	O
the	O
need	O
to	O
update	O
the	O
information	O
contained	O
on	O
a	O
CD-ROM	B-Device
or	O
DVD	O
.	O
</s>
<s>
While	O
a	O
CD-ROM	B-Device
is	O
not	O
writable	O
,	O
one	O
can	O
overlay	O
the	O
CD	O
's	O
mount	O
point	O
with	O
a	O
writable	O
directory	O
in	O
a	O
union	B-Application
mount	I-Application
.	O
</s>
<s>
Then	O
,	O
updating	O
files	O
in	O
the	O
union	O
directory	O
will	O
cause	O
them	O
to	O
end	O
up	O
in	O
the	O
writable	O
directory	O
,	O
giving	O
the	O
illusion	O
that	O
the	O
CD-ROM	B-Device
'	O
s	O
contents	O
have	O
been	O
updated	O
.	O
</s>
<s>
In	O
the	O
Plan	B-Operating_System
9	I-Operating_System
operating	B-General_Concept
system	I-General_Concept
from	O
Bell	O
Labs	O
(	O
mid-1980s	O
onward	O
)	O
,	O
union	O
mounting	O
is	O
a	O
central	O
concept	O
,	O
replacing	O
several	O
older	O
Unix	B-Application
conventions	O
with	O
union	O
directories	O
;	O
for	O
example	O
,	O
several	O
directories	O
containing	O
executables	B-Application
,	O
unioned	O
together	O
at	O
a	O
single	O
directory	O
,	O
replace	O
the	O
variable	O
for	O
command	O
lookup	O
in	O
the	O
shell	O
.	O
</s>
<s>
Plan	B-Operating_System
9	I-Operating_System
union	O
semantics	O
are	O
greatly	O
simplified	O
compared	O
to	O
the	O
implementations	O
for	O
POSIX-style	O
operating	B-General_Concept
systems	I-General_Concept
:	O
the	O
union	O
of	O
two	O
directories	O
is	O
simply	O
the	O
concatenation	O
of	O
their	O
contents	O
,	O
so	O
a	O
directory	O
listing	O
of	O
the	O
union	O
may	O
display	O
duplicate	O
names	O
.	O
</s>
<s>
Unix/POSIX	O
implementations	O
of	O
unions	O
have	O
different	O
requirements	O
from	O
the	O
Plan	B-Operating_System
9	I-Operating_System
implementation	O
due	O
to	O
constraints	O
in	O
the	O
traditional	B-Application
Unix	I-Application
file	O
system	O
behavior	O
,	O
which	O
greatly	O
complicates	O
their	O
implementation	O
and	O
often	O
leads	O
to	O
compromises	O
.	O
</s>
<s>
Problems	O
that	O
union	O
mounting	O
on	O
Unix-like	O
operating	B-General_Concept
systems	I-General_Concept
encounters	O
include	O
:	O
</s>
<s>
Duplicate	O
file	O
names	O
within	O
a	O
directory	O
are	O
not	O
acceptable	O
,	O
since	O
this	O
would	O
break	O
applications	O
 '	O
expectations	O
of	O
how	O
a	O
Unix	B-Application
file	O
system	O
works	O
.	O
</s>
<s>
Putting	O
a	O
logical	O
,	O
stack-like	O
precedence	O
ordering	O
on	O
the	O
union	O
's	O
constituents	O
partially	O
solves	O
this	O
problem	O
,	O
but	O
requires	O
memory	O
to	O
record	O
which	O
files	O
need	O
to	O
be	O
skipped	O
over	O
during	O
a	O
directory	O
listing	O
(	O
which	O
is	O
otherwise	O
a	O
nearly	O
stateless	O
operation	O
)	O
.	O
</s>
<s>
Insertion	O
of	O
a	O
directory	O
into	O
the	O
stack	B-Application
can	O
cause	O
incoherency	O
in	O
the	O
kernel	B-Operating_System
's	O
file	O
name	O
cache	O
.	O
</s>
<s>
Renaming	O
a	O
file	O
within	O
a	O
single	O
mounted	O
file	O
system	O
(	O
using	O
the	O
system	O
call	O
)	O
should	O
be	O
an	O
atomic	B-General_Concept
operation	I-General_Concept
,	O
but	O
renaming	O
within	O
a	O
union	B-Application
mount	I-Application
can	O
require	O
changes	O
to	O
multiple	O
of	O
the	O
union	O
's	O
constituent	O
directories	O
.	O
</s>
<s>
Stable	O
inode	B-Application
numbers	I-Application
for	O
files	O
,	O
hard	B-Application
links	I-Application
and	O
memory-mapped	B-General_Concept
I/O	I-General_Concept
(	O
)	O
are	O
hard	O
to	O
implement	O
correctly	O
.	O
</s>
<s>
Early	O
attempts	O
to	O
add	O
unioning	O
to	O
Unix	B-Application
filesystems	O
included	O
the	O
3-d	O
filesystem	O
(	O
Bell	O
Labs	O
)	O
and	O
the	O
Translucent	O
File	O
Service	O
in	O
SunOS	B-Operating_System
(	O
Sun	O
Microsystems	O
,	O
1988	O
)	O
.	O
</s>
<s>
An	O
implementation	O
of	O
union	O
mounting	O
was	O
added	O
to	O
the	O
BSD	B-Operating_System
version	O
of	O
Unix	B-Application
in	O
version	O
4.4	O
(	O
1994	O
)	O
,	O
taking	O
inspiration	O
from	O
these	O
earlier	O
attempts	O
,	O
Plan	B-Operating_System
9	I-Operating_System
and	O
the	O
stackable	O
file	O
systems	O
in	O
Spring	B-Application
(	O
Sun	O
,	O
1994	O
)	O
.	O
</s>
<s>
4.4BSD	O
implements	O
the	O
stack-of-directories	O
approach	O
outlined	O
above	O
.	O
</s>
<s>
As	O
in	O
Plan	B-Operating_System
9	I-Operating_System
,	O
operations	O
traverse	O
this	O
stack	B-Application
top-down	O
to	O
resolve	O
names	O
,	O
but	O
unlike	O
Plan	B-Operating_System
9	I-Operating_System
,	O
BSD	B-Operating_System
union	B-Application
mounts	I-Application
are	O
recursive	O
,	O
so	O
that	O
the	O
contents	O
of	O
subdirectories	O
appear	O
merged	O
in	O
the	O
union	O
directory	O
.	O
</s>
<s>
Also	O
unlike	O
the	O
Plan	B-Operating_System
9	I-Operating_System
version	O
,	O
all	O
layers	O
except	O
the	O
top	O
are	O
read-only	O
:	O
modifying	O
files	O
in	O
the	O
union	O
causes	O
their	O
contents	O
to	O
first	O
be	O
copied	O
into	O
the	O
top	O
layer	O
of	O
the	O
stack	B-Application
,	O
where	O
the	O
modifications	O
are	O
then	O
applied	O
.	O
</s>
<s>
Deletion	O
of	O
files	O
is	O
implemented	O
by	O
writing	O
a	O
special	B-Application
type	I-Application
of	I-Application
file	I-Application
called	O
a	O
whiteout	O
to	O
the	O
top	O
directory	O
,	O
which	O
has	O
the	O
effect	O
of	O
marking	O
the	O
file	O
name	O
as	O
non-existent	O
and	O
hiding	O
files	O
with	O
the	O
same	O
name	O
in	O
the	O
lower	O
layers	O
of	O
the	O
stack	B-Application
.	O
</s>
<s>
Union	O
mounting	O
was	O
implemented	O
for	O
Linux	B-Operating_System
0.99	O
in	O
1993	O
;	O
this	O
initial	O
implementation	O
was	O
called	O
the	O
Inheriting	O
File	O
System	O
,	O
but	O
was	O
abandoned	O
by	O
its	O
developer	O
because	O
of	O
its	O
complexity	O
.	O
</s>
<s>
The	O
next	O
major	O
implementation	O
was	O
UnionFS	B-Application
,	O
which	O
grew	O
out	O
of	O
the	O
FiST	O
project	O
at	O
Stony	O
Brook	O
University	O
.	O
</s>
<s>
An	O
attempt	O
to	O
replace	O
UnionFS	B-Application
,	O
aufs	B-Application
,	O
was	O
released	O
in	O
2006	O
,	O
followed	O
in	O
2009	O
by	O
OverlayFS	B-Application
.	O
</s>
<s>
In	O
2014	O
OverlayFS	B-Application
union	B-Application
mount	I-Application
implementation	O
was	O
added	O
to	O
the	O
standard	O
Linux	B-Operating_System
kernel	I-Operating_System
source	O
code	O
.	O
</s>
<s>
Similarly	O
,	O
GlusterFS	B-Application
offers	O
the	O
ability	O
to	O
mount	O
different	O
filesystems	O
distributed	O
across	O
a	O
network	O
,	O
rather	O
than	O
being	O
located	O
on	O
the	O
same	O
machine	O
.	O
</s>
