系统管理指南:设备和文件系统

Procedure如何向 /etc/vfstab 文件添加项

  1. 成为超级用户或承担等效角色。

  2. 如有必要,请为要挂载的文件系统创建挂载点。


    # mkdir /mount-point
    

    本地系统上必须存在挂载点才能挂载文件系统。挂载点是要向其附加已挂载文件系统的目录。

  3. 编辑 /etc/vfstab 文件并添加项。请确保执行以下操作:

    1. 使用空白(空格或制表符)分隔各个字段。

    2. 如果字段没有内容,请指定连字符 (-)。

    3. 保存更改。

    有关 /etc/vfstab 字段各项的详细信息,请参见表 19–3


    注 –

    由于在引导过程中内核会将根 (/) 文件系统挂载为只读,因此只有 remount 选项(以及可以与 remount 结合使用的选项)会影响 /etc/vfstab 文件中的根 (/) 项。



示例 19–2 向 /etc/vfstab 文件添加项

以下示例说明如何将磁盘片 /dev/dsk/c0t3d0s7 作为 UFS 文件系统挂载到挂载点 /files1。原始字符设备 /dev/rdsk/c0t3d0s7 会指定为 device to fsckfsck pass 值为 2 意味着将检查文件系统,但不是按顺序检查。


#device           device             mount    FS       fsck   mount    mount

#to mount         to fsck            point    type     pass   at boot  options

#

/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /files1  ufs      2      yes       -

以下示例说明如何将 /export/man 目录作为 NFS 文件系统从系统 pluto 挂载到挂载点 /usr/man 上。由于该目录是 NFS 文件系统,因此既不会指定 device to fsck 也不会指定 fsck pass。在本示例中,mount optionsro(只读)和 soft


#device           device             mount    FS       fsck   mount    mount

#to mount         to fsck            point    type     pass   at boot  options

pluto:/export/man   -                /usr/man nfs      -      yes       ro,soft

以下示例说明如何将根 (/) 文件系统挂载到回送挂载点 /tmp/newroot 上。必须始终在 LOFS 文件系统中的文件系统之后挂载 LOFS 文件系统。


#device           device             mount    FS       fsck   mount    mount

#to mount         to fsck            point    type     pass   at boot  options

#

/                   -                /tmp/newroot lofs -      yes       -