转贴个关于fstab的文章……

参与到Ubuntu的翻译中来
头像
lyreopera
帖子: 771
注册时间: 2005-05-23 13:38
来自: gdsz

转贴个关于fstab的文章……

#1

帖子 lyreopera » 2006-04-14 23:55

< How to edit and understand /etc/fstab - 1.1 >
There's a file called /etc/fstab in your Linux system. Learn what its contents mean and how it's used in conjunction with the mount command. When you learn to understand the fstab file, you'll be able to edit its contents yourself, too.

In this tuXfile I assume you already know how to mount filesystems and partitions with the mount command. If you don't, I suggest reading the Mounting tuXfile before reading this one.

Author: Nana Långstedt < nana.langstedt at gmail.com >
tuXfile created: 12 October 2003
Last updated: 19 January 2006



contents
What is fstab and why it's useful
Overview of the file
Device and default mount point
Filesystem type
Mount options
Dump and fsck options
Example fstab entries


back to
File systems and directories
Linux help
tuXfiles home

< What is fstab and why it's useful >
fstab is a configuration file that contains information of all the partitions and storage devices in your computer. The file is located under /etc, so the full path to this file is /etc/fstab.

/etc/fstab contains information of where your partitions and storage devices should be mounted and how. If you can't access your Windows partition from Linux, aren't able to mount your CD or write to your floppy as a normal user, or have problems with your CD-RW, you probably have a misconfigured /etc/fstab file. So, you can usually fix your mounting problems by editing your fstab file.

/etc/fstab is just a plain text file, so you can open and edit it with any text editor you're familiar with. However, note that you must have the root privileges before editing fstab. So, in order to edit the file, you must either log in as root or use the su command to become root.



< Overview of the file >
Of course everybody has a bit different /etc/fstab file because the partitions, devices and their properties are different on different systems. But the basic structure of fstab is always the same. Here's an example of the contents of /etc/fstab:

/dev/hda2 / ext2 defaults 1 1
/dev/hdb1 /home ext2 defaults 1 2
/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0
/dev/fd0 /media/floppy auto rw,noauto,user,sync 0 0
proc /proc proc defaults 0 0
/dev/hda1 swap swap pri=42 0 0

What does all this gibberish mean? As you see, every line (or row) contains the information of one device or partition. The first column contains the device name, the second one its mount point, third its filesystem type, fourth the mount options, fifth (a number) dump options, and sixth (another number) filesystem check options. Let's take a closer look at this stuff.



< 1st and 2nd columns: Device and default mount point >
The first and second columns should be pretty straightforward. They tell the mount command exactly the same things that you tell mount when you mount stuff manually: what is the device or partition, and what is the mount point. The mount point specified for a device in /etc/fstab is its default mount point. That is the directory where the device will be mounted if you don't specify any other mount point when mounting the device.

Like you already learned from the Mounting tuXfile, most Linux distros create special directories for mount points. Most distros create them under /mnt, but some (at least SuSE) under /media. As you probably noticed when looking at the example fstab, I use SuSE's mount points as an example.

What does all this mean? If I type the following command:
$ mount /dev/fd0
... my floppy will be mounted in /media/floppy, because that's the default mount point specified in /etc/fstab. If there is no entry for /dev/fd0 in my fstab when I issue the command above, mount gets very confused because it doesn't know where to mount the floppy.

You can freely change the default mount points listed in /etc/fstab if you're not satisfied with the defaults your distro has given you. Just make sure the mount point is a directory that already exists on your system. If it doesn't, simply create it.

Some partitions and devices are also automatically mounted when your Linux system boots up. For example, have a look at the example fstab above. There are lines that look like this:

/dev/hda2 / ext2 defaults 1 1
/dev/hdb1 /home ext2 defaults 1 2

As you've learned, these lines mean that /dev/hda2 will be mounted to / and /dev/hdb1 to /home. This is done automatically when your Linux system boots up... if it wouldn't, you'd have a hard time using your cool Linux system because all the programs you use are in / and you wouldn't be able to run them if / wasn't mounted! But how does the system know where you want to mount /dev/hda2 and /dev/hdb1? By looking at the /etc/fstab file of course.



< 3rd column: Filesystem type >
The third column in /etc/fstab specifies the filesystem type of the device or partition. Many different filesystems are supported but we'll take a look at the most common ones only.

ext2 and ext3 Very likely your Linux partitions are Ext3. Ext2 used to be the standard filesystem for Linux, but these days, Ext3 and ReiserFS are usually the default filesystems for almost every new Linux distro. Ext3 is a newer filesystem type that differs from Ext2 in that it's journaled, meaning that if you turn the computer off without properly shutting down, you shouldn't lose any data and your system shouldn't spend ages doing filesystem checks the next time you boot up.

reiserfs Your Linux partitions may very well be formatted as ReiserFS. Like Ext3, ReiserFS is a journaled filesystem, but it's much more advanced than Ext3. Many Linux distros (including SuSE) have started using ReiserFS as their default filesystem for Linux partitions.

swap The filesystem name is self-explanatory. The filesystem type "swap" is used in your swap partitions.

vfat and ntfs Your Windows partitions are probably either Vfat or NTFS. The 9x series (95, 98, ME) all use Vfat (more widely known as FAT32), and the NT series (NT, 2000, XP) use NTFS. In 2000 and XP you can choose the filesystem type, so 2000 and XP partitions may be formatted as Vfat, too. If you want to be able to write to your Windows partitions from Linux, I suggest formatting them as Vfat, because Linux's support for writing to NTFS partitions is a bit shabby at this moment.

auto No, this isn't a filesystem type :-) The option "auto" simply means that the filesystem type is detected automatically. If you take a look at the example fstab above, you'll see that the floppy and CD-ROM both have "auto" as their filesystem type. Why? Their filesystem type may vary. One floppy might be formatted for Windows and the other for Linux's Ext2. That's why it's wise to let the system automatically detect the filesystem type of media such as floppies and cdroms.



< 4th column: Mount options >
The fourth column in fstab lists all the mount options for the device or partition. This is also the most confusing column in the fstab file, but knowing what some of the most common options mean, saves you from a big headache. Yes, there are many options available, but I'll take a look at the most widely used ones only. For more information, check out the man page of mount.

auto and noauto With the auto option, the device will be mounted automatically (at bootup, just like I told you a bit earlier, or when you issue the mount -a command). auto is the default option. If you don't want the device to be mounted automatically, use the noauto option in /etc/fstab. With noauto, the device can be mounted only explicitly.

user and nouser These are very useful options. The user option allows normal users to mount the device, whereas nouser lets only the root to mount the device. nouser is the default, which is a major cause of headache for new Linux users. If you're not able to mount your cdrom, floppy, Windows partition, or something else as a normal user, add the user option into /etc/fstab.

exec and noexec exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec might be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system. This might be the case of a Windows partition.

exec is the default option, which is a good thing. Imagine what would happen if you accidentally used the noexec option with your Linux root partition...

ro Mount the filesystem read-only.

rw Mount the filesystem read-write. Again, using this option might cure the headache of many new Linux users who are tearing their hair off because they can't write to their floppies, Windows partitions, or something else.

sync and async How the input and output to the filesystem should be done. sync means it's done synchronously. If you look at the example fstab, you'll notice that this is the option used with the floppy. In plain English, this means that when you, for example, copy a file to the floppy, the changes are physically written to the floppy at the same time you issue the copy command.

However, if you have the async option in /etc/fstab, input and output is done asynchronously. Now when you copy a file to the floppy, the changes may be physically written to it long time after issuing the command. This isn't bad, and may sometimes be favorable, but can cause some nasty accidents: if you just remove the floppy without unmounting it first, the copied file may not physically exist on the floppy yet!

async is the default. However, it may be wise to use sync with the floppy, especially if you're used to the way it's done in Windows and have a tendency to remove floppies before unmounting them first.

defaults Uses the default options that are rw, suid, dev, exec, auto, nouser, and async.



< 5th and 6th columns: Dump and fsck options >
Dump and, uh, what options? Well, dump is a backup utility and fsck is a filesystem check utility. I won't discuss them in great length here (they would both need their own tuXfile), but I'll mention them, because otherwise you'd spend the rest of the day wondering what on God's green Earth do these things mean.

The 5th column in /etc/fstab is the dump option. Dump checks it and uses the number to decide if a filesystem should be backed up. If it's zero, dump will ignore that filesystem. If you take a look at the example fstab, you'll notice that the 5th column is zero in most cases.

The 6th column is a fsck option. fsck looks at the number in the 6th column to determine in which order the filesystems should be checked. If it's zero, fsck won't check the filesystem.



< Example /etc/fstab entries >
As an example, we'll take a look at a couple of fstab entries that have been a source of endless frustration for new Linux users: floppy and CD-ROM (although these days floppies aren't that important anymore).

/dev/fd0 /media/floppy auto rw,noauto,user,sync 0 0

This line means that the floppy is mounted to /media/floppy by default and that its filesystem type is detected automatically. This is useful because the type of the floppy may wary. Note especially the rw and user options: they must be there if you want to be able to mount and write to the floppy as a normal user. If you have trouble with this, check your fstab file to see if these options are there. Also note the sync option. It can be async just as well, but it's sync because of reasons discussed a bit earlier.

/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0

Note, again, the user option that enables you to mount the CD as a normal user. The CD-ROM has the ro option because it's no use mounting a CD-ROM read-write because you wouldn't be able to write to it anyway. Also note the exec option. It's especially useful if you'd like to be able to execute something from your CD.

Also note that the noauto option is used with the floppy and CD-ROM. This means that they won't be automatically mounted when your Linux system boots up. This is useful for removable media, because sometimes there won't be any floppy or CD-ROM when you boot up your system, so there isn't any reason to try to mount something that doesn't even exist.


原文地址:http://www.tuxfiles.org/linuxhelp/fstab.html

感觉还不错,先转贴过来,不知道有没有版权问题……

先放着,有空慢慢翻译,要有人先翻译了我也不会介意- -


[/u]
……
头像
lyreopera
帖子: 771
注册时间: 2005-05-23 13:38
来自: gdsz

#2

帖子 lyreopera » 2006-04-16 19:44

< How to edit and understand /etc/fstab - 1.1 >
<如何编辑和理解fstab-1.1>

There's a file called /etc/fstab in your Linux system. Learn what its contents mean and how it's used in conjunction with the mount command. When you learn to understand the fstab file, you'll be able to edit its contents yourself, too.
在linux系统里面有一个/etc/fstab的文件。了解它的内容是什么意思和它怎么调整mount命令。当你学习并了解了fstab这个文件,就可以自己编辑它的内容了。

In this tuXfile I assume you already know how to mount filesystems and partitions with the mount command. If you don't, I suggest reading the Mounting tuXfile before reading this one.
在这里我假设你已经会用mount命令挂载文件系统和分区。如果你还不会,我建议你在阅读这篇文章前先参阅Mounting tuXfile。

Author: Nana Långstedt < nana.langstedt at gmail.com >
tuXfile created: 12 October 2003
Last updated: 19 January 2006
作者: Nana Långstedt < nana.langstedt at gmail.com >
在tuXfile的创建日期: 12 October 2003
最近更新: 19 January 2006



< What is fstab and why it's useful >
< 什么是fstab和它为什么有用>

fstab is a configuration file that contains information of all the partitions and storage devices in your computer. The file is located under /etc, so the full path to this file is /etc/fstab.
fstab是一个配置文件,包含了计算机上所有分区和存储设备的信息。这个文件位于/etc下,所以它完整的路径是/etc/fstab。

/etc/fstab contains information of where your partitions and storage devices should be mounted and how. If you can't access your Windows partition from Linux, aren't able to mount your CD or write to your floppy as a normal user, or have problems with your CD-RW, you probably have a misconfigured /etc/fstab file. So, you can usually fix your mounting problems by editing your fstab file.
/etc/fstab包含了在哪里和怎么挂载你的分区和存储设备的信息。如果你不能从linux访问widows分区,不能以普通用户挂载CD或向软盘写入信息,或者你的CD-RW出了问题,你可能错误的设置了/etc/fsatb。所以,你通常可以通过编辑fstab文件来修复挂载问题。

/etc/fstab is just a plain text file, so you can open and edit it with any text editor you're familiar with. However, note that you must have the root privileges before editing fstab. So, in order to edit the file, you must either log in as root or use the su command to become root.
/etc/fstab只是一段普通的文本,所以你可以使用任何你熟悉的文本编辑器来打开和编辑它。但是,注意在编辑前你必须有根用户的权限。所以,你必须以根用户登录或是通过使用su命令变成根用户来编辑它。




< Overview of the file >
< 这个文件的概况 >

Of course everybody has a bit different /etc/fstab file because the partitions, devices and their properties are different on different systems. But the basic structure of fstab is always the same. Here's an example of the contents of /etc/fstab:
当然每个人的/etc/fstab都有些不同,因为不同系统的分区,设备和它们的属性有所不同。但是基本结构是总是一致的。这里是一个/etc/fstab内容的例子:

/dev/hda2 / ext2 defaults 1 1
/dev/hdb1 /home ext2 defaults 1 2
/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0
/dev/fd0 /media/floppy auto rw,noauto,user,sync 0 0
proc /proc proc defaults 0 0
/dev/hda1 swap swap pri=42 0 0

What does all this gibberish mean? As you see, every line (or row) contains the information of one device or partition. The first column contains the device name, the second one its mount point, third its filesystem type, fourth the mount options, fifth (a number) dump options, and sixth (another number) filesystem check options. Let's take a closer look at this stuff.
所有上边没有胡乱不清的单词是什么意思?就像你看到的一样,每一行(或列)包含了一个设备或分区的信息。第一列包含了设备名,第二列是它的挂载点,第三列是文件系统的种类,第四列是挂载的选项,第五列(一个数字)是dump选项,第六列(另一个数字)是filesystem check选项。让我们仔细来看这些要素。


问题1:dump和filesystem check有没有固定的翻译?还是直接翻译成卸载和文件系统检查?
上次由 lyreopera 在 2006-04-18 16:45,总共编辑 1 次。
……
头像
lyreopera
帖子: 771
注册时间: 2005-05-23 13:38
来自: gdsz

#3

帖子 lyreopera » 2006-04-18 16:44

< 1st and 2nd columns: Device and default mount point >
< 第一和第二列:设备跟默认挂载位置 >

The first and second columns should be pretty straightforward. They tell the mount command exactly the same things that you tell mount when you mount stuff manually: what is the device or partition, and what is the mount point. The mount point specified for a device in /etc/fstab is its default mount point. That is the directory where the device will be mounted if you don't specify any other mount point when mounting the device.
第一列和第二列应该是相当易懂的。它们告诉mount命令这些跟你手动挂载这时一样的东西:这个设备或分区是什么, 它的挂载点又是什么。一个设备在/etc/fstab挂载位置的指定的位置就是它的默认挂载位置。如果你没有特别指定别的挂载位置,设备将会被挂载在这个目录上。

Like you already learned from the Mounting tuXfile, most Linux distros create special directories for mount points. Most distros create them under /mnt, but some (at least SuSE) under /media. As you probably noticed when looking at the example fstab, I use SuSE's mount points as an example.
正如你已经在 Mounting tuXfile学到的一样,大多数Linux发行版为挂载位置创建了一个目录。大多数都是把它们创建在/mnt,但是有一些(至少SuSE是)在/media。也许你已经注意到上面我使用了SuSE的挂载位置作为例子。

What does all this mean? If I type the following command:
$ mount /dev/fd0
... my floppy will be mounted in /media/floppy, because that's the default mount point specified in /etc/fstab. If there is no entry for /dev/fd0 in my fstab when I issue the command above, mount gets very confused because it doesn't know where to mount the floppy.
这是什么意思呢?如果我打如下的命令:
$ mount /dev/fd0
……我的软盘将被挂载到/media/floppy,因为这是/etc/fstab中指定的默认挂载位置。如果我的fstab里面没有关于/dev/fd0的内容而我发出这条指令,mount会很迷惑(就是出错啦)因为它不知道要把我的软盘挂载到哪里。

You can freely change the default mount points listed in /etc/fstab if you're not satisfied with the defaults your distro has given you. Just make sure the mount point is a directory that already exists on your system. If it doesn't, simply create it.
你可以自由的更改在/etc/fstab中列出的默认挂载位置,如果你对你的发行版的默认位置不满意的话。要注意的是挂载位置是你的系统里一个已经存在的目录。如果不存在的话,创建一个就是了。

Some partitions and devices are also automatically mounted when your Linux system boots up. For example, have a look at the example fstab above. There are lines that look like this:
有些分区和设备当你在启动Linux系统的时候也会被自动挂载。 举个例子,看看上面给的样本。其中有几行像这样的:

/dev/hda2 / ext2 defaults 1 1
/dev/hdb1 /home ext2 defaults 1 2

As you've learned, these lines mean that /dev/hda2 will be mounted to / and /dev/hdb1 to /home. This is done automatically when your Linux system boots up... if it wouldn't, you'd have a hard time using your cool Linux system because all the programs you use are in / and you wouldn't be able to run them if / wasn't mounted! But how does the system know where you want to mount /dev/hda2 and /dev/hdb1? By looking at the /etc/fstab file of course.
正如你所学的,这几行表示/dev/hda2将被挂载到/而/dev/hab1挂载到/home。当你的Linux系统启动的时候这些是自动完成的……不这样的话,你会体验到痛苦的使用这么cool的Linux系统,因为所有的程序都在/下并且你不能运行它们,如果/没有挂载的话。但是系统怎么知道你要把/dev/hda和/dev/sdb1挂载到哪里呢?当然是看/etc/fstab了。



< 3rd column: Filesystem type >
< 第三列:文件系统的种类>

The third column in /etc/fstab specifies the filesystem type of the device or partition. Many different filesystems are supported but we'll take a look at the most common ones only.
/etc/fstab中的第三列指定了分区或设备的文件系统的种类。它支持很多不同的文件系统但我们只看看最常见的几种。
kb的文件系统。
ext2 and ext3 Very likely your Linux partitions are Ext3. Ext2 used to be the standard filesystem for Linux, but these days, Ext3 and ReiserFS are usually the default filesystems for almost every new Linux distro. Ext3 is a newer filesystem type that differs from Ext2 in that it's journaled, meaning that if you turn the computer off without properly shutting down, you shouldn't lose any data and your system shouldn't spend ages doing filesystem checks the next time you boot up.
ext2和ext3 很可能你的Linux分区是Ext3。Ext2曾经是Linux标准的文件系统,但现在,几乎每一个新的Linux发行版都使用Ext3和ReiserFS作为默认的文件系统。Ext3跟Ext2是不同的文件系统,在于它增加了日志,也就意味着如果你没有正确的关闭系统,你不应该会丢失数据并且你的系统在下一次启动是不需要花费漫长的时间来检查文件系统。

reiserfs Your Linux partitions may very well be formatted as ReiserFS. Like Ext3, ReiserFS is a journaled filesystem, but it's much more advanced than Ext3. Many Linux distros (including SuSE) have started using ReiserFS as their default filesystem for Linux partitions.
reiserfs 你的Linux分区也可能是用ReiserFS格式化的。ReiserFS跟Ext3一样是一种日志文件系统,但是它比Ext3先进的多。很多Linux发行版(包括SuSE)已经使用ReiserFS作为它们的Linux分区的默认文件系统。

swap The filesystem name is self-explanatory. The filesystem type "swap" is used in your swap partitions.
swap 这个文件系统的名字就是它的解释。"swap"这种文件系统就是用来作交换分区的。

vfat and ntfs Your Windows partitions are probably either Vfat or NTFS. The 9x series (95, 98, ME) all use Vfat (more widely known as FAT32), and the NT series (NT, 2000, XP) use NTFS. In 2000 and XP you can choose the filesystem type, so 2000 and XP partitions may be formatted as Vfat, too. If you want to be able to write to your Windows partitions from Linux, I suggest formatting them as Vfat, because Linux's support for writing to NTFS partitions is a bit shabby at this moment.
vfa和ntfs 你的Windows分区可能要么是Vfat要么NTFS。9x系统(95,98,ME)都使用Vfat(最广为人知的是FAT32),而NT系列(NT,2000,XP)使用NTFS。在2000和XP里你可以选择文件系统的种类,所以2000和XP的分区也可以是Vfat格式化的。如果你想在Linxu下写入windows分区,我建议你把它们格式化为Vfat,因为现阶段Linux对NTFS的写入支持还有些不符合标准。

auto No, this isn't a filesystem type :-) The option "auto" simply means that the filesystem type is detected automatically. If you take a look at the example fstab above, you'll see that the floppy and CD-ROM both have "auto" as their filesystem type. Why? Their filesystem type may vary. One floppy might be formatted for Windows and the other for Linux's Ext2. That's why it's wise to let the system automatically detect the filesystem type of media such as floppies and cdroms.
auto 不,这不是一种文件系统:-),"auto"这个选项表示自动检测文件系统的种类。如果你仔细看上所给的fstab的例子,你会发现软盘和CD-ROM都是以"auto"作为它们的文件系统的。为什么?它们的文件系统是会变化的。一个软盘可能是为windows格式化的而另一个被格式化为Linux的Ext2。这是为什么要让系统自动检测像CD-ROM和软盘等介质的文件系统。
上次由 lyreopera 在 2006-11-21 17:42,总共编辑 1 次。
……
头像
lyreopera
帖子: 771
注册时间: 2005-05-23 13:38
来自: gdsz

#4

帖子 lyreopera » 2006-04-19 15:41

< 4th column: Mount options >
< 第四列:挂载选项 >

The fourth column in fstab lists all the mount options for the device or partition. This is also the most confusing column in the fstab file, but knowing what some of the most common options mean, saves you from a big headache. Yes, there are many options available, but I'll take a look at the most widely used ones only. For more information, check out the man page of mount.
fstab中的第四列是列出了设备或分区的所有挂载选项。这也是fstab中最令人糊涂的一列,但了解一些最常用选项的意思可以让你不那么头痛。是的,这里提供了许多选项,但是我们只看使用最广泛的几个。想了解更多的话,查看mount的man页面。

auto and noauto With the auto option, the device will be mounted automatically (at bootup, just like I told you a bit earlier, or when you issue the mount -a command). auto is the default option. If you don't want the device to be mounted automatically, use the noauto option in /etc/fstab. With noauto, the device can be mounted only explicitly.
auto和noauto 使用了auto选项,设备将会自动挂载(在启动的时候,正如我之前告诉你的,或者是当你发出mount -a命令时)。auto是默认的选项。如果不想自动挂载设备,在fstab中用noauto选项。使用了noauto,设备只有在明确(输入命令)后才能被挂载。

user and nouser These are very useful options. The user option allows normal users to mount the device, whereas nouser lets only the root to mount the device. nouser is the default, which is a major cause of headache for new Linux users. If you're not able to mount your cdrom, floppy, Windows partition, or something else as a normal user, add the user option into /etc/fstab.
user和nouser这是一个非常有用的选项。user选项允许普通用户挂载设备,而nouser选项只允许根用户挂载设备。nouser是默认的,这是让Linux的新用户感到头痛的一个主要原因。如果不能以普通用户挂载cdrom,软盘,windows分区,或是别的一些东西,在fstab中加入user选项即可。

exec and noexec exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec might be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system. This might be the case of a Windows partition.
exec和noexec exec允许你执行分区上的二进制程序,而noexec不允许这么做。在你的分区上含有二进制程序而你不想执行它,或者它根本就不能在你的系统执行,noexec会是一个有用的选项。windows分区可能会是个很好的例子。

exec is the default option, which is a good thing. Imagine what would happen if you accidentally used the noexec option with your Linux root partition...
exec是默认选项,这是一件好事情。想象一下,如果你哪一天不小心给Linux根分区使用了noexec选项会发生什么?

ro Mount the filesystem read-only.
ro 以只读方式挂载文件系统。

rw Mount the filesystem read-write. Again, using this option might cure the headache of many new Linux users who are tearing their hair off because they can't write to their floppies, Windows partitions, or something else.
rw 挂载文件系统并允许读写。再说一次,对于那些因为不能写入他们的软盘,windows分区或别的什么的而抓破头皮的Linux新用户来说,使用这个选项可能可以解决他们的烦恼。

sync and async How the input and output to the filesystem should be done. sync means it's done synchronously. If you look at the example fstab, you'll notice that this is the option used with the floppy. In plain English, this means that when you, for example, copy a file to the floppy, the changes are physically written to the floppy at the same time you issue the copy command.
sync和async 文件系统的输入和输出是怎么进行的。sync表示是同时进行的。如果你看一下fstab的例子,你会发现这是一个用在软盘上的选项。用普通的英语来说,举个例子,当你向软盘写入一个文件时,对软盘的物理上的写入是在你发出复制的命令时就已经开始了。

However, if you have the async option in /etc/fstab, input and output is done asynchronously. Now when you copy a file to the floppy, the changes may be physically written to it long time after issuing the command. This isn't bad, and may sometimes be favorable, but can cause some nasty accidents: if you just remove the floppy without unmounting it first, the copied file may not physically exist on the floppy yet!
然而,如果你在/etc/fstab中使用了async选项,输入和输出不是同步进行的。现在你复制一个文件到软盘,真正开始物理上的写入可能是在你发出命令很久以后才进行的。这并不坏,而且有时候是很有好处的,但是会引起一些严重的意外:如果你没有先卸载就把软盘拿出来了,复制的文件可能并非真正存在于软盘上。

async is the default. However, it may be wise to use sync with the floppy, especially if you're used to the way it's done in Windows and have a tendency to remove floppies before unmounting them first.
async是默认的。然而,给软盘使用sync选项是个明智的做法,特别是你习惯了windows下的做法,倾向于在卸载软盘前就把它拿出来的时候。

defaults Uses the default options that are rw, suid, dev, exec, auto, nouser, and async.
defaults 使用默认选项,包括rw,suid,dec,exec,auto和async。




问题2:binaries是什么?怎么翻译?编译好的程序?
上次由 lyreopera 在 2006-11-21 17:44,总共编辑 1 次。
……
头像
lyreopera
帖子: 771
注册时间: 2005-05-23 13:38
来自: gdsz

#5

帖子 lyreopera » 2006-04-20 20:11

< 5th and 6th columns: Dump and fsck options >
< 第五和第六列:Dump和fsck选项 >

Dump and, uh, what options? Well, dump is a backup utility and fsck is a filesystem check utility. I won't discuss them in great length here (they would both need their own tuXfile), but I'll mention them, because otherwise you'd spend the rest of the day wondering what on God's green Earth do these things mean.
Dump和……,啊,这是什么选项?dump是一个备份工具而fsck是一个文件系统扫描工具。这里我不会花很长的篇幅来讨论它们(它们都需要单独的tuXfile文章来讨论),
但是我会提到他们,否则你会想上老半天这些东西到底是什么。

The 5th column in /etc/fstab is the dump option. Dump checks it and uses the number to decide if a filesystem should be backed up. If it's zero, dump will ignore that filesystem. If you take a look at the example fstab, you'll notice that the 5th column is zero in most cases.
/etc/fstab中的第五列是dump选项。Dump检查这个数字并按照这个数字决定一个文件系统是不是要备份。如果这个数字是0,dump会忽略这个文件系统。仔细看所给fstab的例子的话,你会发现第五列大多数都是0。

The 6th column is a fsck option. fsck looks at the number in the 6th column to determine in which order the filesystems should be checked. If it's zero, fsck won't check the filesystem.
第五列是fsck选项。fsck检查第六列的数字来决定文件系统的扫描顺序。如果是0,fsck会忽略这个文件系统。

< Example /etc/fstab entries >
< /etc/fstab内容的例子>

As an example, we'll take a look at a couple of fstab entries that have been a source of endless frustration for new Linux users: floppy and CD-ROM (although these days floppies aren't that important anymore).
作为例子,我们来看看几个曾经让Linux新用户不断感到挫折的fstab的内容:软盘和CD-ROM(尽管现在软盘不再那么重要了)。

/dev/fd0 /media/floppy auto rw,noauto,user,sync 0 0

This line means that the floppy is mounted to /media/floppy by default and that its filesystem type is detected automatically. This is useful because the type of the floppy may wary. Note especially the rw and user options: they must be there if you want to be able to mount and write to the floppy as a normal user. If you have trouble with this, check your fstab file to see if these options are there. Also note the sync option. It can be async just as well, but it's sync because of reasons discussed a bit earlier.
这一行表示软盘被默认挂载到/media/floopy并且它的文件系统种类是自动检测的。这是很有用的因为可能要注意软盘的种类(文件系统的种类)。特别要注意rw和user选项:一定要加上这2项,如果你想以普通用户挂载并写入软盘的话。如果在这方面有问题的话,检查你的fstab文件看看是不是有这些选项。另外要注意的是sync选项。当然也可以是async,但最好是sync,原因在前面已经谈到了。

/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0

Note, again, the user option that enables you to mount the CD as a normal user. The CD-ROM has the ro option because it's no use mounting a CD-ROM read-write because you wouldn't be able to write to it anyway. Also note the exec option. It's especially useful if you'd like to be able to execute something from your CD.
再一次注意,user选项允许你以普通用户挂载CD。CD-ROM有个ro选项,以读写方式挂载CD-ROM是没有用的,因为根本就不可能写入。还要注意exec选项,在你想运行CD上某些东西的时候这是非常有用的。

Also note that the noauto option is used with the floppy and CD-ROM. This means that they won't be automatically mounted when your Linux system boots up. This is useful for removable media, because sometimes there won't be any floppy or CD-ROM when you boot up your system, so there isn't any reason to try to mount something that doesn't even exist.
还要注意的就是软盘和CD-ROM带了noauto选项。这表示他们在Linux启动时不会被自动挂载。这对可移动的存储介质来说是很有用的,因为有些时候启动时根本就没有软盘或CD-ROM在系统上,所以没有任何理由要尝试去挂载一些根本不存在的东西。
……
头像
lyreopera
帖子: 771
注册时间: 2005-05-23 13:38
来自: gdsz

#6

帖子 lyreopera » 2006-04-20 20:21

代码: 全选

<如何编辑和理解fstab-1.1>


在linux系统里面有一个/etc/fstab的文件。了解它的内容是什么意思和它怎么调整mount命令。当你学习并了解了fstab这个文件,就可以自己编辑它的内容了。

在这里我假设你已经会用mount命令挂载文件系统和分区。如果你还不会,我建议你在阅读这篇文章前先参阅[url=http://www.tuxfiles.org/linuxhelp/mounting.html]Mounting tuXfile[/url]。

作者: Nana Långstedt < nana.langstedt at gmail.com >
在tuXfile的创建日期: 12 October 2003
最近更新: 19 January 2006

代码: 全选

< 什么是fstab和它为什么有用 >

fstab是一个配置文件,包含了计算机上所有分区和存储设备的信息。这个文件位于/etc下,所以它完整的路径是/etc/fstab。

/etc/fstab包含了在哪里和怎么挂载你的分区和存储设备的信息。如果你不能从linux访问widows分区,不能以普通用户挂载CD或向软盘写入信息,或者你的CD-RW出了问题,你可能错误的设置了/etc/fsatb。所以,你通常可以通过编辑fstab文件来修复挂载问题。

/etc/fstab只是一段普通的文本,所以你可以使用任何你熟悉的文本编辑器来打开和编辑它。但是,注意在编辑前你必须有根用户的权限。所以,你必须以根用户登录或是通过使用su命令变成根用户来编辑它。

代码: 全选

< 这个文件的概况 >

当然每个人的/etc/fstab都有些不同,因为不同系统的分区,设备和它们的属性有所不同。但是基本结构是总是一致的。这里是一个/etc/fstab内容的例子:

/dev/hda2 	/       	ext2    	defaults 	        1 1
/dev/hdb1 	/home 	        ext2 	        defaults 	        1 2
/dev/cdrom 	/media/cdrom 	auto     	ro,noauto,user,exec 	0 0
/dev/fd0 	/media/floppy 	auto    	rw,noauto,user,sync 	0 0
proc     	/proc   	proc    	defaults        	0 0
/dev/hda1 	swap 	        swap    	pri=42          	0 0

所有上边没有胡乱不清的单词是什么意思?就像你看到的一样,每一行(或列)包含了一个设备或分区的信息。第一列包含了设备名,第二列是它的挂载点,第三列是文件系统的种类,第四列是挂载的选项,第五列(一个数字)是dump选项,第六列(另一个数字)是filesystem check选项。让我们仔细来看这些要素。

代码: 全选

< 第一和第二列:设备跟默认挂载位置 >

第一列和第二列应该是相当易懂的。它们告诉mount命令这些跟你手动挂载这时一样的东西:这个设备或分区是什么, 它的挂载点又是什么。一个设备在/etc/fstab挂载位置的指定的位置就是它的默认挂载位置。如果你没有特别指定别的挂载位置,设备将会被挂载在这个目录上。

正如你已经在[url=http://www.tuxfiles.org/linuxhelp/mounting.html]Mounting tuXfile[/url]学到的一样,大多数Linux发行版为挂载位置创建了一个目录。大多数都是把它们创建在/mnt,但是有一些(至少SuSE是)在/media。也许你已经注意到上面我使用了SuSE的挂载位置作为例子。

这是什么意思呢?如果我打如下的命令:
$ mount /dev/fd0
……我的软盘将被挂载到/media/floppy,因为这是/etc/fstab中指定的默认挂载位置。如果我的fstab里面没有关于/dev/fd0的内容而我发出这条指令,mount会很迷惑(就是出错啦)因为它不知道要把我的软盘挂载到哪里。

你可以自由的更改在/etc/fstab中列出的默认挂载位置,如果你对你的发行版的默认位置不满意的话。要注意的是挂载位置是你的系统里一个已经存在的目录。如果不存在的话,创建一个就可以了。

有些分区和设备当你在启动Linux系统的时候也会被自动挂载。 举个例子,看看上面给的样本。其中有几行像这样的:

/dev/hda2 / ext2 defaults 1 1
/dev/hdb1 /home ext2 defaults 1 2

正如你所学的,这几行表示/dev/hda2将被挂载到/而/dev/hab1挂载到/home。当你的Linux系统启动的时候这些是自动完成的……不这样的话,你会体验到痛苦的使用这么cool的Linux系统,因为所有的程序都在/下并且你不能运行它们,如果/没有挂载的话。但是系统怎么知道你要把/dev/hda和/dev/sdb1挂载到哪里呢?当然是看/etc/fstab了。

代码: 全选

< 第三列:文件系统的种类>

/etc/fstab中的第三列指定了分区或设备的文件系统的种类。它支持很多不同的文件系统但我们只看看最常见的几种。
kb的文件系统。

ext2和ext3 很可能你的Linux分区是Ext3。Ext2曾经是Linux标准的文件系统,但现在,几乎每一个新的Linux发行版都使用Ext3和ReiserFS作为默认的文件系统。Ext3跟Ext2是不同的文件系统,在于它增加了日志,也就意味着如果你没有正确的关闭系统,你不应该会丢失数据并且你的系统在下一次启动是不需要花费漫长的时间来检查文件系统。

reiserfs 你的Linux分区也可能是用ReiserFS格式化的。ReiserFS跟Ext3一样是一种日志文件系统,但是它比Ext3先进的多。很多Linux发行版(包括SuSE)已经使用ReiserFS作为它们的Linux分区的默认文件系统。

swap 这个文件系统的名字就是它的解释。"swap"这种文件系统就是用来作交换分区的。

vfa和ntfs 你的Windows分区可能要么是Vfat要么NTFS。9x系统(95,98,ME)都使用Vfat(最广为人知的是FAT32),而NT系列(NT,2000,XP)使用NTFS。在2000和XP里你可以选择文件系统的种类,所以2000和XP的分区也可以是Vfat格式化的。如果你想在Linxu下写入windows分区,我建议你把它们格式化为Vfat,因为现阶段Linux对NTFS的写入支持还有些不符合标准。

auto 不,这不是一种文件系统:-),"auto"这个选项表示自动检测文件系统的种类。如果你仔细看上所给的fstab的例子,你会发现软盘和CD-ROM都是以"auto"作为它们的文件系统的。为什么?它们的文件系统是会变化的。一个软盘可能是为windows格式化的而另一个被格式化为Linux的Ext2。这是为什么要让系统自动检测像CD-ROM和软盘等介质的文件系统。

代码: 全选

< 第四列:挂载选项 >

fstab中的第四列是列出了设备或分区的所有挂载选项。这也是fstab中最令人糊涂的一列,但了解一些最常用选项的意思可以让你不那么头痛。是的,这里提供了许多选项,但是我们只看使用最广泛的几个。想了解更多的话,查看mount的man页面。

auto和noauto 使用了auto选项,设备将会自动挂载(在启动的时候,正如我之前告诉你的,或者是当你发出mount -a命令时)。auto是默认的选项。如果不想自动挂载设备,在fstab中用noauto选项。使用了noauto,设备只有在明确(输入命令)后才能被挂载。

user和nouser这是一个非常有用的选项。user选项允许普通用户挂载设备,而nouser选项只允许根用户挂载设备。nouser是默认的,这是让Linux的新用户感到头痛的一个主要原因。如果不能以普通用户挂载cdrom,软盘,windows分区,或是别的一些东西,在fstab中加入user选项即可。

exec和noexec exec允许你执行分区上的二进制程序,而noexec不允许这么做。在你的分区上含有二进制程序而你不想执行它,或者它根本就不能在你的系统执行,noexec会是一个有用的选项。windows分区可能会是个很好的例子。

exec是默认选项,这是一件好事情。想象一下,如果你哪一天不小心给Linux根分区使用了noexec选项会发生什么?

ro 以只读方式挂载文件系统。

rw 挂载文件系统并允许读写。再说一次,对于那些因为不能写入他们的软盘,windows分区或别的什么的而抓破头皮的Linux新手来说,使用这个选项可能可以解决他们的烦恼。

sync和async 文件系统的输入和输出是怎么进行的。sync表示是同时进行的。如果你看一下fstab的例子,你会发现这是一个用在软盘上的选项。用普通的英语来说,举个例子,当你向软盘写入一个文件时,对软盘的物理上的写入是在你发出复制的命令时就已经开始了。

然而,如果你在/etc/fstab中使用了async选项,输入和输出不是同步进行的。现在你复制一个文件到软盘,真正开始物理上的写入可能是在你发出命令很久以后才进行的。这并不坏,而且有时候是很有好处的,但是会引起一些严重的意外:如果你没有先卸载就把软盘拿出来了,复制的文件可能并非真正存在于软盘上。

async是默认的。然而,给软盘使用sync选项是个明智的做法,特别是你习惯了windows下的做法,倾向于在卸载软盘前就把它拿出来的时候。

defaults 使用默认选项,包括rw,suid,dec,exec,auto和async。

代码: 全选

< 第五和第六列:Dump和fsck选项 >


Dump和……,啊,这是什么选项?dump是一个备份工具而fsck是一个文件系统扫描工具。这里我不会花很长的篇幅来讨论它们(它们都需要单独的tuXfile文章来讨论),
但是我会提到他们,否则你会想上老半天这些东西到底是什么。

/etc/fstab中的第五列是dump选项。Dump检查这个数字并按照这个数字决定一个文件系统是不是要备份。如果这个数字是0,dump会忽略这个文件系统。仔细看所给fstab的例子的话,你会发现第五列大多数都是0。

第五列是fsck选项。fsck检查第六列的数字来决定文件系统的扫描顺序。如果是0,fsck会忽略这个文件系统。

代码: 全选

< /etc/fstab内容的例子>

作为例子,我们来看看几个曾经让Linux新手不断感到挫折的fstab的内容:软盘和CD-ROM(尽管现在软盘不再那么重要了)。

/dev/fd0 /media/floppy auto rw,noauto,user,sync 0 0

这一行表示软盘被默认挂载到/media/floopy并且它的文件系统种类是自动检测的。这是很有用的因为可能要注意软盘的种类(文件系统的种类)。特别要注意rw和user选项:一定要加上这2项,如果你想以普通用户挂载并写入软盘的话。如果在这方面有问题的话,检查你的fstab文件看看是不是有这些选项。另外要注意的是sync选项。当然也可以是async,但最好是sync,原因在前面已经谈到了。

/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0

再一次注意,user选项允许你以普通用户挂载CD。CD-ROM有个ro选项,以读写方式挂载CD-ROM是没有用的,因为根本就不可能写入。还要注意exec选项,在你想运行CD上某些东西的时候这是非常有用的。

还要注意的就是软盘和CD-ROM带了noauto选项。这表示他们在Linux启动时不会被自动挂载。这对可移动的存储介质来说是很有用的,因为有些时候启动时根本就没有软盘或CD-ROM在系统上,所以没有任何理由要尝试去挂载一些根本不存在的东西。
原文地址:http://www.tuxfiles.org/linuxhelp/fstab.html


PS:tuXfile是这个文章的发表的网站,http://www.tuxfiles.org/

问题:binaries是什么?怎么翻译?编译好的程序?
ps:我现在翻译成二进制程序了
上次由 lyreopera 在 2006-11-21 17:45,总共编辑 3 次。
……
头像
shawnling
帖子: 52
注册时间: 2006-04-07 13:46
来自: Shanghai

#7

帖子 shawnling » 2006-04-22 8:31

二进制文件,应该就是编译的出来的结果吧
Dapper Drake on Dell Latitude D600
pure1023
帖子: 2
注册时间: 2006-09-17 14:42

#8

帖子 pure1023 » 2006-09-17 16:07

好东西阿,谢谢了
头像
again
帖子: 22
注册时间: 2006-11-02 14:37
来自: Nanjing, China

NIce!

#9

帖子 again » 2006-11-02 18:29

Nice!
Thx :D
bluedoor
帖子: 10
注册时间: 2006-12-03 23:53
联系:

#10

帖子 bluedoor » 2006-12-06 0:10

i没想到下面有中文,好不容易看完英文。
头像
leec0621
帖子: 150
注册时间: 2006-11-12 10:17
来自: 火星

#11

帖子 leec0621 » 2006-12-21 20:09

留個記號~還需要慢慢研究
shocool
帖子: 8
注册时间: 2006-07-07 12:31

#12

帖子 shocool » 2007-01-11 16:01

保存了,要慢慢研究一下。
头像
superhuhao
帖子: 21
注册时间: 2007-03-21 23:13
来自: MAS

正在找这个,谢谢!

#13

帖子 superhuhao » 2007-03-27 16:44

正在找这个,谢谢!
ziyun
帖子: 262
注册时间: 2007-03-29 12:59

#14

帖子 ziyun » 2007-04-01 15:51

看完了我才知道有一次/root ,/etc不能写,是因为fstab里有/ ext3 default,error=remount-ro选顼
头像
yourchum
帖子: 12
注册时间: 2006-12-08 0:12

#15

帖子 yourchum » 2007-06-12 15:02

很好大东西阿
回复