old-www/FAQ/Linux-FAQ/partitions.html

1312 lines
22 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Partitions And Filesystems</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="The Linux FAQ"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Disk Drives"
HREF="disk-drives.html"><LINK
REL="NEXT"
TITLE="System Libraries"
HREF="system-libraries.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"
>The Linux FAQ</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="disk-drives.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="system-libraries.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="partitions"
></A
>5. Partitions And Filesystems</H1
><DIV
CLASS="qandaset"
><DL
><DT
>Q: <A
HREF="partitions.html#virtualized-file-systems-like-raid"
>Does Linux Support Virtualized File Systems Like RAID?</A
></DT
><DT
>Q: <A
HREF="partitions.html#can-linux-share-my-disk-with-dos"
>Can Linux Use the Same Hard Drive as MS-DOS? OS/2? 386BSD? Win95?</A
></DT
><DT
>Q: <A
HREF="partitions.html#how-do-i-access-files-on-my-dos-partition"
>How Do I Access Files on a MS-DOS Partition or Floppy?</A
></DT
><DT
>Q: <A
HREF="partitions.html#support-compressed-ext2-file-systems"
>Does Linux Support Compressed Ext2 File Systems?</A
></DT
><DT
>Q: <A
HREF="partitions.html#can-i-use-my-stacked"
>Can Linux Use Stacked/DBLSPC/Etc. DOS Drives?</A
></DT
><DT
>Q: <A
HREF="partitions.html#can-i-access-os2-hpfs"
>Can Linux Access OS/2 HPFS Partitions?</A
></DT
><DT
>Q: <A
HREF="partitions.html#can-linux-access-amiga-file-systems"
>Can Linux Access Amiga File Systems?</A
></DT
><DT
>Q: <A
HREF="partitions.html#can-linux-access-bsd-sysv"
>Can Linux Access BSD, SysV, Etc. UFS?</A
></DT
><DT
>Q: <A
HREF="partitions.html#can-linux-access-macintosh-file-systems"
>Can Linux Access MacIntosh File Systems?</A
></DT
><DT
>Q: <A
HREF="partitions.html#create-file-system-on-a-floppy"
>How Do I Create a File System on a Floppy?</A
></DT
><DT
>Q: <A
HREF="partitions.html#support-file-system-encryption"
>Does Linux Support File System Encryption?</A
></DT
><DT
>Q: <A
HREF="partitions.html#resize-a-partition-non-destructively"
>How Do I Resize a Partition Non-Destructively?</A
></DT
><DT
>Q: <A
HREF="partitions.html#find-the-journalling-file-system"
>Where Is the Journalling File System on the Net?</A
></DT
><DT
>Q: <A
HREF="partitions.html#swap-area-isnt-working"
>Why Isn't My Virtual Memory Swap Area Working?</A
></DT
><DT
>Q: <A
HREF="partitions.html#add-temporary-swap-space"
>How Do I Add Temporary Swap Space?</A
></DT
></DL
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="virtualized-file-systems-like-raid"
></A
><B
>Q: </B
>Does Linux Support Virtualized File Systems Like RAID?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>The most recent Linux kernels support software RAID, and they will work with RAID disk
controllers.
</P
><P
>An automounter for NFS partitions is part of most
Linux distributions.
</P
><P
>In addition, several virtual file system
projects exist. One of them, the <I
CLASS="citetitle"
>Linux Logical Volume
Manager</I
>, is located at <A
HREF="http://linux.msede.com/lvm/"
TARGET="_top"
><I
CLASS="citetitle"
>http://linux.msede.com/lvm/</I
></A
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="can-linux-share-my-disk-with-dos"
></A
><B
>Q: </B
>Can Linux Use the Same Hard Drive as MS-DOS? OS/2? 386BSD? Win95?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Yes. Linux supports many, many filesystems, including the standard MS-DOS partitioning scheme, so it can share your disk with other operating systems.
</P
><P
>Linux supports all known versions of the Microsoft FAT and VFAT file systems,
including those used by Windows 95, Windows 98, Windows NT, Windows 2000 and Windows ME through loadable kernel modules. In a correctly configured system, they should load automatically when the partitions are mounted.
</P
><P
>Note, however, that many other operating systems may not be exactly
compatible. DOS's <TT
CLASS="filename"
>FDISK.EXE</TT
> and
<TT
CLASS="filename"
>FORMAT.EXE</TT
>, for example, can overwrite data in a Linux
partition, because they sometimes incorrectly use partition data from the
partition's boot sector rather than the partition table.
</P
><P
>In order to prevent programs from doing this, it is a good idea to zero
out under Linux the start of a partition you created, before you use
MS-DOS or whatever to format it. Type:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> $ dd
if=/dev/zero of=/dev/hdXY bs=512 count=1</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>where <EM
>hdXY</EM
> is the relevant partition; e.g.,
<TT
CLASS="filename"
>/dev/hda1</TT
> for the first partition of the first (IDE)
disk.
</P
><P
>Linux can read and write the files on your DOS and OS/2
FAT partitions and floppies using either the DOS file system type built into
the kernel or <B
CLASS="command"
>mtools</B
>.
</P
><P
>There is reportedly a GPL'd OS/2
device driver that will read and write Linux ext2 partitions.
</P
><P
>For information about FAT32 partition support, see
<A
HREF="http://bmrc.berkeley.edu/people/chaffee/fat32.html"
TARGET="_top"
><I
CLASS="citetitle"
>http://bmrc.berkeley.edu/people/chaffee/fat32.html</I
></A
>.
</P
><P
>See <A
HREF="app-management.html#what-software-does-linux-support"
><I
>What Software does Linux Support?</I
></A
> for details and status of the
emulators for DOS, MS Windows, and System V programs.
</P
><P
>See also, "Can Linux access Amiga file systems?", "Can Linux access Macintosh
file systems?", "Can Linux access BSD, SysV, etc., UFS?", and "Can Linux
access SMB file systems?"
</P
><P
>There are said to be NTFS drivers under development, which should support compression
as a standard feature.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="how-do-i-access-files-on-my-dos-partition"
></A
><B
>Q: </B
>How Do I Access Files on a MS-DOS Partition or Floppy?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Use the DOS file system, type, for example:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> $ mkdir /dos $
mount -t msdos -o conv=text,umask=022,uid=100,gid=100 /dev/hda3 /dos</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>If it's a floppy, don't forget to <B
CLASS="command"
>umount</B
> it before ejecting it!
</P
><P
>You can use the
<TT
CLASS="literal"
>conv=text/binary/auto</TT
>, <TT
CLASS="literal"
>umask=nnn</TT
>,
<TT
CLASS="literal"
>uid=nnn</TT
>, and <TT
CLASS="literal"
>gid=nnn</TT
> options to control
the automatic line-ending conversion, permissions and ownerships of the files
in the DOS file system as they appear under Linux. If you mount your DOS file
system by putting it in your <TT
CLASS="filename"
>/etc/fstab</TT
>, you can record
the options (comma-separated) there, instead of defaults.
</P
><P
>Alternatively, you can use mtools, available in both binary and source form
on the FTP sites. See <A
HREF="linux-distributions.html#get-linux-material-by-ftp"
><I
>Where Are the Linux FTP Archives?</I
></A
>.
</P
><P
>A kernel patch (known as the fd-patches) is available which allows floppies
with nonstandard numbers of tracks and/or sectors to be used; this patch is
included in the 1.1 alpha testing kernel series.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="support-compressed-ext2-file-systems"
></A
><B
>Q: </B
>Does Linux Support Compressed Ext2 File Systems?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>The <TT
CLASS="literal"
>ext2compr</TT
> project provides a kernel patch Information
about them is located at <A
HREF="http://e2ompr.memalpha.cx/e2compr/"
TARGET="_top"
><I
CLASS="citetitle"
>http://e2ompr.memalpha.cx/e2compr/</I
></A
>.
</P
><P
>There is also a Web site for the e2compr patches. The code is still
experimental and consists of patches for the 2.0 and 2.1 kernels. For more
information about the project, including the latest patches, and the address
of the mailing list, look up the URL at <A
HREF="http://debs.fuller.edu/e2compr/"
TARGET="_top"
><I
CLASS="citetitle"
>http://debs.fuller.edu/e2compr/</I
></A
>.
</P
><P
>[Roderich Schupp, Peter Moulder
</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
><I
CLASS="citetitle"
>zlibc</I
> is a program that allows existing applications
to read compressed (GNU gzip'ed) files as if they were not compressed. Look
at <A
HREF="ftp://metalab.unc.edu/pub/Linux/libs/"
TARGET="_top"
><I
CLASS="citetitle"
>ftp://metalab.unc.edu/pub/Linux/libs/</I
></A
>. The author
is Alain Knaff.
</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>There is also a compressing block device
driver, "DouBle," by Jean-Marc Verbavatz, which can provide on-the-fly disk
compression in the kernel. The source-only distribution is located at
<A
HREF="ftp://metalab.unc.edu/pub/Linux/patches/diskdrives/"
TARGET="_top"
><I
CLASS="citetitle"
>ftp://metalab.unc.edu/pub/Linux/patches/diskdrives/</I
></A
>.
This driver compresses inodes and directory information as well as
files, so any corruption of the file system is likely to be serious.
</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>There is also a package called tcx (Transparently Compressed
Executables), which allows you to keep infrequently used executables
compressed and only uncompress them temporarily when in use. It is located at
<A
HREF="ftp://metalab.unc.edu/pub/Linux/utils/compress/"
TARGET="_top"
><I
CLASS="citetitle"
>ftp://metalab.unc.edu/pub/Linux/utils/compress/</I
></A
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="can-i-use-my-stacked"
></A
><B
>Q: </B
>Can Linux Use Stacked/DBLSPC/Etc. DOS Drives?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Until recently, not very
easily. You can access DOS 6.X volumes from the DOS emulator ("What software
does Linux support? "), but it's harder than accessing a normal DOS volume
via the DOS kernel option, a module, or mtools.
</P
><P
>There is a
recently added package, dmsdos, that reads and writes compressed file systems
like DoubleSpace/DriveSpace in MS-DOS 6.x and Win95, as well as Stacker
versions 3 and 4. It is a loadable kernel module. Look at
<A
HREF="ftp://metalab.unc.edu/pub/Linux/system/filesystems/dosfs/"
TARGET="_top"
><I
CLASS="citetitle"
>ftp://metalab.unc.edu/pub/Linux/system/filesystems/dosfs/</I
></A
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="can-i-access-os2-hpfs"
></A
><B
>Q: </B
>Can Linux Access OS/2 HPFS Partitions?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Yes, but Linux access to HPFS partitions is
read-only. HPFS file system access is available as an option when compiling
the kernel or as a module. See the
<TT
CLASS="filename"
>Documentation/filesystems/hpfs.txt</TT
> file in the kernel
source distribution. See <A
HREF="development.html#upgrade-recompile-kernel"
><I
>How To Upgrade/Recompile a Kernel</I
></A
>.
Then you can mount HPFS partition, using, for example:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> $ mkdir /hpfs $ mount -t hpfs
/dev/hda5 /hpfs</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="can-linux-access-amiga-file-systems"
></A
><B
>Q: </B
>Can Linux Access Amiga File Systems?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>The Linux kernel has support
for the Amiga Fast File System (AFFS) version 1.3 and later, both as a
compile-time option and as a module. The file
<TT
CLASS="filename"
>Documentation/filesystems/affs.txt</TT
> in the Linux kernel
source distribution has more information.
</P
><P
>See <A
HREF="development.html#upgrade-recompile-kernel"
><I
>How To Upgrade/Recompile a Kernel</I
></A
>.
</P
><P
>Linux supports AFFS hard-drive partitions only. Floppy access
is not supported due to incompatibilities between Amiga floppy controllers
and PC and workstation controllers. The AFFS driver can also mount disk
partitions used by the Un*x Amiga Emulator, by Bernd Schmidt.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="can-linux-access-bsd-sysv"
></A
><B
>Q: </B
>Can Linux Access BSD, SysV, Etc. UFS?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Recent kernels can mount (read only) the
UFS file system used by System V; Coherent; Xenix; BSD; and derivatives like
SunOS, FreeBSD, NetBSD, and NeXTStep. UFS support is available as a kernel
compile-time option and a module.
</P
><P
>See <A
HREF="development.html#upgrade-recompile-kernel"
><I
>How To Upgrade/Recompile a Kernel</I
></A
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="can-linux-access-macintosh-file-systems"
></A
><B
>Q: </B
>Can Linux Access MacIntosh File Systems?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>There is a set of user-level programs that read and write the older Macintosh Hierarchical File
System (HFS). It is available at
<TT
CLASS="filename"
>metalab.unc.edu/pub/Linux/utils/disk-management/</TT
>.
</P
><P
>Access to the newer, HFS+ file systems is still under development.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="create-file-system-on-a-floppy"
></A
><B
>Q: </B
>How Do I Create a File System on a Floppy?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>If you are running recent Gnome or KDE desktops, you have a GUI tool that makes formatting floppies easy.
</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>To format a 3.5-inch, high density floppy at the command prompt:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> $ fdformat /dev/fd0H1440
$ mkfs -t ext2 -m 0 /dev/fd0H1440 1440</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>For a 5.25 inch floppy, use <TT
CLASS="filename"
>/dev/fd0h1200</TT
> and 1200 as appropriate.
For the <TT
CLASS="filename"
>B:</TT
> drive use <TT
CLASS="filename"
>/dev/fd1</TT
>
instead of <TT
CLASS="filename"
>/dev/fd0</TT
>.
</P
><P
>The <B
CLASS="command"
>-m 0</B
> option tells <SPAN
CLASS="application"
>mkfs.ext2</SPAN
>
not to reserve any space on the
disk for the superuserusually the last 10% is reserved for root.
</P
><P
>The first command performs a low-level format. The second creates an
empty file system. You can mount the floppy like a hard disk partition and
simply <B
CLASS="command"
>cp</B
> and <B
CLASS="command"
>mv</B
> files, etc.
</P
><P
>Device naming conventions generally are the same as for other unices.
They can be found in Matt Welsh's <I
CLASS="citetitle"
>Installation and Getting
Started</I
> guide. Refer to <A
HREF="online-resources.html#howtos-and-other-documentation"
><I
>Where Is the Documentation?</I
></A
>.
A more detailed and technical
description is <I
CLASS="citetitle"
>Linux Allocated Devices</I
> by H. Peter
Anvin, <A
HREF="mailto:hpa@zytor.com"
TARGET="_top"
><I
CLASS="citetitle"
>hpa@zytor.com</I
></A
>,
which is included in LaTeX and ASCII form in the kernel source distribution
(probably in <TT
CLASS="filename"
>/usr/src/kernel/Documentation/</TT
>), as
<TT
CLASS="filename"
>devices.tex</TT
> and <TT
CLASS="filename"
>devices.txt</TT
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="support-file-system-encryption"
></A
><B
>Q: </B
>Does Linux Support File System Encryption?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Yes. One file system, ppdd, is archived at <A
HREF="http://pweb.de.uu.net/flexsys.mtk/"
TARGET="_top"
><I
CLASS="citetitle"
>http://pweb.de.uu.net/flexsys.mtk/</I
></A
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="resize-a-partition-non-destructively"
></A
><B
>Q: </B
>How Do I Resize a Partition Non-Destructively?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Use the <B
CLASS="command"
>FIPS.EXE</B
> program, included with most Linux
distributions,under MS-DOS.
</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>GNU <B
CLASS="command"
>parted</B
>, a partition editor, is stable enough for non-guru, mere-mortal use with
relative confidence. Source code for the latest version is at: <A
HREF="ftp://ftp.gnu.org/pub/gnu/parted/"
TARGET="_top"
><I
CLASS="citetitle"
>ftp://ftp.gnu.org/pub/gnu/parted/</I
></A
>. There's also a
boot disk image for resizing root partitions and for running <B
CLASS="command"
>parted</B
>
on non-Linux machines. The disk image may be easier
for beginners. Building from source could require some extra configuration.
</P
><P
>Parted also has tutorial-style, plain-text documentation for
Linux and FAT (MS-DOS) file systems.
</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Also, some commercial distributions come with their own partitioning software,
like <SPAN
CLASS="application"
>Partition Magic</SPAN
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="find-the-journalling-file-system"
></A
><B
>Q: </B
>Where Is the Journalling File System on the Net?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Linux actually supports several journalling file systems. ext3 is now included in current 2.4.x kernels.
</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>The journalling file system named <SPAN
CLASS="application"
>Reiserfs</SPAN
> has just been released from testing. It is said to make Linux even faster than Linux with the
<SPAN
CLASS="application"
>Ext2</SPAN
> file system installed, particularly when dealing with many small files.
</P
><P
>Complete information is available at <A
HREF="http://devlinux.org/namesys/"
TARGET="_top"
><I
CLASS="citetitle"
>http://devlinux.org/namesys/</I
></A
>.
</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>JFS is still under development.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="swap-area-isnt-working"
></A
><B
>Q: </B
>Why Isn't My Virtual Memory Swap Area Working?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>When you boot (or enable swapping manually) you should see
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> Adding Swap: NNNNk swap-space</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>If you don't see any messages at all you are probably missing
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> swapon -av </PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>(the command to enable swapping) in your <TT
CLASS="filename"
>/etc/rc.local</TT
> or
<TT
CLASS="filename"
>/etc/rc.d/*</TT
> (the system
startup scripts), or have forgotten to make the right entry in <TT
CLASS="filename"
>/etc/fstab</TT
>:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> /dev/hda2 none swap
sw </PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>for example.
</P
><P
>If you see:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> Unable to find swap-space signature</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>you have forgotten to run <B
CLASS="command"
>mkswap</B
>. See the manual page for
details; it works much like <B
CLASS="command"
>mkfs</B
>.
</P
><P
>Running the command <B
CLASS="command"
>free</B
>, in addition to showing free memory, should display:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> total used free Swap: 10188 2960 7228</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>If typing <TT
CLASS="literal"
>cat /proc/swaps</TT
> reveals only file or
partition names, but no swap space information, then the swap file or
partition needs re-initialization.
</P
><P
>Use <B
CLASS="command"
>fdisk</B
> (as root) to determine which partition on a hard
drive has been designated as the swap partition. The partition still needs to
be initialized with <B
CLASS="command"
>mkswap</B
> before enabling it with
<B
CLASS="command"
>swapon</B
>.
</P
><P
>[Andy Jefferson, Steve Withers]
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="add-temporary-swap-space"
></A
><B
>Q: </B
>How Do I Add Temporary Swap Space?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>In addition to a swap partition, Linux
can also use a swap file. Some programs, like <SPAN
CLASS="application"
>g++</SPAN
>,
can use huge amounts of virtual memory, requiring the temporary creation of
extra space. To install an extra 64 MB of swap space, for example, use the
following shell commands:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
># dd if=/dev/zero of=/swap bs=1024 count=65535
# mkswap /swap
# swapon /swap</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>The <B
CLASS="command"
>count=</B
> argument to <B
CLASS="command"
>dd</B
> determines how
big the swap file will be. In this example the swap file's name is
<TT
CLASS="filename"
>/swap</TT
>, but the name and location are, generally,
arbitrary, depending only on the file system's available space and your
having write permissions in the directory.
</P
><P
>When you don't need the swap space any more, remove it with the following statements:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
># swapoff /swap
# rm /swap</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>Take a look also at the <I
CLASS="citetitle"
>Installation HOWTO</I
> and
<I
CLASS="citetitle"
>Installation &#38; Getting Started</I
> for detailed
instructions.
</P
><P
>If that still doesn't provide enough swap space,
refer to <A
HREF="tips.html#more-than-128mb-of-swap"
><I
>How To Have More Than 128Mb of Swap</I
></A
>.
</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="disk-drives.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="system-libraries.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Disk Drives</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>System Libraries</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>