Linux-fstab-參數(shù)詳解_第1頁
Linux-fstab-參數(shù)詳解_第2頁
Linux-fstab-參數(shù)詳解_第3頁
Linux-fstab-參數(shù)詳解_第4頁
Linux-fstab-參數(shù)詳解_第5頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、Linux fstab 參數(shù)詳解Linux fstab 參數(shù)詳解 Linux 下的加掛硬盤經(jīng)常使用。 在最后一步修改/etc/fstab 文件設(shè)置開機自動掛載。今天用的時候,發(fā)現(xiàn)對這個文件中的最后2個參數(shù)不是很明白。 再次MAN了一下。 Linux 下掛載硬盤的 方法 rootqs-wg-db1 /# cat /etc/fstab LABEL=/ / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=6

2、20 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 LABEL=SWAP-sda2 swap swap defaults 0 0 /dev/sda1 /u01 ext3 defaults 0 0 rootqs-wg-db1 /# man fstab FSTAB(5 Linux Programmer's Manual FSTAB(5 NAME fstab - static information about the filesystems SYNOPSIS #include <fstab.h> D

3、ESCRIPTION The file fstab contains descriptive information about the various file systems. fstab is only read by programs, and not written; It is the duty of the system administrator to properly create and maintain this file. Each filesystem is described on a separate line; fields on each line are s

4、eparated by tabs or spaces. Lines starting with '#' are comments. The order of records in fstab is important(fatab中記錄的順序很重要) 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 rem

5、ote 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 <host>:<dir>, e.g., 'knuth.aeb.nl:/'. For proc

6、fs, use 'proc'. 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=<label> or UUID=<uuid>, e.g., 'LABEL=Boot' or 'UUID=3e6be9de-8139-11d1-

7、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 filesystem. For swap partitions, this field should be specified as '

8、;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,

9、 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 denot

10、es 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

11、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

12、 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 mou

13、nt, 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 b

14、y 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.(0表示不需要dump) The sixth field, (fs_passno(第六個字段), is used by the fsck(8 program to determine the or

15、der 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

16、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. (如果不指定或者為0, 該硬件在重啟時fsck將不檢查) The proper way to read records from fstab is to use the routines getmntent(3. FILES

17、 /etc/fstab SEE ALSO getmntent(3, mount(8, swapon(8, fs(5, nfs(5 HISTORY The ancestor of this fstab file format appeared in 4.0BSD. 網(wǎng)上找到一份中文版的: fs_specfs_filefs_typefs_optionsfs_dumpfs_pass /dev/hda1/ext2defaults 11 (1)fs_spec: 該字段定義希望加載的文件系統(tǒng)所在的設(shè)備或遠(yuǎn)程文件系統(tǒng),對于一般的本地塊設(shè)備情況來說:IDE設(shè)備一般描述為 /dev/hdaXN,X是IDE 設(shè)備

18、通道(a,b,orc,N代表分區(qū)號;SCSI設(shè)備一描述為/dev/sdaXN。對于NFS情況,格式一般為:,例如: knuth.aeb.nl:/'。對于procfs,使用proc'來定義。 對文件系統(tǒng)的定義(fs spec,它描述了將被裝載的塊設(shè)備或遠(yuǎn)程文件系統(tǒng)。對于通常的mount操作而言,這個字段應(yīng)該包括一個將被裝載的塊設(shè)備的 設(shè)備結(jié)點(通過mknod 命令來創(chuàng)建或指向這類結(jié)點的連接(例如/dev/cdrom或/dev/sdb,對于NFS mount操作,這個字段應(yīng)該包含host:dir格式的信息,例如:knuth.aeb.nl:/,對于進(jìn)程文件系統(tǒng)procfs,使用pro

19、c。 除了顯示的使用設(shè)備名,你可以使用設(shè)備的UUID或設(shè)備的卷標(biāo)簽,例如,你可以在這個字段寫成“LABAL=root”或“UUID=3e6be9de -8139-11d1-9106-a43f08d823a6”,這將使系統(tǒng)更具伸縮性。例如,如果你的系統(tǒng)添加或移除了一個SCSI硬盤,這有可以改變你的設(shè)備名,但它不會修改你的卷標(biāo)簽。 (2)fs_file: 該字段描述希望的文件系統(tǒng)加載的目錄點,對于swap設(shè)備,該字段為none;對于加載目錄名包含空格的情況,用40來表示空格。描述文件系統(tǒng)的載入點,對于交換分區(qū)(swap,這個字段定義為none,如果在載入點的路徑中包含空格符,可以用“/040”來替

20、代空格符。 (3)fs_type:定義了該設(shè)備上的文件系統(tǒng),一般常見的文件類型為ext2(Linux設(shè)備的常用文件類型、vfat(Windows系統(tǒng)的fat32格式、NTFS、iso9600等.文件系統(tǒng)類型(fs vfstype,主要用來定義文件系統(tǒng)的類型。Linux系統(tǒng)支持大量的文件類型,包括sdfs,affs,autofs,jfs,minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs,,smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs等等。如果想了解你的kernel

21、目前支持哪些文件系統(tǒng),可以查看/proc/filesystems的內(nèi)容。如果這個字段定義為swap,這條紀(jì)錄將關(guān)聯(lián)到一個用于交換目的的文件或分區(qū)。如果這個字段定義為ignored,這行將被忽略。這對于顯示目前沒有使用的分區(qū)非常有用。 (4)fs_options:指定加載該設(shè)備的文件系統(tǒng)是需要使用的特定參數(shù)選項,多個參數(shù)是由逗號分隔開來。文件系統(tǒng)選項(fs mntops在裝載文件系統(tǒng)時使用的裝載選項。多個選項之間用逗號做分隔符,這些選項列表包括了裝載類型以及對于該文件系統(tǒng)合適的其它裝載選項。對于非 NFS系統(tǒng)可用的裝載選項可以參看mount命令的說明,對于nfs系統(tǒng)的選項可以查看關(guān)于nfs的文檔。對于所有文件系統(tǒng)都適用的選項有noauto (當(dāng)使用mount a命令時不載入,user(允許用

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論