If I create the following mount:

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

I can view it by running 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=,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,user=root)

Is there a way I can check if the mount is ready/not busy after I create it?

For example, if I try to create the mount again, I get an error message saying the device or resource is busy (rather than a more accurate 'mount already created' message):

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)

I'm trying to find a way to distinguish between:

  • A mount that has already been created and is ready
  • A mount that has already been created and is not ready

Would this be suitable:

lsof -n | grep /mnt/d928a47b-9ee0-40cd-a356-fa382a7ea8e5 
// If non-empty result == mount is not ready/busy?
  • 1
    What do you mean by "ready"? If you mount it, it's ready.
    – aviro
    Nov 23, 2021 at 17:47

1 Answer 1

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


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

fuser also has --kill option

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.