Chinaunix首页 | 论坛 | 博客
  • 博客访问: 67877
  • 博文数量: 28
  • 博客积分: 96
  • 博客等级: 民兵
  • 技术积分: 151
  • 用 户 组: 普通用户
  • 注册时间: 2011-12-01 23:56
文章分类
文章存档

2012年(13)

2011年(15)

分类:

2011-12-30 21:56:22

这是我从别处引用的,说的很清楚。这个文件最好不要动它,是给你看的,不是给你改的
fstab 文件想必大家都很熟悉,记录了计算机上硬盘分区的相关信息,启动 Linux 的时候,检查分区的 fsck 命令,和挂载分区的 mount 命令,都需要 fstab 中的信息,来正确的检查和挂载硬盘。

除了 fstab 文件之外,还有一个 mtab 文件,和 fstab 文件一样在 /etc 文件下,位于 /etc/mtab ,这个文件又是干什么用的呢?

我们可以看一下 mtab 文件的内容 (这是我电脑上的 mtab 文件内容):

# cat /etc/mtab
/dev/sda4 / reiserfs rw,noatime 0 0
proc /proc proc rw,nosuid,nodev,noexec 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0
udev /dev tmpfs rw,nosuid 0 0
devpts /dev/pts devpts rw,nosuid,noexec 0 0
/dev/sda2 /boot ext2 rw,noatime 0 0
shm /dev/shm tmpfs rw,noexec,nosuid,nodev 0 0
/dev/sda1 /mnt/winxp ntfs rw,utf8,umask=0 0 0
usbfs /proc/bus/usb usbfs rw,noexec,nosuid,devmode=0664,devgid=85 0 0
/dev/sdb5 /media/SWAP vfat rw,nosuid,nodev,shortname=lower,uid=1000 0 0
乍看上去,和 fstab 文件的结构和内容基本相同,但是不同的是,mtab 文件记录的是,当前已挂载的分区信息。

每当 mount 挂载分区、umount 卸载分区,都会动态更新 mtab,mtab 总是保持着当前系统中已挂载的分区信息,fdisk、df 这类程序,必须要读取 mtab 文件,才能获得当前系统中的分区挂载情况。
The programs mount and umount maintain a list of currently mounted file
systems in the file /etc/mtab. If no arguments are given to mount,
this list is printed. When the proc filesystem is mounted (say at
/proc), the files /etc/mtab and /proc/mounts have very similar con-
tents. The former has somewhat more information, such as the mount
options used, but is not necessarily up-to-date (cf. the -n option
below). It is possible to replace /etc/mtab by a symbolic link to
/proc/mounts, but some information is lost that way, and in particular
working with the loop device will be less convenient.
阅读(881) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~