现在的位置: 首页 > 综合 > 正文

重新整理了下mount/umount,免得老是不来新机忘记了

2012年12月14日 ⁄ 综合 ⁄ 共 2222字 ⁄ 字号 评论关闭
挂接就是将分离的文件系统附加到文件系统分成结构中。文件系统要附加到某个挂接点,也就是目录。  
挂接和卸载文件系统发生在系统启动和关闭时。  
系统启动时,将读取/etc/vfstab文件。这个文件记录系统要挂接的文件系统。因此/etc/vfstab文件中的文件系统将自动挂接。也可以从命令行方式下人工挂接文件系统。  

不加参数的mount显示系统目前已经挂接的文件系统。  
# mount  
/ on /dev/dsk/c0t3d0s0 read/write/setuid/largefiles/logging on Mon Nov 18  
17:58:19 1998  
/usr on /dev/dsk/c0t3d0s6 read/write/setuid/largefiles/logging on Mon Nov 18  
17:58:19 1998  
/proc on /proc read/write/setuid on Mon Nov 18 17:58:19 1998  
/dev/fd on fd read/write/setuid on Mon Nov 18 17:58:19 1998  
/var on /dev/dsk/c0t3d0s1 nolargefiles/read/write/setuid on Mon Nov 18 17:58:19  
1998  
/opt on /dev/dsk/c0t3d0s5 setuid/read/write/largefiles on Mon Nov 18 17:58:20  
1998  
/tmp on swap read/write on Mon Nov 18 17:58:20 1998  
/pns on dbserver:/export/pse soft/nosuid/remote on Mon Nov 18 19:04:36 1998  

1.mount的选项,可以用-o标定mount的选项

nolargefiles参数将使文件系统中所有新建的文件小于2G字节。
remount 向mount表明它应该向一个已经加载的文件系统重新加载的文件系统重新加载。这通常用来改变文件系统的加载标记,特别可用来将一个只读的文件系统改成可读写的文件系统。
ro 将文件系统加载为只读
rw 将文件系统加载为可读写
intr 允许杀死文件系统中正在等待的进程。
  
# mount -o nolargefiles /dev/dsk/c0t3d0s7 /export/home  

文件系统中文件的大小不能超过2G,使用这个参数可能出现错误,原因是由于文件系统包含了大于2G的文件,注意:是/dev/dsk/下的而不是/dev/rdsk下的,
因为/dev/rdsk下的设备是物理设备,/dev/dsk下的文件是连接到/dev/rdsk下的

要挂接在/etc/vfstab中已有的某个文件系统时,只需要用命令  
# mount /export/home  

/etc/vfstab文件格式  
#device device mount FS fsck mount mount  
#to mount to fsck point type pass at boot ops  
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -  
/proc - /proc proc - no -  
fd - /dev/fd fd - no -  
swap - /tmp tmpfs - yes -  
/dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no -  
/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /usr ufs 1 no -  
/dev/dsk/c0t3d0s3 /dev/rdsk/c0t3d0s3 /export ufs 5 yes -  
/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /export/home ufs 5 yes -  
/dev/dsk/c0t3d0s5 /dev/rdsk/c0t3d0s5 /opt ufs 8 yes -  
/dev/dsk/c0t3d0s1 - - swap - no -  
注意:一般不用yes用no -

#mount -a 通知mount应加载的所有文件系统,等同于/usr/sbin/mountall
通常不由管理员使用而是在系统启动时候/etc/init.d/MOUNTFSYS自动发出。

列出加载的文件系统
#mount

查看文件系统

umount卸载文件系统  
# umount /dev/dsk/c0t3d0s7  
或  
# umount /export/home  
如果文件系统中某个文件正在使用,则不能卸载这个文件系统。

当一个设备busy状态时
可以用
#umount -f /mount_point 强制卸载一个目录 (容易丢失数据)
或用如下:(推荐)

Using the fuser Command
To stop all processes from accessinga file system:
As root,list all the processes accessing the file system
#fuser -cu mount_point
2.Kill all processes accessing the file system.
#fuser -ck mount_point
3.Verify there are no processes accessing the file system.
#fuser -c mount_point
4.Unmount the file system.
# umount mount_point

【上篇】
【下篇】

抱歉!评论已关闭.