在umount文件系统时,经常会遇到umount: /langanglin: device is busy这样的问题不能umount,一般情况下是因为有别的进程在访问这个目录。下面说下两种解决方法
一:fuser
- [root@lanv langanglin]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/sda1 19G 3.3G 15G 19% /
- tmpfs 501M 0 501M 0% /dev/shm
- /dev/sdb1 1004M 18M 936M 2% /langanglin
- [root@lanv langanglin]# pwd
- /langanglin
- [root@lanv ~]# umount /langanglin/
- umount: /langanglin: device is busy
- umount: /langanglin: device is busy
- [root@lanv ~]# fuser -mk /langanglin/
- /langanglin/: 3714c
- [root@lanv ~]# umount /langanglin/
- [root@lanv ~]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/sda1 19G 3.3G 15G 19% /
- tmpfs 501M 0 501M 0% /dev/shm
- [root@lanv ~]#
这个方法一般情况下就能解决不能umount的问题,但是也有很多情况下,这个方法不起作用,例如占用这个文件系统的进程是nfs的handle进程。
方法二:umount -l
- [root@lanv ~]# mount -t nfs 192.168.238.99:/langanglin/ /langanglin/
- [root@lanv ~]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/sda1 19G 3.3G 15G 19% /
- tmpfs 501M 0 501M 0% /dev/shm
- 192.168.238.99:/langanglin/
- 19G 3.3G 15G 19% /langanglin
- [root@lanv ~]# cd /langanglin/
- [root@lanv langanglin]# pwd
- /langanglin
- [root@lanv ~]# service nfs stop
- Shutting down NFS mountd: [ OK ]
- Shutting down NFS daemon: [ OK ]
- Shutting down NFS quotas: [ OK ]
- Shutting down NFS services: [ OK ]
- [root@lanv ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 19G 3.3G 15G 19% /
tmpfs 501M 0 501M 0% /dev/shm
- df:'/langanglin':Stale NFS file handle
- [root@lanv ~]# umount -l /langanglin
- [root@lanv ~]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/sda1 19G 3.3G 15G 19% /
- tmpfs 501M 0 501M 0% /dev/shm
- [root@lanv ~]#
umount -l参数:从文件系统层次结构分离文件系统和清理其所引用的文件系统,文件系统就不会出现busy的情况了。
- -l Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all refer-ences to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)
阅读(2905) | 评论(0) | 转发(0) |