21

I've mounted few shared locations using the below command.

mount -t cifs /mnt/systemfolder -o username=name,password=password //10.10.1.1/My-Shared-Folder

A few incorrect locations* have been erroneously mounted while running this command. Now when I execute just the mount command, it lists all the right and wrong locations I've mounted.

    • I have mounted the same location multiple times.

How do I remove locations that show up from executing the mount command so that I can remove the incorrect ones I've mounted?

The umount command does not help me remove the mounted location. Here's a screenshot showing the results to the mount and umount commands.

enter image description here

1
  • For future reference, I had the same error: This utility only unmounts cifs filesystems. when trying to unmount a CIFS mount whose parent directory had been moved (effectively moving the mountpoint). This error would occur when trying to use umount on either the correct mount point (where the mount was moved from) and when trying to remove the mount via the source mountpoint name (//ip/path). To successfully unmount, I ran umount on the new location of the mountpoint on the loca
    – user81520
    Aug 21, 2014 at 10:34

8 Answers 8

21

You have several directories that are mounted over other directories (the second mount on /mnt/arcserver shadows the first one and so on, and the mounts on /mnt shadow the prior mounts on /mnt/arcserver). This is confusing both for humans and to the umount command. Unmount them from the bottom up:

umount //10.49.4.20/Released
umount //10.49.4.20/released
umount //10.49.4.20/released
umount //metro/released
umount //metro/released
umount //metro/released

If even that fails because umount is tripping on the multiple identical mounts, in desperation, unmount all cifs mounts:

umount -a -t cifs

On Linux, you can unconfuse the situation by moving mounts so that each has its unique, non-overlapping mount point.

mkdir /TMPMNT/{Released,released{1,2},arcserver{1,2,3,4}}
mount --move //10.49.4.20/Released /TMPMNT/Released
mount --move //10.49.4.20/released /TMPMNT/released1
mount --move //10.49.4.20/released /TMPMNT/released2
mount --move //metro/released /TMPMNT/arcserver1
mount --move //metro/released /TMPMNT/arcserver2
mount --move //metro/released /TMPMNT/arcserver3
mount --move //metro/released /TMPMNT/arcserver4

After this you'll have separate directories for each mounted filesystem, which you can explore and unmount at your leasure.

1
  • 1
    Thanks. The problem was the mount order. Thanks for the multiple suggestions too! I had to first umount /mnt and then /mnt/arcserver worked.
    – Thomas
    Jun 28, 2012 at 6:23
7

maybe with umount -f ?

-f Force unmount (in case of an unreachable NFS system). (Requires kernel 2.1.116 or later.)

Or maybe you can do it with umount -l

-l Lazy unmount. Detach the filesystem from the filesystem hierar- chy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)

from: http://linux.die.net/man/8/mount

but looking around I found something here.

$ umount.cifs /folder

UPDATE Check the manual of umount.cifs... maybe it could give you an extra hand:

http://www.samba.org/samba/docs/man/manpages-3/umount.cifs.8.html

umount.cifs unmounts a Linux CIFS filesystem. It can be invoked indirectly by the umount(8) command when umount.cifs is in /sbin directory, unless you specify the "-i" option to umount. Specifying -i to umount avoids execution of umount helpers such as umount.cifs. The umount.cifs command only works in Linux, and the kernel must support the cifs filesystem. The CIFS protocol is the successor to the SMB protocol and is supported by most Windows servers and many other commercial servers and Network Attached Storage appliances as well as by the popular Open Source server Samba.

4
  • Tried all three suggestions. They all give the same repetitive messages. That last one only gives the message only once.
    – Thomas
    Jun 27, 2012 at 18:37
  • @Tomas I found something about the umount.cifs take a look at it.
    – maniat1k
    Jun 27, 2012 at 18:59
  • umount -i did the trick. All other suggestions here did not work for me. RHEL 4 Jun 30, 2015 at 6:26
  • umount -l saved my day
    – рüффп
    Aug 24, 2016 at 6:35
2

Instead of the mount point, try unmounting the device

 umount //metro/released 
1

try umount.

umount /mnt/systemfolder
5
  • Tried it and it didn't help. I get the message This utility only unmounts cifs filesystems. I did mount the locations using cifs. Unsure why this message then.
    – Thomas
    Jun 27, 2012 at 15:23
  • Can you elaborate on that? According to the manpage, umount will call /sbin/umount.<suffix> {dir|device} [-nlfvr] [-t type.subtype]. So it should call umount.cifs which should do the trick for you. Did you try mounting something else there? Maybe you should try calling umount.cifs directly? Or looking up its manpage directly (man umount.cifs)?
    – Wojtek
    Jun 27, 2012 at 15:29
  • I've added some additional information to the question to make it clearer.
    – Thomas
    Jun 27, 2012 at 15:37
  • That shouldn't be the case, looks like you're picking up an unusual umount. Can you try running /bin/umount explicitly?
    – Useless
    Jun 27, 2012 at 15:46
  • Just tried that, same results.
    – Thomas
    Jun 27, 2012 at 15:53
1

For fstab record (ubuntu 14.04):

10.10.70.18:/nfs01      /backup                 nfs     rw,hard,intr    0 0

I was able to unmount this dead share using:

umount -l -i '10.10.70.18:/nfs01'
0

I had a similar problem, but the solutions here didn't work for me. I had this output from mount:

//10.0.0.173/e$ on /mnt/mount_tmp type cifs (rw,mand)

I tried the mount --move and the umount -a -t cifs alternatives, didn't work. I tried unmounting both //10.0.0.173/e$ and /mnt/mount_tmp, nothing worked for me. I also tried the -f and -l proposed, to no success. Then I found this solution:

https://serverfault.com/questions/310015/cannot-unmount-cifs-mount

It tells you to use -i. It didn't work when I tried in the mounted folder:

$ umount -f -i /tmp/mount_tmp
umount2: Invalid argument
umount: /tmp/mount_tmp: not mounted

but it finally worked, when using in the "device":

$ umount -i '//10.0.0.173/e$'
umount: //10.0.0.173/e$: not found

Even though it reported an error, a subsequent run of "mount" shows that it's no longer mounted.

0

I just had this exact same problem, but couldn't get any of the above to work. Every time I remounted the directory, it tried to connect to the missing server (as well as the existing one).

I had to FIRST umount the directory, THEN the broken device:

$ sudo umount /backup
$ sudo umount -l -i '//anonymized.to/protect/the/stupid'
$ sudo mount /backup
-1

Running

$ umount -i 

fixed the problem for me.

1
  • 1
    Hi Mike and welcome to U&L. Could you add a little bit more details to your answer?
    – slm
    Nov 20, 2013 at 2:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .