<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
sparse	B-General_Concept
file	I-General_Concept
is	O
a	O
type	O
of	O
computer	B-Operating_System
file	I-Operating_System
that	O
attempts	O
to	O
use	O
file	B-Application
system	I-Application
space	O
more	O
efficiently	O
when	O
the	O
file	O
itself	O
is	O
partially	O
empty	O
.	O
</s>
<s>
When	O
reading	O
sparse	B-General_Concept
files	I-General_Concept
,	O
the	O
file	B-Application
system	I-Application
transparently	O
converts	O
metadata	O
representing	O
empty	O
blocks	O
into	O
"	O
real	O
"	O
blocks	O
filled	O
with	O
null	O
bytes	O
at	O
runtime	O
.	O
</s>
<s>
Most	O
modern	O
file	B-Application
systems	I-Application
support	O
sparse	B-General_Concept
files	I-General_Concept
,	O
including	O
most	O
Unix	B-Application
variants	O
and	O
NTFS	B-Application
.	O
</s>
<s>
Apple	O
's	O
HFS+	B-Application
does	O
not	O
provide	O
support	O
for	O
sparse	B-General_Concept
files	I-General_Concept
,	O
but	O
in	O
OS	O
X	O
,	O
the	O
virtual	B-Application
file	I-Application
system	I-Application
layer	O
supports	O
storing	O
them	O
in	O
any	O
supported	O
file	B-Application
system	I-Application
,	O
including	O
HFS+	B-Application
.	O
</s>
<s>
Apple	B-Application
File	I-Application
System	I-Application
(	O
APFS	B-Application
)	O
,	O
announced	O
in	O
June	O
2016	O
at	O
WWDC	O
,	O
also	O
supports	O
them	O
.	O
</s>
<s>
Sparse	B-General_Concept
files	I-General_Concept
are	O
commonly	O
used	O
for	O
disk	B-Application
images	I-Application
,	O
database	B-Application
snapshots	I-Application
,	O
log	B-Application
files	I-Application
and	O
in	O
scientific	O
applications	O
.	O
</s>
<s>
The	O
advantage	O
of	O
sparse	B-General_Concept
files	I-General_Concept
is	O
that	O
storage	O
space	O
is	O
only	O
allocated	O
when	O
actually	O
needed	O
:	O
Storage	O
capacity	O
is	O
conserved	O
,	O
and	O
large	O
files	O
can	O
occasionally	O
be	O
created	O
even	O
if	O
insufficient	O
free	O
space	O
for	O
the	O
original	O
file	O
is	O
available	O
on	O
the	O
storage	O
media	O
.	O
</s>
<s>
For	O
example	O
,	O
a	O
virtual	B-Architecture
machine	I-Architecture
image	O
with	O
max	O
size	O
of	O
100	O
GB	O
that	O
has	O
2	O
GB	O
of	O
files	O
actually	O
written	O
would	O
require	O
the	O
full	O
100	O
GB	O
when	O
backed	O
by	O
pre-allocated	O
storage	O
,	O
yet	O
only	O
2	O
GB	O
on	O
a	O
sparse	B-General_Concept
file	I-General_Concept
.	O
</s>
<s>
If	O
the	O
file	B-Application
system	I-Application
supports	O
hole	O
punching	O
and	O
the	O
guest	O
operating	O
system	O
issues	O
TRIM	O
commands	O
,	O
deleting	O
files	O
on	O
the	O
guest	O
will	O
accordingly	O
reduce	O
the	O
space	O
needed	O
.	O
</s>
<s>
Disadvantages	O
are	O
that	O
sparse	B-General_Concept
files	I-General_Concept
may	O
become	O
fragmented	B-Architecture
;	O
file	B-Application
system	I-Application
free	O
space	O
reports	O
may	O
be	O
misleading	O
;	O
filling	O
up	O
file	B-Application
systems	I-Application
containing	O
sparse	B-General_Concept
files	I-General_Concept
can	O
have	O
unexpected	O
effects	O
(	O
such	O
as	O
disk-full	O
or	O
quota-exceeded	O
errors	O
when	O
merely	O
overwriting	O
an	O
existing	O
portion	O
of	O
a	O
file	O
that	O
happened	O
to	O
have	O
been	O
sparse	O
)	O
;	O
and	O
copying	O
a	O
sparse	B-General_Concept
file	I-General_Concept
with	O
a	O
program	B-Application
that	O
does	O
not	O
explicitly	O
support	O
them	O
may	O
copy	O
the	O
entire	O
,	O
uncompressed	O
size	O
of	O
the	O
file	O
,	O
including	O
the	O
zero	O
sections	O
which	O
are	O
not	O
allocated	O
on	O
the	O
storage	O
medialosing	O
the	O
benefits	O
of	O
the	O
sparse	O
property	O
in	O
the	O
file	O
.	O
</s>
<s>
Sparse	B-General_Concept
files	I-General_Concept
are	O
also	O
not	O
fully	O
supported	O
by	O
all	O
backup	O
software	O
or	O
applications	O
.	O
</s>
<s>
However	O
,	O
the	O
VFS	B-Application
implementation	O
sidesteps	O
the	O
prior	O
two	O
disadvantages	O
.	O
</s>
<s>
Loading	O
executables	B-Application
on	O
32	O
bit	O
Windows	O
(	O
exe	O
or	O
dll	O
)	O
which	O
are	O
sparse	O
takes	O
a	O
much	O
longer	O
time	O
since	O
the	O
file	O
cannot	O
be	O
memory	O
mapped	O
in	O
the	O
limited	O
4	O
GB	O
address	O
space	O
,	O
and	O
are	O
not	O
cached	O
as	O
there	O
is	O
no	O
codepath	O
for	O
caching	O
32	O
bit	O
sparse	O
executables	B-Application
(	O
Windows	O
on	O
64	O
bit	O
architectures	O
can	O
map	O
sparse	O
executables	B-Application
)	O
.	O
</s>
<s>
On	O
NTFS	B-Application
sparse	B-General_Concept
files	I-General_Concept
(	O
or	O
rather	O
their	O
non-zero	O
areas	O
)	O
cannot	O
be	O
compressed	O
.	O
</s>
<s>
NTFS	B-Application
implements	O
sparseness	O
as	O
a	O
special	O
kind	O
of	O
compression	O
so	O
a	O
file	O
may	O
be	O
either	O
sparse	O
or	O
compressed	O
.	O
</s>
<s>
Sparse	B-General_Concept
files	I-General_Concept
are	O
typically	O
handled	O
transparently	O
to	O
the	O
user	O
.	O
</s>
<s>
But	O
the	O
differences	O
between	O
a	O
normal	O
file	O
and	O
sparse	B-General_Concept
file	I-General_Concept
become	O
apparent	O
in	O
some	O
situations	O
.	O
</s>
<s>
(	O
GNU	B-Operating_System
dd	B-Application
has	O
this	O
behavior	O
because	O
it	O
calls	O
ftruncate	O
to	O
set	O
the	O
file	O
size	O
;	O
other	O
implementations	O
may	O
merely	O
create	O
an	O
empty	O
file	O
.	O
)	O
</s>
<s>
On	O
Linux	B-Application
,	O
an	O
existing	O
file	O
can	O
be	O
converted	O
to	O
sparse	O
by	O
:	O
</s>
<s>
There	O
is	O
no	O
portable	O
system	O
call	O
to	O
punch	O
holes	O
;	O
Linux	B-Application
provides	O
fallocate(FALLOC_FL_PUNCH_HOLE )	O
,	O
and	O
Solaris	B-Application
provides	O
fcntl(F_FREESP )	O
.	O
</s>
<s>
However	O
,	O
GNU	B-Operating_System
cp	B-Application
does	O
have	O
a	O
--sparse	O
option	O
.	O
</s>
<s>
Some	O
cp	B-Application
implementations	O
,	O
like	O
FreeBSD	B-Operating_System
's	O
cp	B-Application
,	O
do	O
not	O
support	O
the	O
--sparse	O
option	O
and	O
will	O
always	O
expand	O
sparse	B-General_Concept
files	I-General_Concept
.	O
</s>
<s>
A	O
partially	O
viable	O
alternative	O
on	O
those	O
systems	O
is	O
to	O
use	O
rsync	B-Application
with	O
its	O
own	O
--sparse	O
option	O
instead	O
of	O
cp	B-Application
.	O
</s>
<s>
Via	O
standard	O
input	O
,	O
sparse	B-General_Concept
file	I-General_Concept
copying	O
is	O
achieved	O
as	O
follows	O
:	O
</s>
