网普技术论坛 网普科技  
» 游客:   网普主页 | 注册 | 登录 | 帮助
 

作者:
标题: Fstab 上一主题 | 下一主题
网普科技
网普管理员

网普科技人民公仆


积分 3080
发贴 2863
注册 2004-6-26
来自 网普科技
状态 离线
#1  Fstab

http://wiki.linuxquestions.org/wiki/Fstab

/etc/fstab is a configuration file that is used to tell Linux what file systems to mount on boot and where.
Contents
[hide]

    * 1 Format
          o 1.1 Device
          o 1.2 Mount Point
          o 1.3 Filesystem
          o 1.4 Options
          o 1.5 Dump
          o 1.6 Fsck
    * 2 Auto-mount of iso-image in /etc/fstab

Format

The format of every line is

[Device] [Mount Point] [Filesystem] [Options] [dump] [fsck order]

the character # allows to write comments into the file. A typical /etc/fstab file can look like this:

/dev/hda2                /               ext2                defaults        1  1
/dev/cdrom                /mnt/cdrom        iso9660                noauto,ro,user  0  0
/dev/hda1                /mnt/dos/c        msdos                defaults        0  0
/dev/fd0                /mnt/floppy        ext2                noauto,user        0  0
/dev/hdb1                /mnt/hdb1       auto                defaults        0  0
/dev/hda3                none                swap                sw               
mynfsserver:/vol/vol1        /mnt/filer        nfs                defaults        0  0
//mysambaserver/share        /mnt/sambashare        smbfs                rw,credentials=/home/joe/winbox-credentials.txt  0  0

Device

This is the physical location of the file system, e.g

    * /dev/hda - The master drive connected to the primary IDE cable.
    * /dev/hda2 - The second partition on master drive on primary IDE.
    * /dev/hdb - second drive on primary IDE cable.
    * /dev/fd0 - First floppy drive

It can also be a file system volume label or UUID, using this has the advantage that adding/removing disks won't effect what gets mounted. The format to use instead of the device name in the fstab file is:

LABEL=<label>

(Where <label> is some name, e.g. Boot)

UUID=<uuid>

(Where <uuid> is some number like 3e6be9de‐8139‐11d1‐9106‐a43f08d823a6. You can find out the uuid of your devices using hwinfo --block.)

How the label and the UUID are set depends on the file system type used. It can normally be set when creating/formatting the file system and the file system type usually has some tool to change it later on (e.g. e2tunefs, xfs_admin, reiserfstune etc.)
Mount Point

The mount point is what folder the filesystem is to be available under from system root, e.g.

    * /media/floppy
    * /media/cdrom
    * /mnt (temporary mount point)

Note: Make sure folder exists
Filesystem

This specifies what filesystem the device uses. Typically you will be mounting iso9660 for CDs and ext2/ext3/ReiserFS for hard drives/floppies. It can also be NFS which means the mount operation can only start after the network is up. If it is not a network drive and you just want it to be mounted (no matter which filesystem), use auto.
Options

This field describes how kernel should handle filesystem, i.e. will it be writable by the user.

    * sync/async - All I/O to the file system should be done (a)synchronously.
    * auto - The filesystem can be mounted automatically (at bootup, or when mount is passed the -a option). This is really unnecessary as this is the default action of mount -a anyway.
    * noauto - The filesystem will NOT be automatically mounted at startup, or when mount passed -a. You must explicitly mount the filesystem.
    * dev/nodev - Interpret/Do not interpret character or block special devices on the file system.
    * exec / noexec - Permit/Prevent the execution of binaries from the filesystem.
    * suid/nosuid - Permit/Block the operation of suid, and sgid bits.
    * ro - Mount read-only.
    * rw - Mount read-write.
    * user - Permit any user to mount the filesystem. This automatically implies noexec, nosuid,nodev unless overridden.
    * nouser - Only permit root to mount the filesystem. This is also a default setting.
    * defaults - Use default settings. Equivalent to rw, suid, dev, exec, auto, nouser, async.
    * _netdev - this is a network device, mount it after bringing up the network. Only valid with fstype nfs.
    * atime - This option causes Linux to record the last (or latest) time when a particular file was accessed.
    * noatime - This option stops recording the last file access time when the file is just read.
    * relatime - This option causes the access time to be updated if they are earlier than the modification time.

Dump

Dump field sets whether the backup utility dump will backup file system. If set to "0" the file system is ignored, with "1" it is backed up.
Fsck

Fsck order is to tell fsck what order to check the file systems, if set to "0" the file system is ignored.
Auto-mount of iso-image in /etc/fstab

/iso-archiv/image.iso /mnt/image1 iso9660 ro,loop,auto 0 0
( first mkdir /mnt/image1 !)

Read more: http://wiki.linuxquestions.org/wiki/Fstab#ixzz0XCYC1bSJ



天理路上甚宽,稍游心,胸中便觉广大宏朗;
人欲路上甚窄,才寄迹,眼前俱是荆棘泥涂。



网普科技,优质美国主机服务!
美国Linux主机,美国虚拟主机
支持PHP+MYSQL+cPanel+EMAIL
为用户负责,拒绝反动、赌博及色情内容! QQ:126818

发送QQ消息
2009-11-18 05:24 PM
查看资料  访问主页  发短消息  QQ   编辑帖子  引用回复 顶部
茱莉娅
THE BODY SHOP美容顾问

茱莉娅美体小铺


积分 3080
发贴 2863
注册 2009-5-21
来自 茱莉娅美体小铺
状态 离线
#1  赞助商信息The body shop

茱莉娅美体小铺
茱莉娅美体小铺淘宝店
茱莉娅美体小铺


茱莉娅美体小铺淘宝店
2009-11-18 05:24 PM
查看资料  访问主页  发短消息  QQ   编辑帖子  引用回复 顶部


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转:  




Powered by Discuz! 2.5 © 2001-2005 Comsenz Technology Ltd.
Processed in 0.009328 second(s), 8 queries, Gzip enabled
------------------------------------------------------------------------------
本论坛属网普科技交流与技术支持论坛!
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论!
美国主机, 美国虚拟主机, cPanel+PHP+Mysql+Ftp+Email+Zend+GD2+国际域名支持
技术支持 QQ: 126818 EMail & MSN: support[AT]netpu.net
[ 联系我们 ] - [ 网普科技 ]