369 lines
7.0 KiB
HTML
369 lines
7.0 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Reducing root filesystem size</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
|
|
"><LINK
|
|
REL="HOME"
|
|
TITLE="The Linux Bootdisk HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Troubleshooting, or The Agony of Defeat"
|
|
HREF="troubleshooting.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Miscellaneous topics"
|
|
HREF="x1014.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"
|
|
>The Linux Bootdisk HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="troubleshooting.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x1014.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="SLIMFAST"
|
|
>8. Reducing root filesystem size</A
|
|
></H1
|
|
><P
|
|
> One of the main problems with building bootdisks is getting everything to fit
|
|
into one (or even two) diskettes. Even when files are compressed this can be
|
|
very difficult, because Linux system components keep growing. Here are some
|
|
common techniques used to make everything fit.</P
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN955"
|
|
>8.1. Increase the diskette density</A
|
|
></H2
|
|
><P
|
|
>By default, floppy diskettes are formatted at 1440K, but higher density
|
|
formats are possible. Whether you can boot from higher density
|
|
disks depends mostly on your BIOS.
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>fdformat</TT
|
|
> will format disks for
|
|
the following sizes: 1600K, 1680K, 1722K, 1743K, 1760K, 1840K, and 1920K.
|
|
See the <B
|
|
CLASS="COMMAND"
|
|
>fdformat</B
|
|
> man page and
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/usr/src/linux/Documentation/devices.txt</TT
|
|
>.</P
|
|
><P
|
|
> But what diskette densities/geometries will your machine support? Here
|
|
are some (lightly edited) answers from Alain Knaff, the author of fdutils.</P
|
|
><A
|
|
NAME="AEN962"
|
|
></A
|
|
><BLOCKQUOTE
|
|
CLASS="BLOCKQUOTE"
|
|
><P
|
|
>This is more an issue of the BIOS rather than the physical format of the disk.
|
|
If the BIOS decides that any sector number greater than 18 is bad, then
|
|
there is not much we can do. Indeed, short of disassembling the BIOS, trial
|
|
and error seems to be the only way to find out. However, if the BIOS supports
|
|
ED disks (extra density: 36 sectors/track and 2.88MB), there's a chance that
|
|
1722K disks are supported as well.</P
|
|
><P
|
|
>Superformatted disks with more than 21 sectors/track are likely not bootable:
|
|
indeed, those use sectors of non-standard sizes (1024 bytes in a sector
|
|
instead of 512, for example), and are likely not bootable. It should however
|
|
be possible to write a special bootsector program to work around this. If I
|
|
remember correctly, the DOS 2m utility has such a beast, as does OS/2's XDF
|
|
utilities.</P
|
|
><P
|
|
>Some BIOSes artificially claim that any sector number greater than 18
|
|
must be in error. As 1722K disks use sector numbers up to 21, these
|
|
would not be bootable. The best way to test would be to format a test
|
|
DOS or syslinus disk as 1722K and make it bootable. If you use LILO,
|
|
don't use the option linear (or else LILO would assume that the disk
|
|
is the default 18 sectors/track, and the disk will fail to boot even
|
|
if supported by the BIOS).</P
|
|
></BLOCKQUOTE
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN966"
|
|
>8.2. Replace common utilities with BusyBox</A
|
|
></H2
|
|
><P
|
|
> Much root filesystem space is consumed by common GNU system utilities
|
|
such as <TT
|
|
CLASS="LITERAL"
|
|
>cat, chmod, cp, dd, df</TT
|
|
>, etc. The
|
|
<EM
|
|
>BusyBox</EM
|
|
> project was designed to provide minimal
|
|
replacements for these common system utilities. BusyBox supplies one single
|
|
monolithic executable file, <TT
|
|
CLASS="LITERAL"
|
|
>/bin/busybox</TT
|
|
>, about 150K, which
|
|
implements the functions of these utilities. You then create symlinks from
|
|
different utilities to this executable; busybox sees how it was called and
|
|
invokes the correct code. BusyBox even includes a basic shell.
|
|
|
|
BusyBox is available in binary packages for many distributions, and source
|
|
code is available from <A
|
|
HREF="http://www.busybox.net/"
|
|
TARGET="_top"
|
|
>the BusyBox
|
|
site</A
|
|
>.
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN973"
|
|
>8.3. Use an alternate shell</A
|
|
></H2
|
|
><P
|
|
> Some of the popular shells for Linux, such as <B
|
|
CLASS="COMMAND"
|
|
>bash</B
|
|
>
|
|
and <B
|
|
CLASS="COMMAND"
|
|
>tcsh</B
|
|
>, are large and require many libraries. If you
|
|
don't use the BusyBox shell, you should still consider replacing your shell
|
|
anyway. Some light-weight alternatives are <B
|
|
CLASS="COMMAND"
|
|
>ash</B
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
>lsh</B
|
|
>, <B
|
|
CLASS="COMMAND"
|
|
>kiss</B
|
|
> and <B
|
|
CLASS="COMMAND"
|
|
>smash</B
|
|
>,
|
|
which are much smaller and require few (or no) libraries. Most of these
|
|
replacement shells are available from <A
|
|
HREF="http://www.ibiblio.org/pub/Linux/system/shells/"
|
|
TARGET="_top"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>http://www.ibiblio.org/pub/Linux/system/shells/</TT
|
|
></A
|
|
>. Make sure any shell you use is capable of running
|
|
commands in all the <TT
|
|
CLASS="FILENAME"
|
|
>rc</TT
|
|
> files you include on your
|
|
bootdisk.
|
|
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN987"
|
|
>8.4. Strip libraries and binaries</A
|
|
></H2
|
|
><P
|
|
> Many libraries and binaries are distributed with debugging information.
|
|
Running <B
|
|
CLASS="COMMAND"
|
|
>file</B
|
|
> on these files will tell you ``<TT
|
|
CLASS="LITERAL"
|
|
>not
|
|
stripped</TT
|
|
>'' if so.
|
|
When copying binaries to
|
|
your root filesystem, it is good practice to use: <TABLE
|
|
BORDER="1"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
> objcopy --strip-all FROM TO</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
<DIV
|
|
CLASS="IMPORTANT"
|
|
><P
|
|
></P
|
|
><TABLE
|
|
CLASS="IMPORTANT"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="25"
|
|
ALIGN="CENTER"
|
|
VALIGN="TOP"
|
|
><IMG
|
|
SRC="../images/important.gif"
|
|
HSPACE="5"
|
|
ALT="Important"></TD
|
|
><TD
|
|
ALIGN="LEFT"
|
|
VALIGN="TOP"
|
|
><P
|
|
>When copying libraries, be sure to use <TT
|
|
CLASS="OPTION"
|
|
>strip-debug</TT
|
|
> instead of
|
|
<TT
|
|
CLASS="OPTION"
|
|
>strip-all</TT
|
|
>.</P
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
> </P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN1008"
|
|
>8.5. Move files to a utility disk</A
|
|
></H2
|
|
><P
|
|
> If some of your binaries are not needed immediately to boot or login,
|
|
you can move them to a utility disk. See <A
|
|
HREF="x1014.html#UTILITYDISK"
|
|
>Section 9.2</A
|
|
> for
|
|
details. You may also consider moving modules to a utility disk as well.
|
|
|
|
</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="troubleshooting.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="x1014.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Troubleshooting, or The Agony of Defeat</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Miscellaneous topics</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |