LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   The proverbial umount problem (https://www.linuxquestions.org/questions/linux-general-1/the-proverbial-umount-problem-204353/)

2Sleepy2 07-12-2004 11:54 PM

The proverbial umount problem
 
Greetings all:

This is the often-reported problem with un-mounting a device - in this particular instance, my camera. I've also had this problem with CD-ROMs. Currently FedoraCore2, but has been the same issue with earlier RedHat distros (and, from the sounds of it from others here, other distributions, too.)
You mount the device (or it auto-mounts,) you pull files from it (or, sometimes, just browse it,) and then when you try to umount it the system reports that the device is busy and won't release it.
As has often been mentioned here (and in the man pages, and in books) you can find the user (or app, or...) that is still hanging on to the mount and kill it, or use switches with the umount command and force it to unmount (always followed by the proverbial "this is not wise and/or advised..." warning.) But, there MUST be a better way.
If this is a buffer issue is there no command that will flush the buffers? I've also read that if the swap is involved that will also cause this problem (in my case I have a gig of memory so often I'm not even touching the paging file.) It seems to me that there should be a way to manually let go of one of these devices - CLEANLY - so they can be properly released. There are times when I just wait several minutes and the device will be allowed to unmount. It sure seems like there should be an easy way to do this on demand. When you're shutting down the system it flushes everything and properly closes these mounts - there must be a way to properly release these filesystems without resorting to an improper "kill" or "lazy umount."
Any ideas?

vectordrake 07-13-2004 12:09 AM

Are you leaving the directory before trying to unmount?

2Sleepy2 07-13-2004 12:39 AM

Quote:

Originally posted by vectordrake
Are you leaving the directory before trying to unmount?
Yep. Left the directory. Even stopped all filesystem browsing. Went off and did other things (email, web surf, etc.) Went back and accessed the pictures I pulled from the camera (in hopes that accessing the pics would flush any buffers that might have file remnants remaining) but to no avail.
I have had it work fine sometimes: connect the camera (it auto-mounts,) pull the pics off, and umount the camera clean. Same thing with CDs. But, sometimes it doesn't want to behave. Nothing repeatable - it's a dice roll whether it will behave or not. I've turned off auto-mounting on the CD-ROM drive in case that may have been part of the issue, but that doesn't seem to be it.
I know I can always force a umount, but I'd like to find a cleaner way to release a filesystem. I know the OS can do it (it obviously does it on shutdown,) I just don't know the proper command.

J.W. 07-13-2004 12:48 AM

2sleepy2 -- as vectordrake suggested, you need to make sure that all persons/processes are not actively connected to the mountpoint. This often is trickier than it seems -- all you need is for one browser window or a terminal session to be accessing the directory, and you will not be able to unmount it. It's entirely possible that your active session is doing Email or whatever, but that there's a stray window open (or process) that is displaying the contents of /mnt/cdrom (as an example) The situation you describe is fairly common I think, and usually boils down to a background process being the culprit. You might want to run a "ps -ax" to see what's running if you encounter this situation again. That command display all the active processes. -- J.W.

adz 07-13-2004 03:34 AM

The fuser command comes in handy at times like these.

make 07-13-2004 04:14 AM

Try umount -l folder.

Should work and no more "busy"-errors.

Frank_Drebin 07-13-2004 08:44 AM

In Fedora, Kudzu tends to be a problem after you finish with a device. On my FC2 install I removed the word "kudzu" from both CD ROMS and my camera in the fstab. I also changed the ownership to "users" rather than the default "owner" in the fstab. I have not had the problem since.


Code:

/dev/cdrom      /mnt/cdrom      iso9660    noauto,users,ro  0  0
/dev/dvd        /mnt/dvd        iso9660    noauto,users,ro  0  0


JZL240I-U 07-13-2004 09:54 AM

Re: The proverbial umount problem
 
Quote:

Originally posted by 2Sleepy2
... If this is a buffer issue is there no command that will flush the buffers...
Code:

sync
man sync

... but I somehow doubt it's buffers ... I'd suggest you take J.W.'s advice, though I don't know fuser ... :)

2Sleepy2 07-13-2004 05:35 PM

Hey, thanks to all who replied. I really appreciate the help.

I'm gonna check out the fuser command (thanks for the idea, adz) but from a quick check it looks to be another PID identifier. But, it's something to investigate (More Input! More Input! ;-)

Thanks also to J.W. and JZL24OI-U. I know I can kill the dang thing, but it just seems so,... well, just so unclean. Like make suggested, I've typically been using the lazy umount, but I think that leaves things hanging.

I'm really interested in Frank_Drebin's take on the issue - this could easily be an ownership issue. I'll be checking it out late tonight (I have to support the Evil Empire during the daylight hours and later I'm checking out Spidey2 so I won't get back to my hardware 'til late.)


All times are GMT -5. The time now is 08:21 AM.