umount: target is busy

umount: target is busy



I have mounted /dev and immediately tried to unmount:


/dev


$ sudo mount -o rbind /dev m
$ sudo umount m
umount: /tmp/m: target is busy.
$ sudo lsof m
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
kdevtmpfs 55 root cwd DIR 0,6 4420 2 m
kdevtmpfs 55 root rtd DIR 0,6 4420 2 m



I have read that fuser can kill processes accessing the mount point, but I would like to understand what is happening in this simple case. Acording to the lsof output does something use the mountpoint as current working directory (cwd)?


fuser


lsof



I do not want to use lazy unmount.




1 Answer
1



You used rbind to mount a filesystem and submounts. In order to unmount a filesystem, you must unmount its submounts first (and the same for their submounts, recursively). But take care!


rbind


mount --make-rslave m
umount -R m



Without the first command, you risk unmounting all the sub-mounts on the source, due to mount propagation. In this case that means all the sub-mounts of /dev, which would have bad effects on your running system ;-).


/dev



Basically mount propagation is a massive pit-trap waiting for you to fall into it :-). It seems like it would have been better if bind mounts disabled it by default.



kdevtmpfs is the kernel thread that maintains devtmpfs. It does not prevent unmounting devtmpfs. This is because the kernel thread runs on a separate mount (like a bind mount). You can't see that original mount; it is in a separate mount namespace. If you want to try and work out why kdevtmpfs shows up in lsof, I don't know, maybe consider that a separate question.


kdevtmpfs


kdevtmpfs


lsof






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.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ

How do I collapse sections of code in Visual Studio Code for Windows?