Linux umount 报 device is busy 的处理方法

分类:            Linux             2011-02-18 21:48    39106人阅读    评论(2)    收藏    举报    linuxfilesignalaccesssystemuser

今天在IDC 辐射了半天,又弄了套DG。 在Linux 挂盘这块也小学了两招。

一.  umout 移动硬盘

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

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

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

Filesystem            Size  Used Avail Use% Mounted on

/dev/sdb3             125G  3.3G  115G   3% /

/dev/sdb1              99M   12M   82M  13% /boot

tmpfs                 3.9G     0  3.9G   0% /dev/shm

/dev/sda1             275G   72G  189G  28% /u01

/dev/sdc1              10G  2.0G  8.1G  20% /datatmp

就是这个/dev/sdc1。

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

处理方法:

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

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

Filesystem            Size  Used Avail Use% Mounted on

/dev/sdb3             125G  3.3G  115G   3% /

/dev/sdb1              99M   12M   82M  13% /boot

tmpfs                 3.9G     0  3.9G   0% /dev/shm

/dev/sda1             275G   72G  189G  28% /u01

/dev/sdc1              10G  2.0G  8.1G  20% /datatmp

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

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

Filesystem            Size  Used Avail Use% Mounted on

/dev/sdb3             125G  3.3G  115G   3% /

/dev/sdb1              99M   12M   82M  13% /boot

tmpfs                 3.9G     0  3.9G   0% /dev/shm

/dev/sda1             275G   72G  189G  28% /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 Commands                        FUSER(1)

NAME

fuser - identify processes using files or sockets

SYNOPSIS

fuser [-a|-s|-c] [-4|-6] [-n  space ] [-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 the  type

of access:

c      current directory.

e      executable being run.

f      open file. f is omitted in default display mode.

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

r      root directory.

m      mmap'ed file or shared library.

fuser  returns a non-zero return code if none of the specified files is accessed or in case of a fatal error. If at least one access  has  been  found,  fuser  returns zero.

In  order  to  look  up processes using TCP and UDP sockets, the corresponding name space has to be selected with the -n option. By default fuser  will  look  in  both IPv6  and IPv4 sockets. To change the default, behavior, use the -4 and -6 options. The socket(s) can be specified by  the  local  and  remote  port,  and  the  remote address.  All  fields  are  optional, 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

-a     Show all files specified on the command line. By default,  only  files  that are accessed by at least one process are shown.

-c     Same as -m option, used for POSIX compatibility.

-f     Silently ignored, used for POSIX compatibility.

-k     Kill  processes  accessing the file. Unless changed with -signal, SIGKILL is sent. An fuser process never kills itself, but may  kill  other  fuser  processes.  The  effective user ID of the process executing fuser is set to its real user ID before attempting to kill.

-i     Ask the user for confirmation before  killing  a  process.  This  option  is silently ignored if -k is not present too.

-l     List all known signal names.

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

-n space Select a different name  space.  The  name  spaces  file  (file  names,  the default),  udp  (local  UDP ports), and tcp (local TCP ports) are supported. For ports, either the port number or the symbolic name can be specified.  If  there  is no ambiguity, the shortcut notation name/Ispace (e.g. 80/tcp ) can be used.

-s     Silent operation. -u and -v are ignored in this mode.  -a must not  be  used with -s.

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

-u     Append the user name of the process owner to each PID.

-v     Verbose  mode.  Processes are shown in a ps-like style. The fields PID, USER and COMMAND are similar to ps. ACCESS shows how  the  process  accesses  the file.  If  the access is by the kernel (e.g. in the case of a mount point, awap file, etc.), kernel is shown instead of the PID.

-V     Display version information.

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

-6     Search  only  for  IPv6  sockets.  This  option 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

/proc     location of the proc file system

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

------------------------------------------------------------------------------

Blog: http://blog.csdn.net/tianlesoftware

网上资源: http://tianlesoftware.download.csdn.net

相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx

DBA1 群:62697716(满); DBA2 群:62697977(满)

DBA3 群:62697850   DBA 超级群:63306533;

聊天 群:40132017

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

转载于:https://blog.51cto.com/yingmeng/1613619

Linux umount 报 device is busy 的处理方法相关推荐

  1. Linux umount报device is busy

    一.  umout 移动硬盘 开始用sftp 将安装文件copy到服务器的时候,速度太慢了,500k/s.几个G的东西,copy 这些就要半个多小时,扛不住,拿移动硬盘来copy了. 结果移动硬盘的格 ...

  2. centos重启报错Umounting file systems:umount:/opt:device is busy

    系统重启报错: Umounting file systems:umount:/opt:device is busy 只能硬关机,回想一下最近刚安装了nod32 for linux x64的杀毒软件,开 ...

  3. (转载)解决umount: /home: device is busy

    转载于:https://blog.csdn.net/u012207077/article/details/21159339 取消挂载/home时出现umount: /home: device is b ...

  4. Linux 环境下umount, 报 device is busy 的问题分析与解决方法

    在Linux环境中,有时候需要挂载外部目录或硬盘等,但当想umount时,却提示类似"umount:/home/oracle-server/backup:device is busy&quo ...

  5. linux umount 时出现device is busy 的处理方法--fuser

    当任何目录有 mount, 然后有程序使用/挂在那个目录上的话, 就没有办法 umount 掉, 於 umount 时会出现 Device is busy 的讯息. 要怎麼找出是哪个程序挂在那个目录上 ...

  6. 执行umount 的时候却提示:device is busy 的处理方法

    [root@web2-server yum.repos.d]# umount /mnt/cdrom/ umount: /mnt/cdrom: device is busy.         (In s ...

  7. umount.nfs: device is busy解决

    卸载nfs挂载的方法 #umount  /mnt/nfs 可能会出现device is busy的问题. 解决方法: 1.      首先查找谁在占用:#fuser /mnt/nfs 得到进程号. 2 ...

  8. linux 卸载nfs device is busy,umount.nfs: device is busy解决办法

    .NET Core全新的配置管理[共9篇] 提到"配置"二字,我想绝大部分.NET开发人员脑海中会立马浮现出两个特殊文件的身影,那就是我们再熟悉不过的app.config和web. ...

  9. Umount解挂不了的解决方法

    Umount解挂不了的解决方法 一:出现问题 二:解决方法 一:出现问题 在linux中卸载不了,出现这种报错 [root@dbserver /]# umount /dev/sdb6 umount: ...

最新文章

  1. vue 源码学习(二) 实例初始化和挂载过程
  2. c语言中较常见的由内存分配引起的错误_内存越界_内存未初始化_内存太小_结构体隐含指针...
  3. Android运行时识别API版本
  4. oracledatabase11gr2怎么打开_win10 安装oracle 11gR2_database(内附下载地址)
  5. 《迷宫》之站立会议—5.15
  6. roslyn分析字符串代码_.NET 5 源代码生成器——MediatR——CQRS
  7. ubuntu20.04使用终端命令安装谷歌Chrome浏览器稳定版
  8. iOS博客 视频课程网站
  9. 微会动平台与微云推战略携手赋能企业数字营销推广与业绩增长闭环
  10. CAD中插入外部参照字体会变繁体_什么是CAD的形文件,它与字体文件有什么区别?...
  11. MC9S12XS128 事件处理
  12. 酒店管理系统数据库SQl设计思路
  13. 中标麒麟linux系统安装打印机_中标麒麟Linux操作系统和理光打印机完成互相兼容认证...
  14. 硬纪元干货|爱奇艺吴霜:看好互动视频、AI陪伴以及VR直播
  15. Flash Android ANE 打包流程及使用方法
  16. 心情顿时很失落的感觉!
  17. easyexcel插件
  18. (C语言编程)PTA里“三天打鱼两天晒网”
  19. 技术控必读 从Type-A到Type-C发展历程
  20. 机器人的弊议论文_机器人的利与弊议论文

热门文章

  1. 人性经不起金钱的考验,何况是黄金 --- 我看电影《黄金兄弟》
  2. Python 之 Matplotlib (四)图例
  3. 重磅突发!全球首富40颗卫星遭摧毁
  4. FrostSulliven最新发布引领全球增长的60大技术
  5. 人类如何接近“宇宙无限”?微积分的力量无处不在
  6. 传感器的未来: 10年后我们将会生活在一个极端透明的世界
  7. 有人说 GPT3 是“暴力美学”的结晶,它的工作原理你知道吗?| 动图详解
  8. 干货|六维力和力矩传感器的技术与应用
  9. 终于看见光的速度了:每秒一万亿帧的相机,拍摄到光的运行状态!
  10. 一文读懂你该了解的5G知识:现在别买5G手机