old-www/HOWTO/LVM-HOWTO/lvm2faq.html

993 lines
20 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>LVM 2 FAQ</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="LVM HOWTO"
HREF="index.html"><LINK
REL="UP"
TITLE="Frequently Asked Questions"
HREF="faq.html"><LINK
REL="PREVIOUS"
TITLE="Frequently Asked Questions"
HREF="faq.html"><LINK
REL="NEXT"
TITLE="LVM 1 FAQ"
HREF="lvm1faq.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>LVM HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="faq.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Frequently Asked Questions</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="lvm1faq.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="lvm2faq"
></A
>4.1. LVM 2 FAQ</H1
><DIV
CLASS="qandaset"
><DL
><DT
>4.1.1. <A
HREF="lvm2faq.html#AEN279"
>&#13; I have LVM 1 installed and running on my system. How do
I start using LVM 2?
</A
></DT
><DT
>4.1.2. <A
HREF="lvm2faq.html#AEN298"
>&#13; Do I need a special lvm2 kernel module?
</A
></DT
><DT
>4.1.3. <A
HREF="lvm2faq.html#AEN303"
>&#13; I get errors about
<TT
CLASS="filename"
>/dev/mapper/control</TT
> when I try to
use the LVM 2 tools. What's going on?
</A
></DT
><DT
>4.1.4. <A
HREF="lvm2faq.html#AEN326"
>&#13; Which commands and types of logical volumes are
currently supported in LVM 2?
</A
></DT
><DT
>4.1.5. <A
HREF="lvm2faq.html#AEN338"
>&#13; Does LVM 2 use a different format from LVM 1 for it's
ondisk representation of Volume Groups and Logical
Volumes?
</A
></DT
><DT
>4.1.6. <A
HREF="lvm2faq.html#AEN343"
>&#13; Does LVM 2 support VGs and LVs created with LVM 1?
</A
></DT
><DT
>4.1.7. <A
HREF="lvm2faq.html#AEN348"
>&#13; Can I upgrade my LVM 1 based VGs and LVs to LVM 2 native
format?
</A
></DT
><DT
>4.1.8. <A
HREF="lvm2faq.html#AEN353"
>&#13; I've upgraded to LVM 2, but the tools keep failing with out
of memory errors. What gives?
</A
></DT
><DT
>4.1.9. <A
HREF="lvm2faq.html#AEN359"
>&#13; I have my root partition on an LV in LVM 1. How do I
upgrade to LVM 2? And what happened to lvmcreate_initrd?
</A
></DT
><DT
>4.1.10. <A
HREF="lvm2faq.html#AEN383"
>&#13; How resilient is LVM to a sudden renumbering of
physical hard disks?
</A
></DT
><DT
>4.1.11. <A
HREF="lvm2faq.html#AEN391"
>&#13; I'm trying to fill my vg, and vgdisplay/vgs says that I
have 1.87 GB free, but when I do an lvcreate vg -L1.87G
it says "insufficient free extends". What's going on?
</A
></DT
><DT
>4.1.12. <A
HREF="lvm2faq.html#AEN401"
>&#13; How are snapshots in LVM2 different from LVM1?
</A
></DT
><DT
>4.1.13. <A
HREF="lvm2faq.html#AEN407"
>&#13; What is the maximum size of a single LV?
</A
></DT
></DL
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN279"
></A
><B
>4.1.1. </B
>
I have LVM 1 installed and running on my system. How do
I start using LVM 2?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
Here's the Quick Start instructions :)
<P
></P
><OL
TYPE="1"
><LI
><P
>&#13; Start by removing any snapshot LVs on the system.
These are not handled by LVM 2 and will prevent the
origin from being activated when LVM 2 comes up.
</P
></LI
><LI
><P
>&#13; Make sure you have some way of booting the system
other than from your standard boot partition. Have
the LVM 1 tools, standard system tools (mount) and
an LVM 1 compatible kernel on it in case you need to
get back and fix some things.
</P
></LI
><LI
><P
>&#13; Grab the LVM 2 tools source and the device mapper
source and compile them. You need to install the
device mapper library using <SPAN
CLASS="QUOTE"
>"make
install"</SPAN
> before compiling the LVM 2 tools.
Also copy the dm/scripts/devmap_mknod.sh script into
/sbin. I recommend only installing the 'lvm' binary
for now so you have access to the LVM 1 tools if you
need them. If you have access to packages for LVM 2
and device-mapper, you can install those instead,
but beware of them overwriting your LVM 1 tool set.
</P
></LI
><LI
><P
>&#13; Get a device mapper compatible kernel, either built
in or as a kernel module.
</P
></LI
><LI
><P
>&#13; Figure out where LVM 1 was activated in your startup
scripts. Make sure the device-mapper module is
loaded by that point (if you are using device mapper
as a module) and add '/sbin/devmap_mknod.sh; lvm
vgscan; lvm vgchange -ay' afterward.
</P
></LI
><LI
><P
>&#13; Install the kernel with device mapper support in it.
Reboot. If all goes well, you should be running with
lvm2.
</P
></LI
></OL
>
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN298"
></A
><B
>4.1.2. </B
>
Do I need a special lvm2 kernel module?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
No. You need device-mapper. The lvm2 tools use
device-mapper to interface with the kernel and do all
their device mapping (hence the name device-mapper). As
long as you have device-mapper, you should be able to
use LVM2.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN303"
></A
><B
>4.1.3. </B
>
I get errors about
<TT
CLASS="filename"
>/dev/mapper/control</TT
> when I try to
use the LVM 2 tools. What's going on?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
The primary cause of this is not having run the
<SPAN
CLASS="QUOTE"
>"dmsetup mknodes"</SPAN
> after rebooting into a dm
capable kernel. This script generates the control node
for device mapper.
</P
><P
>&#13; If you don't have the <SPAN
CLASS="QUOTE"
>"dmsetup mknodes"</SPAN
>,
don't despair! (Though you should probably upgrade to
the latest version of device-mapper.) It's pretty easy
to create the <TT
CLASS="filename"
>/dev/mapper/control</TT
>
file on your own:
<P
></P
><OL
TYPE="1"
><LI
><P
>&#13; Make sure you have the device-mapper module loaded
(if you didn't build it into your kernel).
</P
></LI
><LI
><P
>&#13; Run
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
># cat /proc/misc | grep device-mapper | awk '{print $1}'</PRE
></FONT
></TD
></TR
></TABLE
>
and note the number
printed. (If you don't get any output, refer to
step 1.)
</P
></LI
><LI
><P
>&#13; Run <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
># mkdir /dev/mapper</PRE
></FONT
></TD
></TR
></TABLE
> - if you
get an error saying
<TT
CLASS="filename"
>/dev/mapper</TT
> already exists,
make sure it's a directory and move on.
</P
></LI
><LI
><P
>&#13; Run
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
># mknod /dev/mapper/control c 10 $number</PRE
></FONT
></TD
></TR
></TABLE
>
where $number is the number printed in step 2.
</P
></LI
></OL
>
You should be all set now!
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN326"
></A
><B
>4.1.4. </B
>
Which commands and types of logical volumes are
currently supported in LVM 2?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
If you are using the stable 2.4 device mapper patch from
the lvm2 tarball, all the major functionality you'd
expect using lvm1 is supported with the lvm2 tools.
(You still need to remove snapshots before upgrading
from lvm1 to lvm2)
</P
><P
>&#13; If you are using the version of device mapper in the 2.6
kernel.org kernel series the following commands and LV
types are not supported:
<P
></P
><UL
><LI
><P
> pvmove </P
></LI
><LI
><P
> snapshots </P
></LI
></UL
>
The beginnings of support for these features are in the
<A
HREF="http://people.sistina.com/~thornber/dm/"
TARGET="_top"
>&#13; unstable device mapper patches</A
> maintained by Joe
Thornber.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN338"
></A
><B
>4.1.5. </B
>
Does LVM 2 use a different format from LVM 1 for it's
ondisk representation of Volume Groups and Logical
Volumes?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
Yes. LVM 2 uses lvm 2 format metadata. This format is much
more flexible than the LVM 1 format metadata, removing
or reducing most of the limitations LVM 1 had.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN343"
></A
><B
>4.1.6. </B
>
Does LVM 2 support VGs and LVs created with LVM 1?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
Yes. LVM 2 will activate and operate on VG and LVs created
with LVM 1. The exception to this is snapshots created with
LVM 1 - these should be removed before upgrading. Snapshots
that remain after upgrading will have to be removed before
their origins can be activated by LVM 2.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN348"
></A
><B
>4.1.7. </B
>
Can I upgrade my LVM 1 based VGs and LVs to LVM 2 native
format?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
Yes. Use vgconvert to convert your VG and all LVs contained
within it to the new lvm 2 format metadata. Be warned that it's
not always possible to revert back to lvm 1 format metadata.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN353"
></A
><B
>4.1.8. </B
>
I've upgraded to LVM 2, but the tools keep failing with out
of memory errors. What gives?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
One possible cause of this is that some versions of LVM
1 (The user that reported this bug originally was using
Mandrake 9.2, but it is not necessarily limited to that
distribution) did not put a UUID into the PV and VG
structures as they were supposed to. The most current
versions of the LVM 2 tools automatically fill UUIDs in
for the structures if they see they are missing, so you
should grab a more current version and your problem
should be solved. If not, post to the <A
HREF="maillists.html"
>linux-lvm mailing list</A
>
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN359"
></A
><B
>4.1.9. </B
>
I have my root partition on an LV in LVM 1. How do I
upgrade to LVM 2? And what happened to lvmcreate_initrd?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
Upgrading to LVM 2 is a bit trickier with root on LVM,
but it's not impossible. You need to queue up a kernel
with device-mapper support and install the lvm2 tools
(you might want to make a backup of the lvm 1 tools, or
find a rescue disk with the lvm tools built in, in case
you need them before you're done). Then find a mkinitrd
script that has support for your distro and lvm 2.
</P
><P
>&#13; Currently, this is the list of mkinitrd scripts that I
know support lvm2, sorted by distro:
<P
></P
><DIV
CLASS="variablelist"
><P
><B
>mkinitrd scripts with lvm 2 support</B
></P
><DL
><DT
>fedora</DT
><DD
><P
>&#13; The latest fedora core 2 <A
HREF="http://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/development/i386/Fedora/RPMS/mkinitrd-3.5.21-1.i386.rpm"
TARGET="_top"
>mkinitrd</A
>
handles lvm2, but it relies on a statically
built lvm binary from the latest lvm 2 tarball.
</P
><P
>&#13; Redhat 9 users may be able to use this as well
</P
></DD
><DT
>Debian</DT
><DD
><P
>&#13; There is an unofficial version <A
HREF="http://www.poochiereds.net/svn/lvm2/"
TARGET="_top"
>here</A
>
</P
></DD
><DT
>Generic</DT
><DD
><P
>&#13; There is a version in the lvm2 source tree under
<TT
CLASS="filename"
>scripts/lvm2_createinitrd/</TT
>.
See the documentation in that directory for more
details.
</P
></DD
></DL
></DIV
>
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN383"
></A
><B
>4.1.10. </B
>
How resilient is LVM to a sudden renumbering of
physical hard disks?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
It's fine - LVM identifies PVs by UUID, not by device
name.
</P
><P
>&#13; Each disk (PV) is labeled with a UUID, which uniquely
identifies it to the system. 'vgscan' identifies this
after a new disk is added that changes your drive
numbering. Most distros run vgscan in the lvm startup
scripts to cope with this on reboot after a hardware
addition. If you're doing a hot-add, you'll have to run
this by hand I think. On the other hand, if your vg is
activated and being used, the renumbering should not
affect it at all. It's only the activation that needs
the identifier, and the worst case scenario is that the
activation will fail without a vgscan with a complaint
about a missing PV.
</P
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>&#13; The failure or removal of a drive that LVM is
currently using will cause problems with current use
and future activations of the VG that was using it.
</P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN391"
></A
><B
>4.1.11. </B
>
I'm trying to fill my vg, and vgdisplay/vgs says that I
have 1.87 GB free, but when I do an lvcreate vg -L1.87G
it says "insufficient free extends". What's going on?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
The 1.87 GB figure is rounded to 2 decimal places, so
it's probably 1.866 GB or something. This is a
human-readable output to give you a general idea of how
big the VG is. If you want to specify an exact size,
you must use extents instead of some multiple of bytes.
</P
><P
>&#13; In the case of vgdisplay, use the Free PE count instead
of the human readable capacity.
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; Free PE / Size 478 / 1.87 GB
^^^
</PRE
></FONT
></TD
></TR
></TABLE
>
So, this would indicate that you should do run
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;# lvcreate vg -l478 </PRE
></FONT
></TD
></TR
></TABLE
> Note that instead of an upper-case 'L',
we used a lower-case 'l' to tell lvm to use extents
instead of bytes.
</P
><P
>&#13; In the case of vgs, you need to instruct it to tell you how many extents are available:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;# vgs -o +vg_free_count,vg_extent_count
</PRE
></FONT
></TD
></TR
></TABLE
>
This tell vgs to add the free extents and the total
number of extents to the end of the vgs listing. Use
the free extent number the same way you would in the
above vgdisplay case.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN401"
></A
><B
>4.1.12. </B
>
How are snapshots in LVM2 different from LVM1?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
In LVM2 snapshots are read/write by default, whereas in
LVM1, snapshots were only read-only. See <A
HREF="snapshotintro.html"
>Section 3.8</A
> for more details
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN407"
></A
><B
>4.1.13. </B
>
What is the maximum size of a single LV?
</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>
The answer to this question depends upon the CPU
architecture of your computer and the kernel you are a
running:
<P
></P
><UL
><LI
><P
>&#13; For 2.4 based kernels, the maximum LV size is 2TB.
For some older kernels, however, the limit was 1TB
due to signedness problems in the block layer.
Red Hat Enterprise Linux 3 Update 5 has fixes to
allow the full 2TB LVs. Consult your distribution
for more information in this regard.
</P
></LI
><LI
><P
>&#13; For 32-bit CPUs on 2.6 kernels, the maximum LV size is 16TB.
</P
></LI
><LI
><P
>&#13; For 64-bit CPUs on 2.6 kernels, the maximum LV
size is 8EB. (Yes, that is a very large number.)
</P
></LI
></UL
>
</P
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="faq.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="lvm1faq.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Frequently Asked Questions</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="faq.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>LVM 1 FAQ</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>