510 lines
8.9 KiB
HTML
510 lines
8.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Build the LVM 1 kernel module</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="Building the kernel modules"
|
|
HREF="buildkernelmods.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Building the device-mapper module"
|
|
HREF="builddmmod.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="LVM 1 Boot time scripts"
|
|
HREF="boot_scripts.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="builddmmod.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 6. Building the kernel modules</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="boot_scripts.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="sect1"
|
|
><H1
|
|
CLASS="sect1"
|
|
><A
|
|
NAME="buildlvmmod"
|
|
></A
|
|
>6.2. Build the LVM 1 kernel module</H1
|
|
><P
|
|
> To use LVM 1 you will have to build the LVM 1 kernel module
|
|
(recommended), or if you prefer rebuild the kernel with the
|
|
LVM 1 code statically linked into it.
|
|
</P
|
|
><P
|
|
> Your Linux system is probably based on one of the popular
|
|
distributions (eg., Red Hat, SuSE, Debian) in which case it
|
|
is possible that you already have the LVM 1 module. Check
|
|
the version of the tools you have on your system. You can do
|
|
this by running any of the LVM command line tools with the
|
|
'-h' flag. Use <B
|
|
CLASS="command"
|
|
>pvscan -h</B
|
|
> if you don't
|
|
know any of the commands. If the version number listed at
|
|
the top of the help listing is LVM 1.0.8, <STRONG
|
|
>use your current setup</STRONG
|
|
> and avoid the
|
|
rest of this section.
|
|
</P
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="buildlvmpatch"
|
|
></A
|
|
>6.2.1. Building a patch for your kernel</H2
|
|
><P
|
|
> In order to patch the linux kernel to support LVM 1.0.8, you must
|
|
do the following:
|
|
|
|
<P
|
|
></P
|
|
><OL
|
|
TYPE="1"
|
|
><LI
|
|
><P
|
|
> Unpack LVM 1.0.8 </P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <B
|
|
CLASS="command"
|
|
> # tar zxf lvm_1.0.8.tar.gz </B
|
|
>
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></LI
|
|
><LI
|
|
><P
|
|
> Enter the root directory of that version. </P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <B
|
|
CLASS="command"
|
|
> # cd LVM/1.0.8 </B
|
|
>
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></LI
|
|
><LI
|
|
><P
|
|
> Run configure</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <B
|
|
CLASS="command"
|
|
> # ./configure </B
|
|
>
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> You will need to pass the option
|
|
<TT
|
|
CLASS="option"
|
|
>--with-kernel_dir</TT
|
|
> to configure if your
|
|
linux kernel source is not in
|
|
<TT
|
|
CLASS="filename"
|
|
>/usr/src/linux</TT
|
|
>.
|
|
(Run <B
|
|
CLASS="command"
|
|
>./configure --help</B
|
|
> to see all the
|
|
options available)
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> Enter the PATCHES directory</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <B
|
|
CLASS="command"
|
|
> # cd PATCHES </B
|
|
>
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></LI
|
|
><LI
|
|
><P
|
|
> Run 'make'</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <B
|
|
CLASS="command"
|
|
># make </B
|
|
>
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> You should now have a patch called
|
|
<TT
|
|
CLASS="filename"
|
|
>lvm-1.0.8-$KERNELVERSION.patch</TT
|
|
> in the
|
|
patches directory. This is the LVM kernel patch referenced
|
|
in later sections of the howto.
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> Patch the kernel</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <B
|
|
CLASS="command"
|
|
> # cd /usr/src/linux ; patch -pX < /directory/lvm-1.0.8-$KERNELVERSION.patch </B
|
|
>
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></LI
|
|
></OL
|
|
>
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="buildlvm1-2.2"
|
|
></A
|
|
>6.2.2. Building the LVM module for Linux 2.2.17+</H2
|
|
><P
|
|
> The 2.2 series kernel needs to be patched before you can start
|
|
building, look elsewhere for instructions on how to patch your
|
|
kernel.
|
|
</P
|
|
><P
|
|
> Patches:
|
|
</P
|
|
><P
|
|
></P
|
|
><OL
|
|
TYPE="1"
|
|
><LI
|
|
><P
|
|
> <STRONG
|
|
>rawio patch</STRONG
|
|
>
|
|
</P
|
|
><P
|
|
> Stephen Tweedie's raw_io patch which can be found at
|
|
<A
|
|
HREF="http://www.kernel.org/pub/linux/kernel/people/sct/raw-io"
|
|
TARGET="_top"
|
|
>http://www.kernel.org/pub/linux/kernel/people/sct/raw-io</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <STRONG
|
|
>lvm patch</STRONG
|
|
>
|
|
</P
|
|
><P
|
|
> The relevant LVM 1 patch which should be built out
|
|
of the PATCHES sub-directory of the LVM
|
|
distribution. More information can be found in
|
|
<A
|
|
HREF="buildlvmmod.html#buildlvmpatch"
|
|
>Section 6.2.1</A
|
|
>, Building a patch
|
|
for your kernel.
|
|
</P
|
|
></LI
|
|
></OL
|
|
><P
|
|
> Once the patches have been correctly applied, you need to make sure
|
|
that the module is actually built, LVM 1 lives under the block
|
|
devices section of the kernel config, you should probably request
|
|
that the LVM /proc information is compiled as well.
|
|
</P
|
|
><P
|
|
> Build the kernel modules as usual.
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="buildlvm1-2.4"
|
|
></A
|
|
>6.2.3. Building the LVM modules for Linux 2.4</H2
|
|
><P
|
|
> The 2.4 kernel comes with LVM 1 already included although
|
|
you should check at the Sistina web site for updates,
|
|
(eg. v2.4.9 kernels and earlier must have the <A
|
|
HREF="buildlvmmod.html#buildlvmpatch"
|
|
>latest LVM 1 patch</A
|
|
> applied ).
|
|
When configuring your kernel look for LVM 1 under <STRONG
|
|
>Multi-device support (RAID and
|
|
LVM)</STRONG
|
|
>. LVM 1 can be compiled into the kernel or as
|
|
a module. Build your kernel and modules and install then
|
|
in the usual way. If you chose to build LVM as a module it
|
|
will be called <TT
|
|
CLASS="filename"
|
|
>lvm-mod.o</TT
|
|
>
|
|
</P
|
|
><P
|
|
> If you want to use snapshots with ReiserFS, make sure you apply the
|
|
<TT
|
|
CLASS="filename"
|
|
>linux-2.4.x-VFS-lock</TT
|
|
> patch (there are copies
|
|
of this in the
|
|
<TT
|
|
CLASS="filename"
|
|
>LVM/1.0.8/PATCHES</TT
|
|
> directory.)
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="checkproc"
|
|
></A
|
|
>6.2.4. Checking the proc file system</H2
|
|
><P
|
|
> If your kernel was compiled with the /proc file system (most are)
|
|
then you can verify that LVM is present by looking for a /proc/lvm
|
|
directory. If this doesn't exist then you may have to load the
|
|
module with the command
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <B
|
|
CLASS="command"
|
|
> # modprobe lvm-mod </B
|
|
>
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> If <TT
|
|
CLASS="filename"
|
|
> /proc/lvm </TT
|
|
> still does not exist then check
|
|
your kernel configuration carefully.
|
|
</P
|
|
><P
|
|
> When LVM is active you will see entries in
|
|
<TT
|
|
CLASS="filename"
|
|
>/proc/lvm</TT
|
|
> for all your physical volumes,
|
|
volume groups and logical volumes. In addition
|
|
there is a <SPAN
|
|
CLASS="QUOTE"
|
|
>"file"</SPAN
|
|
> called
|
|
<TT
|
|
CLASS="filename"
|
|
>/proc/lvm/global</TT
|
|
> which gives a summary
|
|
of the LVM status and also shows just which version of the LVM
|
|
kernel you are using.
|
|
</P
|
|
></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="builddmmod.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="boot_scripts.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Building the device-mapper module</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="buildkernelmods.html"
|
|
ACCESSKEY="U"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>LVM 1 Boot time scripts</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |