We use Windows Server for my company network.

I do use Mac has client. When I mount a network drive, I use the following command line:

osascript -e ‘mount volume “smb://myusername:mypassword@fileserver/department/its”'

everything works fine. I am a user administrator for my network, this is the reason why I guess I am able to mount the network drive in this way and everything works fine.

But my question is: how do I unmount this network drive? What is the command line?

thank you so much

up vote 11 down vote accepted

umount is the opposite of mount. You'll need to know the name of the mount point - that is, the name in /Volumes that corresponds to that network drive.

umount /Volumes/VolumeName

Per man umount, umount may fail for any number of reasons, and the recommend command is instead diskutil:

diskutil unmount /Volumes/VolumeName
  • And this is where the confusion comes for me :-) By using the command line that I posted in my original post, does the command line creates a mount point too? or it just mount the smb drive without creating the mount point? The reason why, I receive error message when I execute the following command: diskutil unmount /fileserver/department/its I receive the following error: Unmount failed for /fileserver/department/its or if I execute: unmount /fileserver/department/its I receive: -bash: unmount: command not found – user2823725 Oct 6 '16 at 20:44
  • 1
    /fileserver/department/its is not a mount point. Unless otherwise specified with a specific mount point, everything is mounted under /Volumes. You will need to list the contents of that directory and find out what the corresponding name is to your network share. It's probably its since that's the last bit of the path from the server. – tubedogg Oct 6 '16 at 20:47
  • Done. Thank you. The answer was: diskutil unmount its – user2823725 Oct 6 '16 at 20:52
  • The other thing is from your previous comment - note that the first command is umount not unmount (notice that the proper command has no "n" in it). That's why you got "command not found" trying to run unmount. diskutil by contrast uses the actual word (with the "n"): diskutil unmount. – tubedogg Oct 6 '16 at 20:55

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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