Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > 965e33040dd61030a94f0eb89877aee8 > files > 891

howto-html-en-20080722-2mdv2010.1.noarch.rpm

<HTML
><HEAD
><TITLE
>Adding Support for More Loop Devices </TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
"><LINK
REL="HOME"
TITLE="CDServer-HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Procedure"
HREF="procedure.html"><LINK
REL="NEXT"
TITLE="More Information"
HREF="moreinfo.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>CDServer-HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="procedure.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="moreinfo.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="addloops"
>3. Adding Support for More Loop Devices</A
></H1
><P
>&#13;	Newer Linux kernels (2.4) allow you to add more loop devices easily by
	editing <TT
CLASS="filename"
>/etc/modules.conf</TT
> or through the use of a boot parameter.
</P
><P
>&#13;	Older kernels (2.2 ?) only had
	support for 8 loop devices compiled into the kernel.  In short, you were
	only able to share 8 CD's on a network with this default value.
	In order to support more than that default, you needed to modify the kernel source
	and recompile a new kernel.
</P
><P
>&#13;Use the following methods to determine which version of the kernel you are running.
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>bash#</TT
> <B
CLASS="command"
>uname -a</B
>
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;or
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>bash#</TT
> <B
CLASS="command"
>cat /proc/version</B
>
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="loopmodule"
>3.1. Adding the Loop Module Option</A
></H2
><P
>&#13;	Current kernels allow you to set the number of loop devices supported
	without recompiling the kernel.  One of these methods is to add an options
	line to <TT
CLASS="filename"
>/etc/modules.conf</TT
>. 
	This method will only work if your loop support
	has been configured as a loadable kernel module (which is how most major
	Linux distributions come preconfigured now).
</P
><P
>&#13;	Edit <TT
CLASS="filename"
>/etc/modules.conf</TT
> and add the following line.
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;options loop max_loop=64
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;	After making the above change, simply reboot.  Or you can try to use
	<B
CLASS="command"
>rmmod</B
> and <B
CLASS="command"
>insmod</B
> to make the change 
	on the fly - but this will not work
	if you currently have any loop devices mounted (you'll get an error saying 
	loop: Device or resource busy).
</P
><P
></P
><DIV
CLASS="variablelist"
><DL
><DT
>Note</DT
><DD
><P
>&#13;	If you do not have an <TT
CLASS="filename"
>/etc/modules.conf</TT
> file, your module configuration
	file may be called <TT
CLASS="filename"
>/etc/conf.modules</TT
> (this name is now deprecated).
</P
></DD
></DL
></DIV
><P
>&#13;	Continue with <A
HREF="addloops.html#loopdev"
>Section 3.4</A
>.
</P
><P
>&#13;<EM
>&#13;	Thanks to Paul A. Sand for pointing out the /etc/modules.conf option.
</EM
>
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="bootprompt"
>3.2. Appending to the Boot Prompt</A
></H2
><P
>&#13;	If your loop support has been compiled directly into the kernel (in other words,
	it is not loaded as a module), you can append the number of loop devices you would
	like to support at the linux boot prompt.
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>boot:</TT
>  <B
CLASS="command"
>linux <TT
CLASS="parameter"
><I
>max_loop=<TT
CLASS="replaceable"
><I
>64</I
></TT
></I
></TT
></B
>
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;	Or, if you are using <SPAN
CLASS="application"
><SPAN
CLASS="acronym"
>LILO</SPAN
></SPAN
>, 
	you can edit your linux boot 
	stanza in <TT
CLASS="filename"
>/etc/lilo.conf</TT
> and add/modify
	the <TT
CLASS="parameter"
><I
>append=</I
></TT
> line.  Here is an example stanza showing 
	<TT
CLASS="parameter"
><I
>append=</I
></TT
> (<EM
>note: only add or modify the append line,
	don't change your whole stanza to look like this one or your system
	may not boot</EM
>).  For more information about LILO, consult the
<A
HREF="http://www.linuxdoc.org/HOWTO/mini/LILO.html"
TARGET="_top"
>LILO mini-HOWTO</A
> at
<SPAN
CLASS="systemitem"
>http://www.linuxdoc.org/HOWTO/mini/LILO.html</SPAN
>.
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;image=/boot/vmlinuz
        label=linux
        root=/dev/hdb5
        initrd=/boot/initrd.img

	append=<TT
CLASS="replaceable"
><I
>" max_loop=64"</I
></TT
>

        vga=788
        read-only
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;	After changing <TT
CLASS="filename"
>/etc/lilo.conf</TT
>, you need to run 
	the <B
CLASS="command"
>lilo</B
> command for your changes to take effect.
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>bash#</TT
> <B
CLASS="command"
>lilo</B
>

<TT
CLASS="computeroutput"
>&#13;Added linux *
Added linux-nonfb
Added failsafe
Added windows
Added floppy
</TT
>
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13;	Next restart your system.  After your system restarts, you can check your boot command line by typing the following:
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>bash#</TT
> <B
CLASS="command"
>cat /proc/cmdline</B
>
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
></P
><DIV
CLASS="variablelist"
><DL
><DT
>Note</DT
><DD
><P
>&#13;	I am not sure if the loop module (compiled as a module) reads 
	<TT
CLASS="filename"
>/proc/cmdline</TT
> when
	the module is loaded, and therefore may not need an options line 
	<TT
CLASS="filename"
>/etc/modules.conf</TT
>. 
	It's possible that it can (and if it doesn't, it should). 
	To summarize:  I have not tested this.
</P
></DD
></DL
></DIV
><P
>&#13;	Continue with <A
HREF="addloops.html#loopdev"
>Section 3.4</A
>.
</P
><P
>&#13;<EM
>&#13;	Thanks to Tony Melia for the boot prompt info.
</EM
>
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="editkernel"
>3.3. Tweaking the Kernel</A
></H2
><P
>&#13;	If you have an older kernel (v. 2.2) or if you are completely comfortable
	recompiling the kernel, you can increase the number of loop devices supported by
	editing the <TT
CLASS="filename"
>/usr/src/linux/drivers/block/loop.c</TT
> file.
</P
><P
></P
><DIV
CLASS="variablelist"
><DL
><DT
>Note</DT
><DD
><P
>&#13;If you find that the kernel sources are not installed on your machine, 
you'll need to consult your Linux Distribution's documentation on 
how to install them (the Kernel Sources come with all distributions - 
it's part of the <SPAN
CLASS="acronym"
>GNU</SPAN
> <SPAN
CLASS="acronym"
>GPL</SPAN
> licensing).
</P
></DD
></DL
></DIV
><P
>&#13;Change the number in the following line to however many loop devices
you'll need.
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;#define MAX_LOOP <TT
CLASS="replaceable"
><I
>16</I
></TT
>
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;Compile the new kernel or module as the case may be.  If you need some
help getting started with this, read <TT
CLASS="filename"
>/usr/src/linux/README</TT
> or consult
<A
HREF="http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html"
TARGET="_top"
>&#13;The Linux Kernel HOWTO</A
>.
</P
><P
>&#13;	Continue with <A
HREF="addloops.html#loopdev"
>Section 3.4</A
>.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="loopdev"
>3.4. Creating the Loop Devices in /dev</A
></H2
><P
>&#13;	You should check how many <TT
CLASS="filename"
>/dev</TT
> entries you have for loop devices.
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>bash#</TT
> <B
CLASS="command"
>ls -l /dev/loop*</B
>
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;	The <B
CLASS="command"
>mknod</B
> command creates the devices in the 
	<TT
CLASS="filename"
>/dev</TT
> directory.  The loop devices have a major
	number of <SPAN
CLASS="QUOTE"
>"7"</SPAN
>, and the minor numbers begin at <SPAN
CLASS="QUOTE"
>"0"</SPAN
>. 
	If your <TT
CLASS="parameter"
><I
>MAX_LOOP</I
></TT
> was defined as <SPAN
CLASS="QUOTE"
>"8"</SPAN
> in 
	<TT
CLASS="filename"
>/usr/src/linux/drivers/block/loop.c</TT
>, you should have 
	<TT
CLASS="filename"
>/dev/loop0</TT
> through 
	<TT
CLASS="filename"
>/dev/loop7</TT
>. 
	To create the <TT
CLASS="filename"
>/dev/loop8</TT
> device, 
	use the following command (subsitute the appropriate number you need for 
	both the <SPAN
CLASS="QUOTE"
>"8's"</SPAN
> in the example below).
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>bash#</TT
> <B
CLASS="command"
>mknod -m660 /dev/loop<TT
CLASS="replaceable"
><I
>8</I
></TT
> b 7 <TT
CLASS="replaceable"
><I
>8</I
></TT
></B
>
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;	Check Owner/Group &#38; Permissions on the new file (using <B
CLASS="command"
>ls -l</B
>). 
	You can change the owner and group with the following command:
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>bash#</TT
> <B
CLASS="command"
>chown root.disk /dev/loop8</B
>
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;You can change the permissions using the following command:
</P
><P
>&#13;<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>bash#</TT
> <B
CLASS="command"
>chmod 666 /dev/loop8</B
>
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="procedure.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="moreinfo.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Procedure</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>More Information</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>