当前位置: 首页 > news >正文

umount device is busy

 umount  device is busy


.umout 移动硬盘

开始用sftp 将安装文件copy到服务器的时候,速度太慢了,500k/s。几个G的东西,copy 这些就要半个多小时,扛不住,拿移动硬盘来copy了。结果移动硬盘的格式不对。是NTFS 格式,Linux 识别不了。只能格式化成FAT32的。而GG 的win7 系统又不具备格式化成FAT32的功能。有点小变态。让同事在XP 下帮我格式化了。

安装文件copy到服务器后,同事直接将移动硬盘从服务器上拔下来了。导致的结果是,用df 命令查看,挂载的移动硬盘还存在。

[root@qs-wg-db1 ~]# df -lh

FilesystemSizeUsed Avail Use% Mounted on

/dev/sdb3125G3.3G115G3% /

/dev/sdb199M12M82M13% /boot

tmpfs3.9G03.9G0% /dev/shm

/dev/sda1275G72G189G28% /u01

/dev/sdc110G2.0G8.1G20% /datatmp

就是这个/dev/sdc1。

这时使用umount 命令,会提示设备忙,无法挂载。

处理方法:

[root@qs-wg-db1 ~]# fuser -km /datatmp

[root@qs-wg-db1 ~]# df -lh

FilesystemSizeUsed Avail Use% Mounted on

/dev/sdb3125G3.3G115G3% /

/dev/sdb199M12M82M13% /boot

tmpfs3.9G03.9G0% /dev/shm

/dev/sda1275G72G189G28% /u01

/dev/sdc110G2.0G8.1G20% /datatmp

[root@qs-wg-db1 ~]# umount /datatmp

[root@qs-wg-db1 ~]# df -lh

FilesystemSizeUsed Avail Use% Mounted on

/dev/sdb3125G3.3G115G3% /

/dev/sdb199M12M82M13% /boot

tmpfs3.9G03.9G0% /dev/shm

/dev/sda1275G72G189G28% /u01

成功umount了。

. umount 光驱

安装DB 之前,检查了一下相关包,少了3个。从系统安装盘上找了包,安装了一下。当时是直接将/dev/cdrom mount 到了/mnt目录。也是图个方便。结果收工时去拿盘,光驱弹不出来。同事让我把cdrom umout掉。同样的提示,设备忙。

处理方法:

[root@qs-wg-db1 ~]#fuser –km /dev/cdrom

[root@qs-wg-db1 ~]#eject-- 弹出光驱

在网上搜了一下,正确挂载CD-ROM的方法应该如下:

# mkdir cdrom
# mount /dev/cdrom /mnt/cdrom
或者

# mount /dev/cdrom /media/cdrom

直接挂载在/mnt,/media等系统目录下,在umount时会出现出错信息“umount: /mnt/cdrom: device is busy”的情况。

如果一个文件系统处于“busy”状态的时候,不能卸载该文件系统。如下情况将导致文件系统处于“busy”状态:

1) 文件系统上面有打开的文件

2) 某个进程的工作目录在此文件系统上

3) 文件系统上面的缓存文件正在被使用

. fuser 命令

前面2个umout 都使用了这个fuser 命令。man了一下这个命令。内容如下:

[root@qs-wg-db1 ~]# man fuser

FUSER(1)User CommandsFUSER(1)

NAME

fuser - identify processes using files or sockets

SYNOPSIS

fuser [-a|-s|-c] [-4|-6] [-nspace ] [-k [-i] [-signal ] ] [-muvf] name

fuser -l

fuser -V

DESCRIPTION

fuser displays the PIDs of processes using the specified files or file systems.In the default display mode, each file name is followed by a letter denoting thetype

of access:

ccurrent directory.

eexecutable being run.

fopen file. f is omitted in default display mode.

Fopen file for writing. F is omitted in default display mode.

rroot directory.

mmmap'ed file or shared library.

fuserreturns a non-zero return code if none of the specified files is accessed or in case of a fatal error. If at least one accesshasbeenfound,fuserreturns zero.

Inordertolookup processes using TCP and UDP sockets, the corresponding name space has to be selected with the -n option. By default fuserwilllookinboth IPv6and IPv4 sockets. To change the default, behavior, use the -4 and -6 options. The socket(s) can be specified bythelocalandremoteport,andtheremote address.Allfieldsareoptional, but commas in front of missing fields must be present:

[lcl_port][,[rmt_host][,[rmt_port]]]

Either symbolic or numeric values can be used for IP addresses and port numbers.

fuser outputs only the PIDs to stdout, everything else is sent to stderr.

OPTIONS

-aShow all files specified on the command line. By default,onlyfilesthat are accessed by at least one process are shown.

-cSame as -m option, used for POSIX compatibility.

-fSilently ignored, used for POSIX compatibility.

-kKillprocessesaccessing the file. Unless changed with -signal, SIGKILL is sent. An fuser process never kills itself, but maykillotherfuserprocesses.Theeffective user ID of the process executing fuser is set to its real user ID before attempting to kill.

-iAsk the user for confirmation beforekillingaprocess.Thisoptionis silently ignored if -k is not present too.

-lList all known signal names.

-mnamespecifiesafileon a mounted file system or a block device that is mounted. All processes accessing files on that file system are listed.If adirectoryfileisspecified, it is automatically changed to name/. to use any file system that might be mounted on that directory.

-n space Select a different namespace.Thenamespacesfile(filenames,the default),udp(localUDP ports), and tcp (local TCP ports) are supported. For ports, either the port number or the symbolic name can be specified.If thereis no ambiguity, the shortcut notation name/Ispace (e.g. 80/tcp ) can be used.

-sSilent operation. -u and -v are ignored in this mode.-a must notbeused with -s.

-signal Usethe specified signal instead of SIGKILL when killing processes. Signals can be specified either by name (e.g. -HUP) or bynumber(e.g.-1).This option is silently ignored if the -k option is not used.

-uAppend the user name of the process owner to each PID.

-vVerbosemode.Processes are shown in a ps-like style. The fields PID, USER and COMMAND are similar to ps. ACCESS shows howtheprocessaccessesthe file.Ifthe access is by the kernel (e.g. in the case of a mount point, awap file, etc.), kernel is shown instead of the PID.

-VDisplay version information.

-4Search only for IPv4 sockets. This option mustnotbeusedwiththe-6 option and only has an effect with the tcp and udp namespaces.

-6SearchonlyforIPv6sockets.Thisoption must not be used with the -4 option and only has an effect with the tcp and udp namespaces.

-Reset all options and set the signal back to SIGKILL.

FILES

/proclocation of the proc file system

fuser 命令显示访问某个文件的进程的PID. 其中-k 和 -m 参数上面红色部分有说明。-k 是kill 访问这个文件的进程。没有进程访问,就可以成功umount了.



今天遇到了一個問題,過程如下:

[root@fktest002 /]# mount //10.188.129.141/sql /mnt -o username=administrator
Password:
[root@fktest002 /]# cd /mnt
[root@fktest002 mnt]# ls
activesession.sql  dbfile.sql  job.sql         l.sql        seg.sql       sqlplan.sql 

[root@fktest002 mnt]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              30G   20G  8.4G  71% /
/dev/sda1              99M   12M   83M  12% /boot
none                  252M     0  252M   0% /dev/shm
/dev/mapper/VolGroup00-LogVol01
                       20G  9.9G  8.9G  53% /u02
/dev/mapper/VolGroup00-LogVol02
                       18G  1.7G   16G  10% /u10
//10.188.129.141/sql   21G   14G  6.9G  66% /mnt

但不小心,我把10.188.129.141/sql文件夾共享取消了 結果:

[root@fktest002 mnt]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              30G   20G  8.4G  71% /
/dev/sda1              99M   12M   83M  12% /boot
none                  252M     0  252M   0% /dev/shm
/dev/mapper/VolGroup00-LogVol01
                       20G  9.9G  8.9G  53% /u02
/dev/mapper/VolGroup00-LogVol02
                       18G  1.7G   16G  10% /u10
df: `/mnt': Invalid slot

[root@fktest002 mnt]# umount /mnt
umount: /mnt: device is busy
umount: /mnt: device is busy

假设无法卸载的设备为 /mnt,运行下列命令即可:

# fuser -m -v /mnt
       用户 进程号 权限 命令
/mnt: galeki 335 ..c.. gqview

-m 参数显示所有使用指定文件系统的进程,后面可以跟挂载点,或是dev设备,-v 参数给出详细的输出,可以看出,原来是 gqview 这个程序还在霸占着移动设备,fuser 还给出了程序的进程号,知道了进程号,你就可以随便怎么处置这个程序了。

另外你也可以添加一个 -k 参数:

fuser -m -k /mnt

这招自动把霸占着 /mnt/ 的程序杀死。如果你不是很明确是否要杀死所有霸占设备的程序,你还可以加一个 -i 参数,这样每杀死一个程序前,都会询问:

# fuser -m -v -i -k /mnt

     用户 进程号 权限命令
/mnt: galeki 371 ..c.. gqview
杀死进程 371 ? (y/N)

嘿嘿,這個問題解決了....



解决:

[root@sdb ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                       45G   23G   20G  54% /

/dev/sda1             190M   13M  168M   7% /boot

tmpfs                 3.9G  1.9G  2.1G  49% /dev/shm

[root@sdb ~]# fuser -m -v /dev/shm


                     USER        PID ACCESS COMMAND

/dev/shm:            oracle     3902 ....m oracle

                     oracle     3904 ....m oracle

                     oracle     3906 ....m oracle

                     oracle     3910 ....m oracle

                     oracle     3912 ....m oracle

                     oracle     3914 ....m oracle

                     oracle     3916 ....m oracle

                     oracle     3918 ....m oracle

                     oracle     3920 ....m oracle

                     oracle     3922 ....m oracle

                     oracle     3924 ....m oracle

                     oracle     3926 ....m oracle

                     oracle     3928 ....m oracle

                     oracle     3930 ....m oracle

                     oracle     3932 ....m oracle

                     oracle     3934 ....m oracle

                     oracle     3936 ....m oracle

                     oracle     3940 ....m oracle

                     oracle     4028 ....m oracle

                     oracle     4030 ....m oracle

                     oracle     4032 ....m oracle

                     oracle     4034 ....m oracle

                     oracle     4036 ....m oracle

                     oracle     4038 ....m oracle

                     oracle     4040 ....m oracle

                     oracle     4044 ....m oracle

                     oracle     4051 ....m oracle

                     oracle     4058 ....m oracle

                     oracle     4075 ....m oracle

                     oracle     4086 ....m oracle

                     oracle     4088 ....m oracle

                     oracle     4106 ....m oracle

说明oracle用户占到进程的。

[root@sdb ~]# su - oracle

[oracle@sdb ~]$ exit

logout

[root@sdb ~]# su - grid

[grid@sdb ~]$ crs_stop -all

CRS-2500: Cannot stop resource 'ora.diskmon' as it is not running

CRS-2500: Cannot stop resource 'ora.ons' as it is not running

Attempting to stop `ora.evmd` on member `sdb`

Attempting to stop `ora.sdb.db` on member `sdb`

Attempting to stop `ora.cssd` on member `sdb`

Stop of `ora.cssd` on member `sdb` succeeded.

Stop of `ora.evmd` on member `sdb` succeeded.

Stop of `ora.sdb.db` on member `sdb` succeeded.

CRS-0216: Could not stop resource 'ora.diskmon'.


CRS-0216: Could not stop resource 'ora.ons'.


[grid@sdb ~]$ exit

logout

[root@sdb ~]# ps -ef | grep ora_

root      4181  3676  0 21:07 pts/1    00:00:00 grep ora_

[root@sdb ~]# umount /dev/shm

[root@sdb ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                       45G   23G   20G  54% /

/dev/sda1             190M   13M  168M   7% /boot

[root@sdb ~]# 





相关文章:

  • Ajax、Comet与Websocket
  • 新博客 Fighting
  • Python输出中文乱码问题
  • 查看控件id的工具
  • 夜雨
  • 15位行业领袖策划顶尖技术聚会
  • 极简反传(BP)神经网络
  • 黄聪:PHP 防护XSS,SQL,代码执行,文件包含等多种高危漏洞
  • 普通java类获取 spring中的bean方法
  • lufylegend-HTML5游戏引擎学习笔记6:事件
  • Linux中的grep、egrep及相应的正则表达式和用法
  • 最少的次数
  • 阿里巴巴面试题集合
  • Android提供的layout文件存放位置
  • 《我是一只IT小小鸟》读后感
  • 2017年终总结、随想
  • Git的一些常用操作
  • js如何打印object对象
  • LeetCode18.四数之和 JavaScript
  • vue自定义指令实现v-tap插件
  • 分享几个不错的工具
  • 前端学习笔记之原型——一张图说明`prototype`和`__proto__`的区别
  • 微信小程序实战练习(仿五洲到家微信版)
  • 详解移动APP与web APP的区别
  • 一个项目push到多个远程Git仓库
  • 用jQuery怎么做到前后端分离
  • 在Unity中实现一个简单的消息管理器
  • #图像处理
  • (C语言版)链表(三)——实现双向链表创建、删除、插入、释放内存等简单操作...
  • (Redis使用系列) Springboot 使用redis实现接口幂等性拦截 十一
  • (牛客腾讯思维编程题)编码编码分组打印下标题目分析
  • (排序详解之 堆排序)
  • (一) springboot详细介绍
  • *setTimeout实现text输入在用户停顿时才调用事件!*
  • .NET 中什么样的类是可使用 await 异步等待的?
  • .NET/C# 中设置当发生某个特定异常时进入断点(不借助 Visual Studio 的纯代码实现)
  • .NET设计模式(11):组合模式(Composite Pattern)
  • .NET运行机制
  • /var/log/cvslog 太大
  • @ConfigurationProperties注解对数据的自动封装
  • []使用 Tortoise SVN 创建 Externals 外部引用目录
  • [Android Pro] Notification的使用
  • [Android] Upload package to device fails #2720
  • [BZOJ] 2006: [NOI2010]超级钢琴
  • [BZOJ1053][HAOI2007]反素数ant
  • [C/C++]数据结构 循环队列
  • [Docker]四.Docker部署nodejs项目,部署Mysql,部署Redis,部署Mongodb
  • [Excel] vlookup函数
  • [GDMEC-无人机遥感研究小组]无人机遥感小组-000-数据集制备
  • [Gradle] 在 Eclipse 下利用 gradle 构建系统
  • [IOI2018] werewolf 狼人
  • [json]定义、读写
  • [LeetBook]【学习日记】数组内乘积
  • [Mac软件]Adobe XD(Experience Design) v57.1.12.2一个功能强大的原型设计软件
  • [na]wac无线控制器集中转发部署的几种情况