umount - device is busy
Sometimes when I want to umount a device, e.g.
sudo umount /dev/loop0
I will get the message
umount: /mnt: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
I usually solve this issue by closing a console window (in my case xfce4-terminal) and then umount
.
What does this problem mean? Is there some smarter solution?
mount
add a comment |
Sometimes when I want to umount a device, e.g.
sudo umount /dev/loop0
I will get the message
umount: /mnt: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
I usually solve this issue by closing a console window (in my case xfce4-terminal) and then umount
.
What does this problem mean? Is there some smarter solution?
mount
2
That happens for example if you are still in a shell in that directory to where the device is mounted.
– klapaucius
Sep 1 '11 at 15:15
I don't remember if I was there but I tried it and you're right, this happened.
– xralf
Sep 2 '11 at 13:31
add a comment |
Sometimes when I want to umount a device, e.g.
sudo umount /dev/loop0
I will get the message
umount: /mnt: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
I usually solve this issue by closing a console window (in my case xfce4-terminal) and then umount
.
What does this problem mean? Is there some smarter solution?
mount
Sometimes when I want to umount a device, e.g.
sudo umount /dev/loop0
I will get the message
umount: /mnt: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
I usually solve this issue by closing a console window (in my case xfce4-terminal) and then umount
.
What does this problem mean? Is there some smarter solution?
mount
mount
edited Jan 14 '17 at 14:11
Jeff Schaller
43.8k1161141
43.8k1161141
asked Sep 1 '11 at 14:20
xralfxralf
2,3031972119
2,3031972119
2
That happens for example if you are still in a shell in that directory to where the device is mounted.
– klapaucius
Sep 1 '11 at 15:15
I don't remember if I was there but I tried it and you're right, this happened.
– xralf
Sep 2 '11 at 13:31
add a comment |
2
That happens for example if you are still in a shell in that directory to where the device is mounted.
– klapaucius
Sep 1 '11 at 15:15
I don't remember if I was there but I tried it and you're right, this happened.
– xralf
Sep 2 '11 at 13:31
2
2
That happens for example if you are still in a shell in that directory to where the device is mounted.
– klapaucius
Sep 1 '11 at 15:15
That happens for example if you are still in a shell in that directory to where the device is mounted.
– klapaucius
Sep 1 '11 at 15:15
I don't remember if I was there but I tried it and you're right, this happened.
– xralf
Sep 2 '11 at 13:31
I don't remember if I was there but I tried it and you're right, this happened.
– xralf
Sep 2 '11 at 13:31
add a comment |
6 Answers
6
active
oldest
votes
It means that some process has a working directory or an open file handle underneath the mount point. The best thing to do is to end the offending process, change its working directory or close the file handle before unmounting.
There is an alternative on Linux though. Using umount -l
calls a "lazy" unmount. The filesystem will still be mounted but you won't be able to see or use it, except for processes that are already using it. When the offending program exits (through whatever means) the system will "finish" unmounting the filesystem.
2
Is there a way to find out which process has the open file handle and should be terminated?
– xralf
Sep 1 '11 at 19:04
4
Usinglsof
is probably the best way.
– bahamat
Sep 1 '11 at 20:48
e.g.lsof | grep loop0
?
– xralf
Sep 2 '11 at 13:28
No, grep for the mount point. It should list any files underneath. I don't think it will show things that simply have a working directory under the mount point, so it isn't a perfect method.
– bahamat
Sep 2 '11 at 15:44
add a comment |
Given your "usual solution", it means that the shell you have running in your console window has a directory in a file system on that device as its current working directory.
Linux, and Unixes in general, want very badly to keep a file system mounted if a process has a current working directory in that filesystem.
You could just use cd
in the console window to get out of a directory in or under /mnt
rather than killing the console window, and the shell running inside it.
add a comment |
You can also use fuser
to kill all processes using the mounted file system.
fuser -cuk /mnt
Options:
-c
Same as -m option, used for POSIX compatibility.
-u, --user
Append the user name of the process owner to each PID.
-k, --kill
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.kill.
-m NAME, --mount NAME
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 a directory file is specified, it is
automatically changed to NAME/. to use any file system that might be mounted on that directory.
Check for yourself at explainshell.
add a comment |
I encountered the same problem today ,and I've succeed to solve it .
my problem is result from mounting a directory to my current working directory,so when I run "umount" ,it happened.
the way to solution it is change the current directory and then run "umount ..".
i hope it works.
add a comment |
I discovered a situation which can interfere with unmounting a device that I will share as an answer even though this question is very old.
If you have NFS shares being hosted on the machine, and any of those NFS shares are backed by the device you are trying to unmount, you will have to stop sharing them (best done by stopping the NFS service, e.g. sudo service nfs-kernel-server stop
on recent versions of Ubuntu). The NFS server may not show up in lsof or fuser, which can make the issue difficult to identify.
add a comment |
For me, the "device busy" error came up when I was inside that folder and I was trying to umount
it
// Based on @klapaucius comment
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
– G-Man
3 hours ago
It does, I edited the answer a bit. I indicated what can cause that problem, and what was solution in my case.
– adrianTNT
3 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f19918%2fumount-device-is-busy%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
It means that some process has a working directory or an open file handle underneath the mount point. The best thing to do is to end the offending process, change its working directory or close the file handle before unmounting.
There is an alternative on Linux though. Using umount -l
calls a "lazy" unmount. The filesystem will still be mounted but you won't be able to see or use it, except for processes that are already using it. When the offending program exits (through whatever means) the system will "finish" unmounting the filesystem.
2
Is there a way to find out which process has the open file handle and should be terminated?
– xralf
Sep 1 '11 at 19:04
4
Usinglsof
is probably the best way.
– bahamat
Sep 1 '11 at 20:48
e.g.lsof | grep loop0
?
– xralf
Sep 2 '11 at 13:28
No, grep for the mount point. It should list any files underneath. I don't think it will show things that simply have a working directory under the mount point, so it isn't a perfect method.
– bahamat
Sep 2 '11 at 15:44
add a comment |
It means that some process has a working directory or an open file handle underneath the mount point. The best thing to do is to end the offending process, change its working directory or close the file handle before unmounting.
There is an alternative on Linux though. Using umount -l
calls a "lazy" unmount. The filesystem will still be mounted but you won't be able to see or use it, except for processes that are already using it. When the offending program exits (through whatever means) the system will "finish" unmounting the filesystem.
2
Is there a way to find out which process has the open file handle and should be terminated?
– xralf
Sep 1 '11 at 19:04
4
Usinglsof
is probably the best way.
– bahamat
Sep 1 '11 at 20:48
e.g.lsof | grep loop0
?
– xralf
Sep 2 '11 at 13:28
No, grep for the mount point. It should list any files underneath. I don't think it will show things that simply have a working directory under the mount point, so it isn't a perfect method.
– bahamat
Sep 2 '11 at 15:44
add a comment |
It means that some process has a working directory or an open file handle underneath the mount point. The best thing to do is to end the offending process, change its working directory or close the file handle before unmounting.
There is an alternative on Linux though. Using umount -l
calls a "lazy" unmount. The filesystem will still be mounted but you won't be able to see or use it, except for processes that are already using it. When the offending program exits (through whatever means) the system will "finish" unmounting the filesystem.
It means that some process has a working directory or an open file handle underneath the mount point. The best thing to do is to end the offending process, change its working directory or close the file handle before unmounting.
There is an alternative on Linux though. Using umount -l
calls a "lazy" unmount. The filesystem will still be mounted but you won't be able to see or use it, except for processes that are already using it. When the offending program exits (through whatever means) the system will "finish" unmounting the filesystem.
answered Sep 1 '11 at 17:29
bahamatbahamat
24.8k15090
24.8k15090
2
Is there a way to find out which process has the open file handle and should be terminated?
– xralf
Sep 1 '11 at 19:04
4
Usinglsof
is probably the best way.
– bahamat
Sep 1 '11 at 20:48
e.g.lsof | grep loop0
?
– xralf
Sep 2 '11 at 13:28
No, grep for the mount point. It should list any files underneath. I don't think it will show things that simply have a working directory under the mount point, so it isn't a perfect method.
– bahamat
Sep 2 '11 at 15:44
add a comment |
2
Is there a way to find out which process has the open file handle and should be terminated?
– xralf
Sep 1 '11 at 19:04
4
Usinglsof
is probably the best way.
– bahamat
Sep 1 '11 at 20:48
e.g.lsof | grep loop0
?
– xralf
Sep 2 '11 at 13:28
No, grep for the mount point. It should list any files underneath. I don't think it will show things that simply have a working directory under the mount point, so it isn't a perfect method.
– bahamat
Sep 2 '11 at 15:44
2
2
Is there a way to find out which process has the open file handle and should be terminated?
– xralf
Sep 1 '11 at 19:04
Is there a way to find out which process has the open file handle and should be terminated?
– xralf
Sep 1 '11 at 19:04
4
4
Using
lsof
is probably the best way.– bahamat
Sep 1 '11 at 20:48
Using
lsof
is probably the best way.– bahamat
Sep 1 '11 at 20:48
e.g.
lsof | grep loop0
?– xralf
Sep 2 '11 at 13:28
e.g.
lsof | grep loop0
?– xralf
Sep 2 '11 at 13:28
No, grep for the mount point. It should list any files underneath. I don't think it will show things that simply have a working directory under the mount point, so it isn't a perfect method.
– bahamat
Sep 2 '11 at 15:44
No, grep for the mount point. It should list any files underneath. I don't think it will show things that simply have a working directory under the mount point, so it isn't a perfect method.
– bahamat
Sep 2 '11 at 15:44
add a comment |
Given your "usual solution", it means that the shell you have running in your console window has a directory in a file system on that device as its current working directory.
Linux, and Unixes in general, want very badly to keep a file system mounted if a process has a current working directory in that filesystem.
You could just use cd
in the console window to get out of a directory in or under /mnt
rather than killing the console window, and the shell running inside it.
add a comment |
Given your "usual solution", it means that the shell you have running in your console window has a directory in a file system on that device as its current working directory.
Linux, and Unixes in general, want very badly to keep a file system mounted if a process has a current working directory in that filesystem.
You could just use cd
in the console window to get out of a directory in or under /mnt
rather than killing the console window, and the shell running inside it.
add a comment |
Given your "usual solution", it means that the shell you have running in your console window has a directory in a file system on that device as its current working directory.
Linux, and Unixes in general, want very badly to keep a file system mounted if a process has a current working directory in that filesystem.
You could just use cd
in the console window to get out of a directory in or under /mnt
rather than killing the console window, and the shell running inside it.
Given your "usual solution", it means that the shell you have running in your console window has a directory in a file system on that device as its current working directory.
Linux, and Unixes in general, want very badly to keep a file system mounted if a process has a current working directory in that filesystem.
You could just use cd
in the console window to get out of a directory in or under /mnt
rather than killing the console window, and the shell running inside it.
answered Sep 1 '11 at 20:09
Bruce EdigerBruce Ediger
35.4k669120
35.4k669120
add a comment |
add a comment |
You can also use fuser
to kill all processes using the mounted file system.
fuser -cuk /mnt
Options:
-c
Same as -m option, used for POSIX compatibility.
-u, --user
Append the user name of the process owner to each PID.
-k, --kill
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.kill.
-m NAME, --mount NAME
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 a directory file is specified, it is
automatically changed to NAME/. to use any file system that might be mounted on that directory.
Check for yourself at explainshell.
add a comment |
You can also use fuser
to kill all processes using the mounted file system.
fuser -cuk /mnt
Options:
-c
Same as -m option, used for POSIX compatibility.
-u, --user
Append the user name of the process owner to each PID.
-k, --kill
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.kill.
-m NAME, --mount NAME
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 a directory file is specified, it is
automatically changed to NAME/. to use any file system that might be mounted on that directory.
Check for yourself at explainshell.
add a comment |
You can also use fuser
to kill all processes using the mounted file system.
fuser -cuk /mnt
Options:
-c
Same as -m option, used for POSIX compatibility.
-u, --user
Append the user name of the process owner to each PID.
-k, --kill
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.kill.
-m NAME, --mount NAME
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 a directory file is specified, it is
automatically changed to NAME/. to use any file system that might be mounted on that directory.
Check for yourself at explainshell.
You can also use fuser
to kill all processes using the mounted file system.
fuser -cuk /mnt
Options:
-c
Same as -m option, used for POSIX compatibility.
-u, --user
Append the user name of the process owner to each PID.
-k, --kill
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.kill.
-m NAME, --mount NAME
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 a directory file is specified, it is
automatically changed to NAME/. to use any file system that might be mounted on that directory.
Check for yourself at explainshell.
edited Sep 18 '18 at 16:20
Jason R Stevens CFA
135
135
answered Nov 23 '17 at 7:29
sys0dm1nsys0dm1n
1314
1314
add a comment |
add a comment |
I encountered the same problem today ,and I've succeed to solve it .
my problem is result from mounting a directory to my current working directory,so when I run "umount" ,it happened.
the way to solution it is change the current directory and then run "umount ..".
i hope it works.
add a comment |
I encountered the same problem today ,and I've succeed to solve it .
my problem is result from mounting a directory to my current working directory,so when I run "umount" ,it happened.
the way to solution it is change the current directory and then run "umount ..".
i hope it works.
add a comment |
I encountered the same problem today ,and I've succeed to solve it .
my problem is result from mounting a directory to my current working directory,so when I run "umount" ,it happened.
the way to solution it is change the current directory and then run "umount ..".
i hope it works.
I encountered the same problem today ,and I've succeed to solve it .
my problem is result from mounting a directory to my current working directory,so when I run "umount" ,it happened.
the way to solution it is change the current directory and then run "umount ..".
i hope it works.
answered Aug 29 '15 at 7:21
yunpeng liuyunpeng liu
1
1
add a comment |
add a comment |
I discovered a situation which can interfere with unmounting a device that I will share as an answer even though this question is very old.
If you have NFS shares being hosted on the machine, and any of those NFS shares are backed by the device you are trying to unmount, you will have to stop sharing them (best done by stopping the NFS service, e.g. sudo service nfs-kernel-server stop
on recent versions of Ubuntu). The NFS server may not show up in lsof or fuser, which can make the issue difficult to identify.
add a comment |
I discovered a situation which can interfere with unmounting a device that I will share as an answer even though this question is very old.
If you have NFS shares being hosted on the machine, and any of those NFS shares are backed by the device you are trying to unmount, you will have to stop sharing them (best done by stopping the NFS service, e.g. sudo service nfs-kernel-server stop
on recent versions of Ubuntu). The NFS server may not show up in lsof or fuser, which can make the issue difficult to identify.
add a comment |
I discovered a situation which can interfere with unmounting a device that I will share as an answer even though this question is very old.
If you have NFS shares being hosted on the machine, and any of those NFS shares are backed by the device you are trying to unmount, you will have to stop sharing them (best done by stopping the NFS service, e.g. sudo service nfs-kernel-server stop
on recent versions of Ubuntu). The NFS server may not show up in lsof or fuser, which can make the issue difficult to identify.
I discovered a situation which can interfere with unmounting a device that I will share as an answer even though this question is very old.
If you have NFS shares being hosted on the machine, and any of those NFS shares are backed by the device you are trying to unmount, you will have to stop sharing them (best done by stopping the NFS service, e.g. sudo service nfs-kernel-server stop
on recent versions of Ubuntu). The NFS server may not show up in lsof or fuser, which can make the issue difficult to identify.
answered Oct 29 '15 at 22:12
WugWug
148116
148116
add a comment |
add a comment |
For me, the "device busy" error came up when I was inside that folder and I was trying to umount
it
// Based on @klapaucius comment
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
– G-Man
3 hours ago
It does, I edited the answer a bit. I indicated what can cause that problem, and what was solution in my case.
– adrianTNT
3 hours ago
add a comment |
For me, the "device busy" error came up when I was inside that folder and I was trying to umount
it
// Based on @klapaucius comment
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
– G-Man
3 hours ago
It does, I edited the answer a bit. I indicated what can cause that problem, and what was solution in my case.
– adrianTNT
3 hours ago
add a comment |
For me, the "device busy" error came up when I was inside that folder and I was trying to umount
it
// Based on @klapaucius comment
For me, the "device busy" error came up when I was inside that folder and I was trying to umount
it
// Based on @klapaucius comment
edited 3 hours ago
answered 6 hours ago
adrianTNTadrianTNT
20328
20328
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
– G-Man
3 hours ago
It does, I edited the answer a bit. I indicated what can cause that problem, and what was solution in my case.
– adrianTNT
3 hours ago
add a comment |
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
– G-Man
3 hours ago
It does, I edited the answer a bit. I indicated what can cause that problem, and what was solution in my case.
– adrianTNT
3 hours ago
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
– G-Man
3 hours ago
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
– G-Man
3 hours ago
It does, I edited the answer a bit. I indicated what can cause that problem, and what was solution in my case.
– adrianTNT
3 hours ago
It does, I edited the answer a bit. I indicated what can cause that problem, and what was solution in my case.
– adrianTNT
3 hours ago
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f19918%2fumount-device-is-busy%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
That happens for example if you are still in a shell in that directory to where the device is mounted.
– klapaucius
Sep 1 '11 at 15:15
I don't remember if I was there but I tried it and you're right, this happened.
– xralf
Sep 2 '11 at 13:31