old-www/HOWTO/Swap-Space-8.html

80 lines
2.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Linux Swap Space Mini-HOWTO: What are we exactly doing ? </TITLE>
<LINK HREF="Swap-Space-9.html" REL=next>
<LINK HREF="Swap-Space-7.html" REL=previous>
<LINK HREF="Swap-Space.html#toc8" REL=contents>
</HEAD>
<BODY>
<A HREF="Swap-Space-9.html">Next</A>
<A HREF="Swap-Space-7.html">Previous</A>
<A HREF="Swap-Space.html#toc8">Contents</A>
<HR>
<H2><A NAME="s8">8. What are we exactly doing ? </A></H2>
<P>
<UL>
<LI><P>
Both Windows and Linux use swap space. When an OS is shut down, the contents of
the swap space are just garbage, the OS doesn't bother about what is in it.
Now what is the point in devoting a 60MB partition for swap space to Linux and
about 32MB of disk space separately to Windows when only one of them is going
to run at a time (It is possible to run both Linux and Windows at the same
time, thanks to VMWare. For more information, see
<A HREF="http://www.vmware.com">VMWare website</A>). So we want Linux and Windows to share the same hard
disk space as swap space.
<P>
<P>
<P>
</LI>
<LI>
<P>
The problem is that Linux uses a partition as a swap space and Windows uses a
file as a swap space. ( Although it is possible to create a swap file for
Linux, it is not recommended. See <EM>"Linux Installation and Getting
Started"</EM> by Matt Welsh). Now if Linux uses the same partition on
which Windows stores it's swap file, it will overwrite the boot sector, FAT
and other data tables that Windows assumes to exist on every drive. Thus,
Windows will not be in a position to find the swap file on startup and will
create the win386.swp file in the windows directory. Thus, even if by chance,
your Linux crashes, Windows will be in a position to start. In such a case
( with Windows swap file in the Windows directory), just restore the
DOS/Windows swap info by restarting Linux and the start Windows. Now Windows
will be using the swap file on drive X: so you can safely delete the
win386.swp file in the windows directory.
<P>
<P>
<P>
</LI>
<LI><P>
The remedy is to store those critical data tables once on the Linux partition
in some file. Then every time Linux starts, check whether the swap space was
last used by Linux or Windows (using the label you gave to your partition).
If it was Linux, just enable swapping else first make a swap partition on the
X: drive using "mkswap /dev/winswap" and then enable swapping.
<P>
<P>
</LI>
<LI><P>
When you shut down Linux, it is important to restore the swap partition to the
DOS format, so that Windows can start properly. For that purpose we add the
<BLOCKQUOTE><CODE>
<PRE>
/bin/zcat /etc/winswap.gz > /dev/winswap
</PRE>
</CODE></BLOCKQUOTE>
<P>command to the halt file.
<P>
</LI>
</UL>
<HR>
<A HREF="Swap-Space-9.html">Next</A>
<A HREF="Swap-Space-7.html">Previous</A>
<A HREF="Swap-Space.html#toc8">Contents</A>
</BODY>
</HTML>