如何检查挂载是否准备好(不忙)(opensuse)?

如何检查挂载是否准备好(不忙)(opensuse)?

如果我创建以下安装:

mount -o user=root,pass=test123 //samba1/testshare /mnt/d928a47b-9ee0-40cd-a356-fa382a7ea8e5

我可以通过运行查看它mount

mount
...
//samba1/testshare on /mnt/d928a47b-9ee0-40cd-a356-fa382a7ea8e5 type cifs (rw,relatime,vers=3.1.1,cache=strict,username=root,uid=0,noforceuid,gid=0,noforcegid,addr=172.17.0.2,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,user=root)

有没有办法在创建安装后检查安装是否已准备好/不忙?

例如,如果我尝试再次创建挂载,我会收到一条错误消息,指出设备或资源正忙(而不是更准确的“挂载已创建”消息):

mount -o user=root,pass=test123 //samba1/testshare /mnt/d928a47b-9ee0-40cd-a356-fa382a7ea8e5
mount error(16): Device or resource busy
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

我正在尝试找到一种方法来区分:

  • 已创建并准备就绪的坐骑
  • 已创建但未准备好的坐骑

这是否合适:

lsof -n | grep /mnt/d928a47b-9ee0-40cd-a356-fa382a7ea8e5 
// If non-empty result == mount is not ready/busy?

答案1

lsof -n /mnt/d928a47b-9ee0-40cd-a356-fa382a7ea8e5 

或者

fuser -um /mnt/d928a47b-9ee0-40cd-a356-fa382a7ea8e5 

fuser也有--kill选择

相关内容