<s>
In	O
Linux	B-Operating_System
systems	O
,	O
initrd	B-Application
(	O
initial	B-Application
ramdisk	I-Application
)	O
is	O
a	O
scheme	O
for	O
loading	O
a	O
temporary	O
root	B-Application
file	I-Application
system	I-Application
into	O
memory	B-General_Concept
,	O
to	O
be	O
used	O
as	O
part	O
of	O
the	O
Linux	B-Application
startup	I-Application
process	I-Application
.	O
</s>
<s>
initrd	B-Application
and	O
initramfs	B-Application
refer	O
to	O
two	O
different	O
methods	O
of	O
achieving	O
this	O
.	O
</s>
<s>
Both	O
are	O
commonly	O
used	O
to	O
make	O
preparations	O
before	O
the	O
real	O
root	B-Application
file	I-Application
system	I-Application
can	O
be	O
mounted	O
.	O
</s>
<s>
Many	O
Linux	B-Application
distributions	I-Application
ship	O
a	O
single	O
,	O
generic	O
Linux	B-Operating_System
kernel	I-Operating_System
image	B-Application
one	O
that	O
the	O
distribution	O
's	O
developers	O
create	O
specifically	O
to	O
boot	O
on	O
a	O
wide	O
variety	O
of	O
hardware	O
.	O
</s>
<s>
The	O
device	B-Application
drivers	I-Application
for	O
this	O
generic	O
kernel	B-Operating_System
image	B-Application
are	O
included	O
as	O
loadable	B-Application
kernel	I-Application
modules	I-Application
because	O
statically	O
compiling	O
many	O
drivers	O
into	O
one	O
kernel	B-Operating_System
causes	O
the	O
kernel	B-Operating_System
image	B-Application
to	O
be	O
much	O
larger	O
,	O
perhaps	O
too	O
large	O
to	O
boot	O
on	O
computers	O
with	O
limited	O
memory	B-General_Concept
,	O
or	O
in	O
some	O
cases	O
to	O
cause	O
boot-time	O
crashes	O
or	O
other	O
problems	O
due	O
to	O
probing	O
for	O
nonexistent	O
or	O
conflicting	O
hardware	O
.	O
</s>
<s>
This	O
static-compiled	O
kernel	B-Operating_System
approach	O
also	O
leaves	O
modules	B-Application
in	O
kernel	B-Operating_System
memory	B-General_Concept
which	O
are	O
no	O
longer	O
used	O
or	O
needed	O
,	O
and	O
raises	O
the	O
problem	O
of	O
detecting	O
and	O
loading	O
the	O
modules	B-Application
necessary	O
to	O
mount	B-Device
the	O
root	B-Application
file	I-Application
system	I-Application
at	O
boot	O
time	O
,	O
or	O
for	O
that	O
matter	O
,	O
deducing	O
where	O
or	O
what	O
the	O
root	B-Application
file	I-Application
system	I-Application
is	O
.	O
</s>
<s>
To	O
further	O
complicate	O
matters	O
,	O
the	O
root	B-Application
file	I-Application
system	I-Application
may	O
be	O
on	O
a	O
software	O
RAID	B-Architecture
volume	O
,	O
LVM	B-Application
,	O
NFS	B-Protocol
(	O
on	O
diskless	O
workstations	O
)	O
,	O
or	O
on	O
an	O
encrypted	O
partition	O
.	O
</s>
<s>
All	O
of	O
these	O
require	O
special	O
preparations	O
to	O
mount	B-Device
.	O
</s>
<s>
Another	O
complication	O
is	O
kernel	B-Operating_System
support	O
for	O
hibernation	O
,	O
which	O
suspends	O
the	O
computer	O
to	O
disk	O
by	O
dumping	O
an	O
image	B-Application
of	O
the	O
entire	O
contents	O
of	O
memory	B-General_Concept
to	O
a	O
swap	O
partition	O
or	O
a	O
regular	O
file	O
,	O
then	O
powering	O
off	O
.	O
</s>
<s>
On	O
next	O
boot	O
,	O
this	O
image	B-Application
has	O
to	O
be	O
made	O
accessible	O
before	O
it	O
can	O
be	O
loaded	O
back	O
into	O
memory	B-General_Concept
.	O
</s>
<s>
To	O
avoid	O
having	O
to	O
hardcode	O
handling	O
for	O
so	O
many	O
special	O
cases	O
into	O
the	O
kernel	B-Operating_System
,	O
an	O
initial	O
boot	O
stage	O
with	O
a	O
temporary	O
root	B-Application
file-system	B-Application
–	O
now	O
dubbed	O
early	O
user	O
space	O
–	O
is	O
used	O
.	O
</s>
<s>
This	O
root	B-Application
file-system	B-Application
can	O
contain	O
user-space	O
helpers	O
which	O
do	O
the	O
hardware	O
detection	O
,	O
module	B-Application
loading	O
and	O
device	O
discovery	O
necessary	O
to	O
get	O
the	O
real	O
root	B-Application
file-system	B-Application
mounted	O
.	O
</s>
<s>
An	O
image	B-Application
of	O
this	O
initial	O
root	B-Application
file	I-Application
system	I-Application
(	O
along	O
with	O
the	O
kernel	B-Operating_System
image	B-Application
)	O
must	O
be	O
stored	O
somewhere	O
accessible	O
by	O
the	O
Linux	B-Operating_System
bootloader	B-Application
or	O
the	O
boot	O
firmware	O
of	O
the	O
computer	O
.	O
</s>
<s>
This	O
can	O
be	O
the	O
root	B-Application
file	I-Application
system	I-Application
itself	O
,	O
a	O
boot	B-Device
image	I-Device
on	O
an	O
optical	B-Device
disc	I-Device
,	O
a	O
small	O
partition	O
on	O
a	O
local	O
disk	O
(	O
a	O
boot	O
partition	O
,	O
usually	O
using	O
ext2	B-Application
or	O
FAT	B-Application
file	I-Application
systems	I-Application
)	O
,	O
or	O
a	O
TFTP	B-Device
server	O
(	O
on	O
systems	O
that	O
can	O
boot	O
from	O
Ethernet	O
)	O
.	O
</s>
<s>
The	O
bootloader	B-Application
will	O
load	O
the	O
kernel	B-Operating_System
and	O
initial	O
root	B-Application
file	I-Application
system	I-Application
image	B-Application
into	O
memory	B-General_Concept
and	O
then	O
start	O
the	O
kernel	B-Operating_System
,	O
passing	O
in	O
the	O
memory	B-General_Concept
address	O
of	O
the	O
image	B-Application
.	O
</s>
<s>
At	O
the	O
end	O
of	O
its	O
boot	O
sequence	O
,	O
the	O
kernel	B-Operating_System
tries	O
to	O
determine	O
the	O
format	O
of	O
the	O
image	B-Application
from	O
its	O
first	O
few	O
blocks	O
of	O
data	O
,	O
which	O
can	O
lead	O
either	O
to	O
the	O
initrd	B-Application
or	O
initramfs	B-Application
scheme	O
.	O
</s>
<s>
In	O
the	O
initrd	B-Application
scheme	O
,	O
the	O
image	B-Application
may	O
be	O
a	O
file	B-Application
system	I-Application
image	B-Application
(	O
optionally	O
compressed	O
)	O
,	O
which	O
is	O
made	O
available	O
in	O
a	O
special	O
block	O
device	O
(	O
)	O
that	O
is	O
then	O
mounted	O
as	O
the	O
initial	O
root	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
The	O
driver	O
for	O
that	O
file	B-Application
system	I-Application
must	O
be	O
compiled	O
statically	O
into	O
the	O
kernel	B-Operating_System
.	O
</s>
<s>
Many	O
distributions	O
originally	O
used	O
compressed	O
ext2	B-Application
file	B-Application
system	I-Application
images	O
,	O
while	O
the	O
others	O
(	O
including	O
Debian	O
3.1	O
)	O
used	O
cramfs	B-Application
in	O
order	O
to	O
boot	O
on	O
memory-limited	O
systems	O
,	O
since	O
the	O
cramfs	B-Application
image	B-Application
can	O
be	O
mounted	O
in-place	O
without	O
requiring	O
extra	O
space	O
for	O
decompression	O
.	O
</s>
<s>
Once	O
the	O
initial	O
root	B-Application
file	I-Application
system	I-Application
is	O
up	O
,	O
the	O
kernel	B-Operating_System
executes	O
as	O
its	O
first	O
process	O
;	O
when	O
it	O
exits	O
,	O
the	O
kernel	B-Operating_System
assumes	O
that	O
the	O
real	O
root	B-Application
file	I-Application
system	I-Application
has	O
been	O
mounted	O
and	O
executes	O
to	O
begin	O
the	O
normal	O
user-space	O
boot	O
process	O
.	O
</s>
<s>
In	O
the	O
initramfs	B-Application
scheme	O
(	O
available	O
since	O
the	O
Linux	O
kernel	O
2.6.13	O
)	O
,	O
the	O
image	B-Application
may	O
be	O
a	O
cpio	B-Application
archive	O
(	O
optionally	O
compressed	O
)	O
.	O
</s>
<s>
The	O
archive	O
is	O
unpacked	O
by	O
the	O
kernel	B-Operating_System
into	O
a	O
special	O
instance	O
of	O
a	O
tmpfs	B-Application
that	O
becomes	O
the	O
initial	O
root	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
This	O
scheme	O
has	O
the	O
advantage	O
of	O
not	O
requiring	O
an	O
intermediate	O
file	B-Application
system	I-Application
or	O
block	O
drivers	O
to	O
be	O
compiled	O
into	O
the	O
kernel	B-Operating_System
.	O
</s>
<s>
Some	O
systems	O
use	O
the	O
dracut	B-Application
package	O
to	O
create	O
an	O
initramfs	B-Application
image	B-Application
.	O
</s>
<s>
In	O
the	O
initramfs	B-Application
scheme	O
,	O
the	O
kernel	B-Operating_System
executes	O
as	O
its	O
first	O
process	O
that	O
is	O
not	O
expected	O
to	O
exit	O
.	O
</s>
<s>
For	O
some	O
applications	O
,	O
initramfs	B-Application
can	O
use	O
the	O
casper	O
utility	O
to	O
create	O
a	O
writable	O
environment	O
using	O
unionfs	B-Application
to	O
overlay	O
a	O
persistence	O
layer	O
over	O
a	O
read-only	O
root	B-Application
filesystem	I-Application
image	B-Application
.	O
</s>
<s>
For	O
example	O
,	O
overlay	O
data	O
can	O
be	O
stored	O
on	O
a	O
USB	O
flash	O
drive	O
,	O
while	O
a	O
compressed	O
SquashFS	B-Application
read-only	O
image	B-Application
stored	O
on	O
a	O
live	O
CD	O
acts	O
as	O
a	O
root	B-Application
filesystem	I-Application
.	O
</s>
<s>
Depending	O
on	O
which	O
algorithms	O
were	O
compiled	O
statically	O
into	O
it	O
,	O
the	O
kernel	B-Operating_System
can	O
unpack	O
initrd/initramfs	O
images	O
compressed	O
with	O
gzip	B-Application
,	O
bzip2	B-Application
,	O
LZMA	B-General_Concept
,	O
XZ	B-Language
,	O
LZO	B-Language
,	O
LZ4	B-Language
,	O
and	O
zstd	B-Language
.	O
</s>
<s>
Some	O
Linux	B-Application
distributions	I-Application
such	O
as	O
Debian	O
will	O
generate	O
a	O
customized	O
initrd	B-Application
image	B-Application
which	O
contains	O
only	O
whatever	O
is	O
necessary	O
to	O
boot	O
some	O
particular	O
computer	O
,	O
such	O
as	O
ATA	B-Protocol
,	O
SCSI	B-Architecture
and	O
filesystem	B-Application
kernel	B-Application
modules	I-Application
.	O
</s>
<s>
These	O
typically	O
embed	O
the	O
location	O
and	O
type	O
of	O
the	O
root	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
Other	O
Linux	B-Application
distributions	I-Application
(	O
such	O
as	O
Fedora	O
and	O
Ubuntu	B-Operating_System
)	O
generate	O
a	O
more	O
generic	O
initrd	B-Application
image	B-Application
.	O
</s>
<s>
These	O
start	O
only	O
with	O
the	O
device	O
name	O
of	O
the	O
root	B-Application
file	I-Application
system	I-Application
(	O
or	O
its	O
UUID	O
)	O
and	O
must	O
discover	O
everything	O
else	O
at	O
boot	O
time	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
software	O
must	O
perform	O
a	O
complex	O
cascade	O
of	O
tasks	O
to	O
get	O
the	O
root	B-Application
file	I-Application
system	I-Application
mounted	O
:	O
</s>
<s>
Any	O
hardware	B-Application
drivers	I-Application
that	O
the	O
boot	O
process	O
depends	O
on	O
must	O
be	O
loaded	O
.	O
</s>
<s>
A	O
common	O
arrangement	O
is	O
to	O
pack	O
kernel	B-Application
modules	I-Application
for	O
common	O
storage	O
devices	O
onto	O
the	O
initrd	B-Application
and	O
then	O
invoke	O
a	O
hotplug	B-Device
agent	O
to	O
pull	O
in	O
modules	B-Application
matching	O
the	O
computer	O
's	O
detected	O
hardware	O
.	O
</s>
<s>
On	O
systems	O
which	O
display	O
a	O
boot	B-Operating_System
splash	I-Operating_System
screen	I-Operating_System
,	O
the	O
video	O
hardware	O
must	O
be	O
initialized	O
and	O
a	O
user-space	O
helper	O
started	O
to	O
paint	O
animations	O
onto	O
the	O
display	O
in	O
lockstep	O
with	O
the	O
boot	O
process	O
.	O
</s>
<s>
If	O
the	O
root	B-Application
file	I-Application
system	I-Application
is	O
on	O
NFS	B-Protocol
,	O
it	O
must	O
then	O
bring	O
up	O
the	O
primary	O
network	B-Protocol
interface	I-Protocol
,	O
invoke	O
a	O
DHCP	B-Protocol
client	O
,	O
with	O
which	O
it	O
can	O
obtain	O
a	O
DHCP	B-Protocol
lease	O
,	O
extract	O
the	O
name	O
of	O
the	O
NFS	B-Protocol
share	O
and	O
the	O
address	O
of	O
the	O
NFS	B-Protocol
server	O
from	O
the	O
lease	O
,	O
and	O
mount	B-Device
the	O
NFS	B-Protocol
share	O
.	O
</s>
<s>
If	O
the	O
root	B-Application
file	I-Application
system	I-Application
appears	O
to	O
be	O
on	O
a	O
software	O
RAID	B-Architecture
device	O
,	O
there	O
is	O
no	O
way	O
of	O
knowing	O
which	O
devices	O
the	O
RAID	B-Architecture
volume	O
spans	O
;	O
the	O
standard	O
MD	B-Application
utilities	I-Application
must	O
be	O
invoked	O
to	O
scan	O
all	O
available	O
block	O
devices	O
and	O
bring	O
the	O
required	O
ones	O
online	O
.	O
</s>
<s>
If	O
the	O
root	B-Application
file	I-Application
system	I-Application
appears	O
to	O
be	O
on	O
a	O
logical	B-Application
volume	I-Application
,	O
the	O
LVM	B-Application
utilities	O
must	O
be	O
invoked	O
to	O
scan	O
for	O
and	O
activate	O
the	O
volume	B-Application
group	I-Application
containing	O
it	O
.	O
</s>
<s>
If	O
the	O
root	B-Application
file	I-Application
system	I-Application
is	O
on	O
an	O
encrypted	O
block	O
device	O
,	O
the	O
software	O
needs	O
to	O
invoke	O
a	O
helper	O
script	O
to	O
prompt	O
the	O
user	O
to	O
type	O
in	O
a	O
passphrase	O
and/or	O
insert	O
a	O
hardware	O
token	O
(	O
such	O
as	O
a	O
smart	O
card	O
or	O
a	O
USB	O
security	O
dongle	B-Device
)	O
,	O
and	O
then	O
create	O
a	O
decryption	O
target	O
with	O
the	O
device	B-Application
mapper	I-Application
.	O
</s>
<s>
Some	O
distributions	O
use	O
an	O
event-driven	B-Application
hotplug	B-Device
agent	O
such	O
as	O
udev	B-Application
,	O
which	O
invokes	O
helper	O
programs	O
as	O
hardware	O
devices	O
,	O
disk	O
partitions	O
and	O
storage	O
volumes	O
matching	O
certain	O
rules	O
come	O
online	O
.	O
</s>
<s>
This	O
allows	O
discovery	O
to	O
run	O
in	O
parallel	O
,	O
and	O
to	O
progressively	O
cascade	O
into	O
arbitrary	O
nestings	O
of	O
LVM	B-Application
,	O
RAID	B-Architecture
or	O
encryption	O
to	O
get	O
at	O
the	O
root	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
When	O
the	O
root	B-Application
file	I-Application
system	I-Application
finally	O
becomes	O
visible	O
,	O
any	O
maintenance	O
tasks	O
that	O
cannot	O
run	O
on	O
a	O
mounted	O
root	B-Application
file	I-Application
system	I-Application
are	O
done	O
,	O
the	O
root	B-Application
file	I-Application
system	I-Application
is	O
mounted	O
read-only	O
,	O
and	O
any	O
processes	O
that	O
must	O
continue	O
running	O
(	O
such	O
as	O
the	O
splash	O
screen	O
helper	O
and	O
its	O
command	O
FIFO	B-Operating_System
)	O
are	O
hoisted	O
into	O
the	O
newly	O
mounted	O
root	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
The	O
final	O
root	B-Application
file	I-Application
system	I-Application
cannot	O
simply	O
be	O
mounted	O
over	O
,	O
since	O
that	O
would	O
make	O
the	O
scripts	O
and	O
tools	O
on	O
the	O
initial	O
root	B-Application
file	I-Application
system	I-Application
inaccessible	O
for	O
any	O
final	O
cleanup	O
tasks	O
:	O
</s>
<s>
On	O
an	O
initrd	B-Application
,	O
the	O
new	O
root	B-Application
is	O
mounted	O
at	O
a	O
temporary	O
mount	B-Device
point	O
and	O
rotated	O
into	O
place	O
with	O
(	O
which	O
was	O
introduced	O
specifically	O
for	O
this	O
purpose	O
)	O
.	O
</s>
<s>
This	O
leaves	O
the	O
initial	O
root	B-Application
file	I-Application
system	I-Application
at	O
a	O
mount	B-Device
point	O
(	O
such	O
as	O
)	O
where	O
normal	O
boot	O
scripts	O
can	O
later	O
unmount	O
it	O
to	O
free	O
up	O
memory	B-General_Concept
held	O
by	O
the	O
initrd	B-Application
.	O
</s>
<s>
On	O
an	O
initramfs	B-Application
,	O
the	O
initial	O
root	B-Application
file	I-Application
system	I-Application
cannot	O
be	O
rotated	O
away	O
.	O
</s>
<s>
Instead	O
,	O
it	O
is	O
simply	O
emptied	O
and	O
the	O
final	O
root	B-Application
file	I-Application
system	I-Application
mounted	O
over	O
the	O
top	O
.	O
</s>
<s>
Most	O
initial	O
root	B-Application
file	I-Application
systems	I-Application
implement	O
or	O
as	O
a	O
shell	O
script	O
and	O
thus	O
include	O
a	O
minimal	O
shell	O
(	O
usually	O
/bin/ash	B-Operating_System
)	O
along	O
with	O
some	O
essential	O
user-space	O
utilities	O
(	O
usually	O
the	O
BusyBox	B-Application
toolkit	O
)	O
.	O
</s>
<s>
To	O
further	O
save	O
space	O
,	O
the	O
shell	O
,	O
utilities	O
and	O
their	O
supporting	O
libraries	O
are	O
typically	O
compiled	O
with	O
space	O
optimizations	O
enabled	O
(	O
such	O
as	O
with	O
gcc	B-Application
's	O
"	O
-Os	O
"	O
flag	O
)	O
and	O
linked	O
against	O
klibc	B-Language
,	O
a	O
minimal	O
version	O
of	O
the	O
C	B-Language
library	I-Language
written	O
specifically	O
for	O
this	O
purpose	O
.	O
</s>
<s>
Installers	O
for	O
Linux	B-Application
distributions	I-Application
typically	O
run	O
entirely	O
from	O
an	O
initramfs	B-Application
,	O
as	O
they	O
must	O
be	O
able	O
to	O
host	O
the	O
installer	O
interface	O
and	O
supporting	O
tools	O
before	O
any	O
persistent	O
storage	O
has	O
been	O
set	O
up	O
.	O
</s>
<s>
Tiny	O
Core	O
Linux	B-Operating_System
and	O
Puppy	O
Linux	B-Operating_System
can	O
run	O
entirely	O
from	O
initrd	B-Application
.	O
</s>
<s>
Since	O
Windows	O
Vista	O
,	O
Windows	O
can	O
boot	O
from	O
a	O
WIM	O
disk	B-Application
image	I-Application
file	O
,	O
for	O
which	O
the	O
file	O
format	O
is	O
published	O
;	O
it	O
is	O
similar	O
to	O
the	O
ZIP	O
format	O
except	O
that	O
it	O
supports	O
hard	O
links	O
,	O
deduplicated	O
chunks	O
,	O
and	O
uses	O
chunk-by-chunk	O
compression	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
whole	O
WIM	O
is	O
initially	O
loaded	O
into	O
RAM	O
,	O
followed	O
by	O
the	O
kernel	B-Operating_System
initialisation	O
.	O
</s>
<s>
However	O
,	O
this	O
is	O
rarely	O
used	O
since	O
the	O
Windows	O
boot	B-Application
loader	I-Application
is	O
capable	O
of	O
loading	O
the	O
.sys	O
files	O
for	O
boot-time	O
kernel	B-Application
modules	I-Application
itself	O
,	O
which	O
is	O
the	O
task	O
that	O
requires	O
initrd	B-Application
in	O
Linux	B-Operating_System
.	O
</s>
