⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node62.html

📁 linux管理操作指南!大家看看就知道!很不错的!无解压密码!
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--Converted with LaTeX2HTML 96.1-h (September 30, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<HTML>
<HEAD>
<TITLE>使用对换空间</TITLE>
<META NAME="description" CONTENT="Using a swap space">
<META NAME="keywords" CONTENT="sag">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<LINK REL=STYLESHEET HREF="sag.css" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/sag.css">
</HEAD>
<BODY LANG="EN" >
 <A NAME="tex2html1074" HREF="node63.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node63.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="next_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/next_motif.gif"></A> <A NAME="tex2html1072" HREF="node59.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node59.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="up_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/up_motif.gif"></A> <A NAME="tex2html1066" HREF="node61.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node61.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/previous_motif.gif"></A> <A NAME="tex2html1076" HREF="node1.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/contents_motif.gif"></A> <A NAME="tex2html1077" HREF="node108.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node108.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="index_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html1075" HREF="node63.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node63.html">Sharing swap spaces with </A>
<B>Up:</B> <A NAME="tex2html1073" HREF="node59.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node59.html">Memory Management</A>
<B> Previous:</B> <A NAME="tex2html1067" HREF="node61.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node61.html">Creating a swap space</A>
<BR> <P>
<H1><A NAME="SECTION00630000000000000000">使用对换空间</A></H1>
<P>
用<tt>swapon</tt><A NAME="1903">&#160;</A>将一个初始化的对换空间可用。
此命令告诉核心对换空间可以用了,对换空间的路径作为参数,启动一个临时对换文件可以用如下命令:
		<BLOCKQUOTE> <TT>
<code>$</code> <I>swapon /extra-swap</I> <BR> 
<code>$</code>
		</TT></BLOCKQUOTE>
对换空间如果列入<tt>/etc/fstab</tt><A NAME="1905">&#160;</A>,就可自动使用。
		<BLOCKQUOTE> <TT>
<code>/dev/hda8        none        swap        sw     0     0</code> <BR> 
<code>/swapfile        none        swap        sw     0     0</code>
		</TT></BLOCKQUOTE>
启动手稿运行命令<tt>swapon -a</tt>, 它将启动<tt>/etc/fstab</tt><A NAME="1907">&#160;</A>中所列的
所有对换空间。因此<tt>swapon</tt><A NAME="1909">&#160;</A>命令只有在启动额外的对换空间时才使用。
<P>
可以用<tt>free</tt><A NAME="1911">&#160;</A>监视对换空间的使用,它将给出所有使用的对换空间。
		<BLOCKQUOTE> <TT>
<code>$</code> <I>free</I> <BR> 
<code>             total       used       free     shared    buffers</code> <BR> 
<code>Mem:         15152      14896        256      12404       2528</code> <BR> 
<code>-/+ buffers:            12368       2784</code> <BR> 
<code>Swap:        32452       6684      25768</code> <BR> 
<code>$</code>
		</TT></BLOCKQUOTE>
前一行输出(<code>Mem:</code>)显示物理内存。
Total列不显示核心使用的物理内存(通常大约1MB)。Used列显示被使用的内存总额(第二行不计缓冲)。
Free列显示全部没使用的内存。Shared列显示多个进程共享的内存总额。Buffers列显示磁盘缓存的当前大小。
<P>
后一行(<code>Swap:</code>)对对换空间,显示的信息类似上面。
如果这行为全0,那么没使用对换空间。
<P>
通过<tt>top</tt><A NAME="1913">&#160;</A>,或使用<tt>proc</tt>文件系统的<tt>/proc/meminfo</tt><A NAME="1915">&#160;</A>
文件可以得到相同的信息。得到某个对换空间的使用信息目前还比较困难。
<P>
可用<tt>swapoff</tt><A NAME="1917">&#160;</A>取消对换空间,一般不必这样,除非是临时对换空间。
对换空间中的要用的页被换入(swap->RAM),如果没有足够的物理内存,就被换出(RAM->swap,到其他对换空间)。
如果没有足够的虚拟内存放进所有页面,Linux将开始震荡(thrash); 很长时间以后应该能恢复,但此时系统不可用。
取消一个对换空间前,应该检查(例如用<tt>free</tt><A NAME="1919">&#160;</A>)是否有足够的物理内存。
<P>
用<tt>swapon -a</tt>自动使用的所有对换空间可以用<tt>swapoff -a</tt>取消。
它查看文件<tt>/etc/fstab</tt><A NAME="1921">&#160;</A>得知要取消什么。
任何手工起用的对换空间将依然使用着。
<P>
即使有许多空闲的物理内存,有时许多对换空间也被使用着。这种情况是由于在某个时间需要对换,
但后来一个占用大量物理内存的大进程终止并释放了内存。直到被换出的数据要被使用之前它们并
不自动换入。不必顾虑这种情况,但知道为什么会发生这种情况会更安心。
<P>
<HR><A NAME="tex2html1074" HREF="node63.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node63.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="next_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/next_motif.gif"></A> <A NAME="tex2html1072" HREF="node59.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node59.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="up_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/up_motif.gif"></A> <A NAME="tex2html1066" HREF="node61.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node61.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/previous_motif.gif"></A> <A NAME="tex2html1076" HREF="node1.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/contents_motif.gif"></A> <A NAME="tex2html1077" HREF="node108.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node108.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="index_motif.gif" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html1075" HREF="node63.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node63.html">Sharing swap spaces with </A>
<B>Up:</B> <A NAME="tex2html1073" HREF="node59.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node59.html">Memory Management</A>
<B> Previous:</B> <A NAME="tex2html1067" HREF="node61.html" tppabs="http://linux.ccpi.gov.cn/Linux/linuxadmin/node61.html">Creating a swap space</A>
<P><ADDRESS>
<I>Lars Wirzenius <BR>
Sun Jun 29 13:31:22 EEST 1997</I>
</ADDRESS>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -