1

I don't know whether its normal or not but when I mount a filesystem(ext4 partition, USB, SD card etc) via command line, I can't unmount it because it says target is busy

It is the bash process which is using/accessing it. So I have to kill it first and then only can unmount the drive. As you have guessed, when I kill the bash process the terminal shuts down.and I have to reopen the terminal and unmount the drive. Is it normal ? I don't remember it happening the last time I unmounted something.

  • 1
    If you cd into the mountpoint, it will be openend by bash so of course it will be busy. cd $HOME and then try to unmount, or use sudo fuser /mount/point to figure out what else is using the process – Sergiy Kolodyazhnyy Feb 16 '19 at 17:24
  • I am using fuser to detect the PID and than look it up in TOP (let me know if there's is any short cut rather than running top to identify the process). Let me just try mount and unmount in quick succession without touching anything else. BRB – Just Khaithang Feb 16 '19 at 17:27
  • Well, not sure if it's shortcuts but I'd use ps -p 1234 -o args where 1234 is pid, or just examine /proc/1234/cmdline – Sergiy Kolodyazhnyy Feb 16 '19 at 17:31
  • thanks for the short cut and yap you are right, it most probably was me cding into the mounted drive and could recollect a thing what I was doing. whew that's was quick. – Just Khaithang Feb 16 '19 at 17:36
  • 1
    Alright, I'll make it a proper answer then – Sergiy Kolodyazhnyy Feb 16 '19 at 17:38

1 Answers1

1

If you cd into the mountpoint, it will be openend by bash so of course it will be busy. cd $HOME and then try to unmount. Otherwise use sudo fuser /mount/point to figure out what else is using the mountpoint or files within it.

source: doing exactly the same mistake and learning from it

jesse_b
  • 37,005