fstab.html
来自「Linux From Scratch的中文指导,学习LINUX很有用」· HTML 代码 · 共 102 行
HTML
102 行
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=gb2312" />
<title>
8.2. Creating the /etc/fstab File
</title>
<link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1" />
<link rel="stylesheet" href="../stylesheets/lfs-print.css" type="text/css" media="print" />
</head>
<body id="lfs" class="6.1">
<div class="navheader">
<div class="headertitles">
<h4>
Linux From Scratch - Version 6.1
</h4>
<h3>
Chapter 8. 引导 LFS 系统
</h3>
</div>
<ul class="headerlinks">
<li class="prev">
<a accesskey="p" href="chapter08.html" title="Making the LFS System Bootable">后退</a>
<p>
Making the LFS System Bootable
</p>
</li>
<li class="next">
<a accesskey="n" href="kernel.html" title="Linux-2.6.11.12">前进</a>
<p>
Linux-2.6.11.12
</p>
</li>
<li class="up">
<a accesskey="u" href="chapter08.html" title="Chapter 8. 引导 LFS 系统">上一级</a>.
</li>
<li class="home">
<a accesskey="h" href="../index.html" title="Linux From Scratch - Version 6.1">回首页</a>
</li>
</ul>
</div>
<div class="sect1" lang="zh_cn" xml:lang="zh_cn">
<div class="titlepage">
<h1 class="sect1">
8.2. 创建 /etc/fstab 文件</h1>
</div>
<p><tt class="filename">/etc/fstab</tt> 文件被一些程序用来确定哪些文件系统默认要加载,哪些需要检查,顺序是怎样的。如下新建一个文件系统表:</p>
<pre class="userinput"><kbd class="command">cat > /etc/fstab << "EOF"
<tt class="literal"># Begin /etc/fstab
# file system mount-point type options dump fsck
# order
/dev/<em class="replaceable"><tt>[xxx]</tt></em> / <em class="replaceable"><tt>[fff]</tt></em> defaults 1 1
/dev/<em class="replaceable"><tt>[yyy]</tt></em> swap swap pri=1 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devpts /dev/pts devpts gid=4,mode=620 0 0
shm /dev/shm tmpfs defaults 0 0
# End /etc/fstab</tt>
EOF</kbd></pre>
<p>
将 <em class="replaceable"><tt>[xxx]</tt></em>, <em class="replaceable"><tt>[yyy]</tt></em>, <em class="replaceable"><tt>[fff]</tt></em> 替换为您系统上相应的值,例如 <tt class="filename">hda2</tt>, <tt class="filename">hda5</tt>, <tt class="systemitem">ext2</tt> ,要了解文件里六个字段的详细信息,请运行 <span><strong class="command">man 5 fstab</strong></span> 命令。</p>
<p>
如果您使用的是日志文件系统,一行中最后的 <em class="parameter"><tt>1
1</tt></em> 应该替换为 <em class="parameter"><tt>0 0</tt></em> ,因为这样的分区不需要转储或检查。</p>
<p>
将 <tt class="systemitem">tmpfs</tt> 挂载到 <tt class="filename">/dev/shm</tt> 以便启用 POSIX 共享内存的功能,内核必须编入了配套的支持才能使用这个功能(更多的信息请看下一节)。请注意,目前很少有软件使用了 POSIX 共享内存的功能,因此,<tt class="filename">/dev/shm</tt> 挂载点是可选的。要获得更多信息,请参考内核源码树中的 <tt class="filename">Documentation/filesystems/tmpfs.txt</tt> 文件。</p>
<p>
您还可以在 <tt class="filename">/etc/fstab</tt> 文件里添加其它行,下面是 USB 设备的一个例子:</p>
<pre class="screen">
usbfs /proc/bus/usb usbfs devgid=14,devmode=0660 0 0 </pre>
<p>
只有内核编入了“Support for Host-side USB”和“USB device filesystem”(不能编译为模块),这个选项才会起作用。如果
“<span class="quote">Support for Host-side USB</span>” 已经编译为模块了,那么 <tt class="filename">usbcore</tt> 必须被列在 <tt class="filename">/etc/sysconfig/modules</tt> 文件中。</p>
</div>
<div class="navfooter">
<ul>
<li class="prev">
<a accesskey="p" href="chapter08.html" title="Making the LFS System Bootable">后退</a>
<p>
Making the LFS System Bootable
</p>
</li>
<li class="next">
<a accesskey="n" href="kernel.html" title="Linux-2.6.11.12">前进</a>
<p>
Linux-2.6.11.12
</p>
</li>
<li class="up">
<a accesskey="u" href="chapter08.html" title="Chapter 8. 引导 LFS 系统">上一级</a>.
</li>
<li class="home">
<a accesskey="h" href="../index.html" title="Linux From Scratch - Version 6.1">回首页</a>.
</li>
</ul>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?