fat32文件系统格式在linux,linux 中的fstab文件配置以及如何在linux下开机加载fat32文件系统...

a4c26d1e5885305701be709a3d33442f.png

linux 中的fstab文件配置以及如何在linux下开机加载fat32文件系统

(2006-12-24 10:08:27)

Fstab文件保存关于文件系统的信息。

此文件一般位置为/etc/fstab

此文件在man手册中的信息为以下内容:

FSTAB(5) Linux Programmer’s Manual FSTAB(5)

NAME

fstab - static information about the filesystems

SYNOPSIS

#include

DESCRIPTION

The file fstab contains descriptive information about the various file

systems. It is the duty of the system administrator to properly create

and maintain this file. fstab can be modified by special utils (e.g.

fstab-sync(8)). Each filesystem is described on a separate line;

fields on each line are separated by tabs or spaces. Lines starting

with ’#’ are comments. The order of records in fstab is important

because fsck(8), mount(8), and umount(8) sequentially iterate through

fstab doing their thing.

The first field, (fs_spec), describes the block special device or

remote filesystem to be mounted.

For ordinary mounts it will hold (a link to) a block special device

node (as created by mknod(8)) for the device to be mounted, like

‘/dev/cdrom’ or ‘/dev/sdb7’. For NFS mounts one will have

:

Instead of giving the device explicitly, one may indicate the (ext2 or

xfs) filesystem that is to be mounted by its UUID or volume label (cf.

e2label(8) or xfs_admin(8)), writing LABEL= or UUID=,

e.g., ‘LABEL=Boot’ or ‘UUID=3e6be9de-8139-11d1-9106-a43f08d823a6’.

This will make the system more robust: adding or removing a SCSI disk

changes the disk device name but not the filesystem volume label.

The second field, (fs_file), describes the mount point for the filesys-

tem. For swap partitions, this field should be specified as ‘none’. If

the name of the mount point contains spaces these can be escaped as

‘\040’.

The third field, (fs_vfstype), describes the type of the filesystem.

Linux supports lots of filesystem types, such as adfs, affs, autofs, coda, coherent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660,

jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs,

smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, and possibly

others. For more details, see mount(8). For the filesystems currently

supported by the running kernel, see /proc/filesystems. An entry swap

denotes a file or partition to be used for swapping, cf. swapon(8). An

entry ignore causes the line to be ignored. This is useful to show

disk partitions which are currently unused.

The fourth field, (fs_mntops), describes the mount options associated

with the filesystem.

It is formatted as a comma separated list of options. It contains at

least the type of mount plus any additional options appropriate to the

filesystem type. For documentation on the available options for non-

nfs file systems, see mount(8). For documentation on all nfs-specific

options have a look at nfs(5). Common for all types of file system are

the options ‘‘noauto’’ (do not mount when "mount -a" is given, e.g., at

boot time), ‘‘user’’ (allow a user to mount), ‘‘owner’’ (allow device

owner to mount), ‘‘pamconsole’’ (allow a user at the console to mount),

and ‘‘comment’’ (e.g., for use by fstab-maintaining programs). The

‘‘owner’’, ‘‘pamconsole’’ and ‘‘comment’’ options are Linux-specific.

For more details, see mount(8).

The fifth field, (fs_freq), is used for these filesystems by the

dump(8) command to determine which filesystems need to be dumped. If

the fifth field is not present, a value of zero is returned and dump

will assume that the filesystem does not need to be dumped.

The sixth field, (fs_passno), is used by the fsck(8) program to deter-

mine the order in which filesystem checks are done at reboot time. The

root filesystem should be specified with a fs_passno of 1, and other

filesystems should have a fs_passno of 2. Filesystems within a drive

will be checked sequentially, but filesystems on different drives will

be checked at the same time to utilize parallelism available in the

hardware. If the sixth field is not present or zero, a value of zero

is returned and fsck will assume that the filesystem does not need to be checked.

The proper way to read records from fstab is to use the routines getmn-

tent(3).

FILES

/etc/fstab

SEE ALSO

getmntent(3), mount(8), swapon(8), fs(5) nfs(5) fstab-sync(8)

HISTORY

The ancestor of this fstab file format appeared in 4.0BSD.

Linux 2.2 15 June 1999 FSTAB(5)

(END)

这个文件描述系统中各种文件系统的信息。一般而言,应用程序仅读取这个文件,而不对它进行写操作。对它的维护是系统管理员的工作。在这个文件中,每个文件系统用一行来描述,在每一行中,用空格或TAB符号来分隔各个字段,文件中以*开头的行是注释信息。Fstab文件中的纪录的排序十分重要。因为 fsck,mount或umount等程序在做它们的工作时会按此顺序进行。

第一个字段是对文件系统的定义(fs spec),它描述了将被装载的块设备或远程文件系统。对于通常的mount操作而言,这个字段应该包括一个将被装载的块设备的设备结点(通过mknod 命令来创建)或指向这类结点的连接(例如/dev/cdrom或/dev/sdb),对于NFS mount操作,这个字段应该包含host:dir格式的信息,例如:knuth.aeb.nl:/,对于进程文件系统procfs,使用proc。

除了显示的使用设备名,你可以使用设备的UUID或设备的卷标签,例如,你可以在这个字段写成“LABAL=root”或“UUID= 3e6be9de-8139-11d1-9106-a43f08d823a6”,这将使系统更具伸缩性。例如,如果你的系统添加或移除了一个SCSI硬盘,这有可以改变你的设备名,但它不会修改你的卷标签。

每二个字段(fs file),描述文件系统的载入点,对于交换分区(swap),这个字段定义为none,如果在载入点的路径中包含空格符,可以用“\040”来替代空格符。

第三个字段,文件系统类型(fs vfstype),主要用来定义文件系统的类型。Linux系统支持大量的文件类型,包括sdfs,affs,autofs,jfs,minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs,,smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs等等。如果想了解你的kernel目前支持哪些文件系统,可以查看/proc/filesystems的内容。如果这个字段定义为swap,这条纪录将关联到一个用于交换目的的文件或分区。如果这个字段定义为ignored,这行将被忽略。这对于显示目前没有使用的分区非常有用。

每四个字段,文件系统选项(fs mntops)在装载文件系统时使用的装载选项。多个选项之间用逗号做分隔符,这些选项列表包括了装载类型以及对于该文件系统合适的其它装载选项。对于非 NFS系统可用的装载选项可以参看mount命令的说明,对于nfs系统的选项可以查看关于nfs的文档。对于所有文件系统都适用的选项有noauto (当使用mount –a命令时不载入),user(允许用户进行装载),owner(允许设备所有人装载),_netdev(设备需要网络),后两个选项是linux系统所特有的。

第五个字段,文件系统频率(fs_freq),被dump程序使用来确定哪个文件系统需要dump,如果最后一个字段没有设置,系统将认为其值为0,而dump程序则认为此文件系统无需dump。

第6个字段(fs_passno)被fsck程序所使用来确定进行在系统重启进行文件系统检查时的顺序,对于根系统/这个值应设为1,其它文件系统可以设为2,在同一个物理硬盘内的文件系统应该被顺序检测,而不同硬盘中的文件系统则应该同时检测以充分利用系统的并行性。如果最后一个字段值为0或没有设置,fsck程序装跳过此文件系统的检测。在linux编程中可以用getmntent过程来访问这个文件的内容。

以上介绍了各种字段的含义,我们可以通过改变他的字段来在系统的开机时加载不同的文件系统(例如在开机时加载fat32文件系统)

本人的fstab文件配置如下:

LABEL=/ / ext3 defaults 1 1

devpts /dev/pts devpts gid=5,mode=620 0 0

tmpfs /dev/shm tmpfs defaults 0 0

proc /proc proc defaults 0 0

sysfs /sys sysfs defaults 0 0

/dev/hda6 swap swap defaults 0 0

/dev/hda7 /mnt/WinD vfat codepage=936,umask=000,iocharset=utf8 0 0

/dev/hda8 /mnt/WinE vfat codepage=936,umask=000,iocharset=utf8 0 0

其中codepage,umask和iocharset都各自有其不同的含义

分享:

a4c26d1e5885305701be709a3d33442f.png喜欢

0

a4c26d1e5885305701be709a3d33442f.png赠金笔

加载中,请稍候......

评论加载中,请稍候...

发评论

登录名: 密码: 找回密码 注册记住登录状态

昵   称:

评论并转载此博文

a4c26d1e5885305701be709a3d33442f.png

发评论

以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值