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

📄 x4069.html

📁 FreeBSD安装说明概述 FreeBSD 提供了一个以文字为主
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Disk Organization</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD 使用手册" href="index.html" /><link rel="UP" title="UNIX Basics" href="basics.html" /><link rel="PREVIOUS" title="Directory Structure" href="dirstructure.html" /><link rel="NEXT" title="Mounting and Unmounting File Systems"href="mount-unmount.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /></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">FreeBSD 使用手册</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="dirstructure.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 3. UNIX Basics</td><td width="10%" align="right" valign="bottom"><a href="mount-unmount.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="AEN4069" name="AEN4069">3.5. Disk Organization</a></h1><p>The smallest unit of organization that FreeBSD uses to find files is the filename.Filenames are case-sensitive, which means that <tt class="FILENAME">readme.txt</tt> and<tt class="FILENAME">README.TXT</tt> are two separate files. FreeBSD does not use theextension (<tt class="FILENAME">.txt</tt>) of a file to determine whether the file isprogram, or a document, or some other form of data.</p><p>Files are stored in directories. A directory may contain no files, or it may containmany hundreds of files. A directory can also contain other directories, allowing you tobuild up a hierarchy of directories within one another. This makes it much easier toorganize your data.</p><p>Files and directories are referenced by giving the file or directory name, followed bya forward slash, <var class="LITERAL">/</var>, followed by any other directory names thatare necessary. If you have directory <tt class="FILENAME">foo</tt>, which containsdirectory <tt class="FILENAME">bar</tt>, which contains the file <ttclass="FILENAME">readme.txt</tt>, then the full name, or <i class="FIRSTTERM">path</i> tothe file is <tt class="FILENAME">foo/bar/readme.txt</tt>.</p><p>Directories and files are stored in a filesystem. Each filesystem contains exactly onedirectory at the very top level, called the <i class="FIRSTTERM">root directory</i> forthat filesystem. This root directory can then contain other directories.</p><p>So far this is probably similar to any other operating system you may have used. Thereare a few differences; for example, DOS uses <var class="LITERAL">\</var> to separatefile and directory names, while <span class="TRADEMARK">Mac&nbsp;OS</span>&reg; uses <varclass="LITERAL">:</var>.</p><p>FreeBSD does not use drive letters, or other drive names in the path. You would notwrite <tt class="FILENAME">c:/foo/bar/readme.txt</tt> on FreeBSD.</p><p>Instead, one filesystem is designated the <i class="FIRSTTERM">root filesystem</i>.The root filesystem's root directory is referred to as <var class="LITERAL">/</var>.Every other filesystem is then <i class="FIRSTTERM">mounted</i> under the rootfilesystem. No matter how many disks you have on your FreeBSD system, every directoryappears to be part of the same disk.</p><p>Suppose you have three filesystems, called <var class="LITERAL">A</var>, <varclass="LITERAL">B</var>, and <var class="LITERAL">C</var>. Each filesystem has one rootdirectory, which contains two other directories, called <var class="LITERAL">A1</var>,<var class="LITERAL">A2</var> (and likewise <var class="LITERAL">B1</var>, <varclass="LITERAL">B2</var> and <var class="LITERAL">C1</var>, <varclass="LITERAL">C2</var>).</p><p>Call <var class="LITERAL">A</var> the root filesystem. If you used the <ttclass="COMMAND">ls</tt> command to view the contents of this directory you would see twosubdirectories, <var class="LITERAL">A1</var> and <var class="LITERAL">A2</var>. Thedirectory tree looks like this:</p><p><img src="install/example-dir1.png" /></p><p>A filesystem must be mounted on to a directory in another filesystem. So now supposethat you mount filesystem <var class="LITERAL">B</var> on to the directory <varclass="LITERAL">A1</var>. The root directory of <var class="LITERAL">B</var> replaces<var class="LITERAL">A1</var>, and the directories in <var class="LITERAL">B</var> appearaccordingly:</p><p><img src="install/example-dir2.png" /></p><p>Any files that are in the <var class="LITERAL">B1</var> or <varclass="LITERAL">B2</var> directories can be reached with the path <ttclass="FILENAME">/A1/B1</tt> or <tt class="FILENAME">/A1/B2</tt> as necessary. Any filesthat were in <tt class="FILENAME">/A1</tt> have been temporarily hidden. They willreappear if <var class="LITERAL">B</var> is <i class="FIRSTTERM">unmounted</i> fromA.</p><p>If <var class="LITERAL">B</var> had been mounted on <var class="LITERAL">A2</var> thenthe diagram would look like this:</p><p><img src="install/example-dir3.png" /></p><p>and the paths would be <tt class="FILENAME">/A2/B1</tt> and <ttclass="FILENAME">/A2/B2</tt> respectively.</p><p>Filesystems can be mounted on top of one another. Continuing the last example, the<var class="LITERAL">C</var> filesystem could be mounted on top of the <varclass="LITERAL">B1</var> directory in the <var class="LITERAL">B</var> filesystem,leading to this arrangement:</p><p><img src="install/example-dir4.png" /></p><p>Or <var class="LITERAL">C</var> could be mounted directly on to the <varclass="LITERAL">A</var> filesystem, under the <var class="LITERAL">A1</var>directory:</p><p><img src="install/example-dir5.png" /></p><p>If you are familiar with DOS, this is similar, although not identical, to the <ttclass="COMMAND">join</tt> command.</p><p>This is not normally something you need to concern yourself with. Typically you createfilesystems when installing FreeBSD and decide where to mount them, and then never changethem unless you add a new disk.</p><p>It is entirely possible to have one large root filesystem, and not need to create anyothers. There are some drawbacks to this approach, and one advantage.</p><p><b>Benefits of Multiple Filesystems</b></p><ul><li><p>Different filesystems can have different <i class="FIRSTTERM">mount options</i>. Forexample, with careful planning, the root filesystem can be mounted read-only, making itimpossible for you to inadvertently delete or edit a critical file. Separatinguser-writable filesystems, such as <tt class="FILENAME">/home</tt>, from otherfilesystems also allows them to be mounted <i class="FIRSTTERM">nosuid</i>; this optionprevents the <i class="FIRSTTERM">suid</i>/<i class="FIRSTTERM">guid</i> bits onexecutables stored on the filesystem from taking effect, possibly improving security.</p></li><li><p>FreeBSD automatically optimizes the layout of files on a filesystem, depending on howthe filesystem is being used. So a filesystem that contains many small files that arewritten frequently will have a different optimization to one that contains fewer, largerfiles. By having one big filesystem this optimization breaks down.</p></li><li><p>FreeBSD's filesystems are very robust should you lose power. However, a power loss ata critical point could still damage the structure of the filesystem. By splitting yourdata over multiple filesystems it is more likely that the system will still come up,making it easier for you to restore from backup as necessary.</p></li></ul><p><b>Benefit of a Single Filesystem</b></p><ul><li><p>Filesystems are a fixed size. If you create a filesystem when you install FreeBSD andgive it a specific size, you may later discover that you need to make the partitionbigger. This is not easily accomplished without backing up, recreating the filesystemwith the new size, and then restoring the backed up data.</p><div class="IMPORTANT"><blockquote class="IMPORTANT"><p><b>Important:</b> FreeBSD&nbsp;4.4 and later versions feature the <spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">growfs</span>(8)</span> command, whichmakes it possible to increase the size of filesystem on the fly, removing thislimitation.</p></blockquote></div></li></ul><p>Filesystems are contained in partitions. This does not have the same meaning as theearlier usage of the term partition in this chapter, because of FreeBSD's <spanclass="TRADEMARK">UNIX</span>&reg; heritage. Each partition is identified by a letterfrom <var class="LITERAL">a</var> through to <var class="LITERAL">h</var>. Each partitioncan contain only one filesystem, which means that filesystems are often described byeither their typical mount point in the filesystem hierarchy, or the letter of thepartition they are contained in.</p><p>FreeBSD also uses disk space for <i class="FIRSTTERM">swap space</i>. Swap spaceprovides FreeBSD with <i class="FIRSTTERM">virtual memory</i>. This allows your computerto behave as though it has much more memory than it actually does. When FreeBSD runs outof memory it moves some of the data that is not currently being used to the swap space,and moves it back in (moving something else out) when it needs it.</p><p>Some partitions have certain conventions associated with them.</p>

⌨️ 快捷键说明

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