<s>
In	O
Linux	B-Operating_System
,	O
Logical	B-Application
Volume	I-Application
Manager	I-Application
(	O
LVM	O
)	O
is	O
a	O
device	B-Application
mapper	I-Application
framework	O
that	O
provides	O
logical	B-Application
volume	I-Application
management	I-Application
for	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
.	O
</s>
<s>
Most	O
modern	O
Linux	B-Application
distributions	I-Application
are	O
LVM-aware	O
to	O
the	O
point	O
of	O
being	O
able	O
to	O
have	O
their	O
root	B-Application
file	I-Application
systems	I-Application
on	O
a	O
logical	B-Application
volume	I-Application
.	O
</s>
<s>
Heinz	O
Mauelshagen	O
wrote	O
the	O
original	O
LVM	O
code	O
in	O
1998	O
,	O
when	O
he	O
was	O
working	O
at	O
Sistina	O
Software	O
,	O
taking	O
its	O
primary	O
design	O
guidelines	O
from	O
the	O
HP-UX	B-Application
'	O
s	O
volume	B-Application
manager	I-Application
.	O
</s>
<s>
Creating	O
single	O
logical	B-Application
volumes	I-Application
of	O
multiple	O
physical	O
volumes	O
or	O
entire	O
hard	B-Device
disks	I-Device
(	O
somewhat	O
similar	O
to	O
RAID	B-Architecture
0	O
,	O
but	O
more	O
similar	O
to	O
JBOD	O
)	O
,	O
allowing	O
for	O
dynamic	O
volume	O
resizing	O
.	O
</s>
<s>
Managing	O
large	O
hard	B-Device
disk	I-Device
farms	O
by	O
allowing	O
disks	O
to	O
be	O
added	O
and	O
replaced	O
without	O
downtime	O
or	O
service	O
disruption	O
,	O
in	O
combination	O
with	O
hot	B-Device
swapping	I-Device
.	O
</s>
<s>
Performing	O
consistent	O
backups	O
by	O
taking	O
snapshots	B-Application
of	O
the	O
logical	B-Application
volumes	I-Application
.	O
</s>
<s>
LVM	O
can	O
be	O
considered	O
as	O
a	O
thin	O
software	O
layer	O
on	O
top	O
of	O
the	O
hard	B-Device
disks	I-Device
and	O
partitions	O
,	O
which	O
creates	O
an	O
abstraction	O
of	O
continuity	O
and	O
ease-of-use	O
for	O
managing	O
hard	B-Device
drive	I-Device
replacement	O
,	O
repartitioning	O
and	O
backup	O
.	O
</s>
<s>
Volume	B-Application
groups	I-Application
(	O
VGs	O
)	O
can	O
be	O
resized	O
online	O
by	O
absorbing	O
new	O
physical	O
volumes	O
(	O
PVs	O
)	O
or	O
ejecting	O
existing	O
ones	O
.	O
</s>
<s>
Logical	B-Application
volumes	I-Application
(	O
LVs	O
)	O
can	O
be	O
resized	O
online	O
by	O
concatenating	O
extents	B-Application
onto	O
them	O
or	O
truncating	O
extents	B-Application
from	O
them	O
.	O
</s>
<s>
Hybrid	O
volumes	O
can	O
be	O
created	O
using	O
the	O
dm-cache	B-Application
target	O
,	O
which	O
allows	O
one	O
or	O
more	O
fast	O
storage	O
devices	O
,	O
such	O
as	O
flash-based	O
SSDs	B-Device
,	O
to	O
act	O
as	O
a	O
cache	B-General_Concept
for	O
one	O
or	O
more	O
slower	O
hard	B-Device
disk	I-Device
drives	I-Device
.	O
</s>
<s>
On	O
newer	O
versions	O
of	O
device	B-Application
mapper	I-Application
,	O
LVM	O
is	O
integrated	O
with	O
the	O
rest	O
of	O
device	B-Application
mapper	I-Application
enough	O
to	O
ignore	O
the	O
individual	O
paths	O
that	O
back	O
a	O
dm-multipath	O
device	O
if	O
devices/multipath_component_detection	O
=	O
1	O
is	O
set	O
in	O
lvm.conf	O
.	O
</s>
<s>
LVs	O
can	O
be	O
created	O
to	O
include	O
RAID	B-Architecture
functionality	O
,	O
including	O
RAID	B-Architecture
1	O
,	O
5	O
and	O
6	O
.	O
</s>
<s>
Entire	O
LVs	O
or	O
their	O
parts	O
can	O
be	O
striped	O
across	O
multiple	O
PVs	O
,	O
similarly	O
to	O
RAID	B-Architecture
0	O
.	O
</s>
<s>
Recovery	O
rate	O
can	O
be	O
limited	O
using	O
lvchange	O
--raidmaxrecoveryrate	O
and	O
lvchange	O
--raidminrecoveryrate	O
to	O
maintain	O
acceptable	O
I/O	O
performance	O
while	O
rebuilding	O
a	O
LV	O
that	O
includes	O
RAID	B-Architecture
functionality	O
.	O
</s>
<s>
The	O
LVM	O
also	O
works	O
in	O
a	O
shared-storage	O
cluster	B-Architecture
in	O
which	O
disks	O
holding	O
the	O
PVs	O
are	O
shared	O
between	O
multiple	O
host	O
computers	O
,	O
but	O
can	O
require	O
an	O
additional	O
daemon	O
to	O
mediate	O
metadata	O
access	O
via	O
a	O
form	O
of	O
locking	O
.	O
</s>
<s>
A	O
distributed	B-Operating_System
lock	I-Operating_System
manager	I-Operating_System
is	O
used	O
to	O
broker	O
concurrent	O
LVM	O
metadata	O
accesses	O
.	O
</s>
<s>
Whenever	O
a	O
cluster	B-Architecture
node	O
needs	O
to	O
modify	O
the	O
LVM	O
metadata	O
,	O
it	O
must	O
secure	O
permission	O
from	O
its	O
local	O
clvmd	O
,	O
which	O
is	O
in	O
constant	O
contact	O
with	O
other	O
clvmd	O
daemons	O
in	O
the	O
cluster	B-Architecture
and	O
can	O
communicate	O
a	O
desire	O
to	O
get	O
a	O
lock	O
on	O
a	O
particular	O
set	O
of	O
objects	O
.	O
</s>
<s>
Cluster-awareness	O
is	O
left	O
to	O
the	O
application	O
providing	O
the	O
high	O
availability	O
function	O
.	O
</s>
<s>
,	O
a	O
stable	O
LVM	O
component	O
that	O
is	O
designed	O
to	O
replace	O
clvmd	O
by	O
making	O
the	O
locking	O
of	O
LVM	O
objects	O
transparent	O
to	O
the	O
rest	O
of	O
LVM	O
,	O
without	O
relying	O
on	O
a	O
distributed	B-Operating_System
lock	I-Operating_System
manager	I-Operating_System
.	O
</s>
<s>
The	O
file	O
system	O
selected	O
to	O
be	O
on	O
top	O
of	O
such	O
LVs	O
must	O
either	O
support	O
clustering	O
by	O
itself	O
(	O
such	O
as	O
GFS2	B-Application
or	O
VxFS	B-Application
)	O
or	O
it	O
must	O
only	O
be	O
mounted	O
by	O
a	O
single	O
cluster	B-Architecture
node	O
at	O
any	O
time	O
(	O
such	O
as	O
in	O
an	O
active-passive	O
configuration	O
)	O
.	O
</s>
<s>
In	O
RAID	B-Architecture
configurations	O
,	O
almost	O
all	O
policies	O
are	O
applied	O
to	O
each	O
leg	O
in	O
isolation	O
.	O
</s>
<s>
For	O
example	O
,	O
even	O
if	O
a	O
LV	O
has	O
a	O
policy	O
of	O
cling	O
,	O
expanding	O
the	O
file	O
system	O
will	O
not	O
result	O
in	O
LVM	O
using	O
a	O
PV	O
if	O
it	O
is	O
already	O
used	O
by	O
one	O
of	O
the	O
other	O
legs	O
in	O
the	O
RAID	B-Architecture
setup	O
.	O
</s>
<s>
LVs	O
with	O
RAID	B-Architecture
functionality	O
will	O
put	O
each	O
leg	O
on	O
different	O
PVs	O
,	O
making	O
the	O
other	O
PVs	O
unavailable	O
to	O
any	O
other	O
given	O
leg	O
.	O
</s>
<s>
This	O
can	O
help	O
mitigate	O
fragmentation	O
as	O
well	O
as	O
reduce	O
vulnerability	O
of	O
particular	O
LVs	O
should	O
a	O
device	O
go	O
down	O
,	O
by	O
reducing	O
the	O
likelihood	O
that	O
other	O
LVs	O
also	O
have	O
extents	B-Application
on	O
that	O
PV	O
.	O
</s>
<s>
Normal	O
–	O
implies	O
near-indiscriminate	O
selection	O
of	O
PEs	O
,	O
but	O
it	O
will	O
attempt	O
to	O
keep	O
parallel	O
legs	O
(	O
such	O
as	O
those	O
of	O
a	O
RAID	B-Architecture
setup	O
)	O
from	O
sharing	O
a	O
physical	O
device	O
.	O
</s>
<s>
Highly	O
risky	O
in	O
a	O
RAID	B-Architecture
setup	O
as	O
it	O
ignores	O
isolation	O
requirements	O
,	O
undercutting	O
most	O
of	O
the	O
benefits	O
of	O
RAID	B-Architecture
.	O
</s>
<s>
Typically	O
,	O
the	O
first	O
megabyte	O
of	O
each	O
physical	O
volume	O
contains	O
a	O
mostly	O
ASCII-encoded	O
structure	O
referred	O
to	O
as	O
an	O
"	O
LVM	O
header	O
"	O
or	O
"	O
LVM	O
head	O
"	O
.	O
</s>
<s>
Each	O
PV	O
's	O
header	O
is	O
a	O
complete	O
copy	O
of	O
the	O
entire	O
volume	B-Application
group	I-Application
's	O
layout	O
,	O
including	O
the	O
UUIDs	O
of	O
all	O
other	O
PVs	O
and	O
of	O
LVs	O
,	O
and	O
allocation	O
map	O
of	O
PEs	O
to	O
LEs	O
.	O
</s>
<s>
In	O
the	O
2.6-series	O
of	O
the	O
Linux	B-Operating_System
Kernel	I-Operating_System
,	O
the	O
LVM	O
is	O
implemented	O
in	O
terms	O
of	O
the	O
device	B-Application
mapper	I-Application
,	O
a	O
simple	O
block-level	O
scheme	O
for	O
creating	O
virtual	B-Application
block	I-Application
devices	I-Application
and	O
mapping	O
their	O
contents	O
onto	O
other	O
block	O
devices	O
.	O
</s>
<s>
This	O
minimizes	O
the	O
amount	O
of	O
relatively	O
hard-to-debug	O
kernel	B-Operating_System
code	O
needed	O
to	O
implement	O
the	O
LVM	O
.	O
</s>
<s>
It	O
also	O
allows	O
its	O
I/O	O
redirection	O
services	O
to	O
be	O
shared	O
with	O
other	O
volume	B-Application
managers	I-Application
(	O
such	O
as	O
EVMS	B-Application
)	O
.	O
</s>
<s>
To	O
bring	O
a	O
volume	B-Application
group	I-Application
online	O
,	O
the	O
"	O
vgchange	O
"	O
tool	O
:	O
</s>
<s>
Computes	O
the	O
layouts	O
of	O
all	O
visible	O
volume	B-Application
groups	I-Application
.	O
</s>
<s>
Loops	O
over	O
each	O
logical	B-Application
volume	I-Application
in	O
the	O
volume	B-Application
group	I-Application
to	O
be	O
brought	O
online	O
and	O
:	O
</s>
<s>
Checks	O
if	O
the	O
logical	B-Application
volume	I-Application
to	O
be	O
brought	O
online	O
has	O
all	O
its	O
PVs	O
visible	O
.	O
</s>
<s>
Maps	O
it	O
(	O
with	O
the	O
"	O
linear	O
"	O
target	O
)	O
onto	O
the	O
data	O
areas	O
of	O
the	O
PVs	O
the	O
logical	B-Application
volume	I-Application
belongs	O
to	O
.	O
</s>
<s>
To	O
move	O
an	O
online	O
logical	B-Application
volume	I-Application
between	O
PVs	O
on	O
the	O
same	O
Volume	B-Application
Group	I-Application
,	O
use	O
the	O
"	O
pvmove	O
"	O
tool	O
:	O
</s>
<s>
The	O
kernel	B-Operating_System
will	O
start	O
the	O
mirror	O
in	O
"	O
degraded	O
"	O
mode	O
and	O
begin	O
copying	O
data	O
from	O
the	O
original	O
to	O
the	O
destination	O
to	O
bring	O
it	O
into	O
sync	O
.	O
</s>
<s>
These	O
device	B-Application
mapper	I-Application
operations	O
take	O
place	O
transparently	O
,	O
without	O
applications	O
or	O
file	O
systems	O
being	O
aware	O
that	O
their	O
underlying	O
storage	O
is	O
moving	O
.	O
</s>
<s>
Until	O
Linux	O
kernel	O
2.6.31	O
,	O
write	B-General_Concept
barriers	I-General_Concept
were	O
not	O
supported	O
(	O
fully	O
supported	O
in	O
2.6.33	O
)	O
.	O
</s>
<s>
This	O
means	O
that	O
the	O
guarantee	O
against	O
filesystem	O
corruption	O
offered	O
by	O
journaled	B-Application
file	I-Application
systems	I-Application
like	O
ext3	B-Application
and	O
XFS	B-Application
was	O
negated	O
under	O
some	O
circumstances	O
.	O
</s>
<s>
Fragmentation	O
still	O
occurs	O
,	O
however	O
,	O
and	O
if	O
it	O
is	O
to	O
be	O
reduced	O
,	O
non-contiguous	O
extents	B-Application
must	O
be	O
identified	O
and	O
manually	O
rearranged	O
using	O
the	O
pvmove	O
command	O
.	O
</s>
<s>
Most	O
Linux	B-Application
distributions	I-Application
keep	O
a	O
running	O
backup	O
in	O
/etc/lvm/backup	O
,	O
which	O
enables	O
manual	O
rewriting	O
of	O
a	O
corrupted	O
LVM	O
head	O
using	O
the	O
vgcfgrestore	O
command	O
.	O
</s>
