views:

63

answers:

1

In Linux (CentOS 5.4), how do you force a process to stop locking a file system without killing the process?

I am trying to get my Java Webstart Application, running locally, to eject a CD. I do not have this problem if I am just browsing through the files using a JFileChooser, but once I read the contents of a file, I can no longer eject the CD...even after removing ALL references to any files.

Hitting the eject button will give the error (Title - "Cannot Eject Volume"): "An application is preventing the volume 'volume name' from being ejected"

Thus, my goal is to tell the process to stop targeting the CD-ROM in order to free it up.

Thank you for any help or direction!!

Attempted Fix: -running the commands:

sudo umount -l /media/Volume_Name      //-l Lazy Unmount forces the unmount
sudo eject

Problem: When a new CD is inserted, it is no longer mounted automatically probably because the process is still "targeting" it.

+1  A: 

Assuming that lsof lists your java application as the only application accessing the file, you might try forcing a garbage collection (using jvisualvm or a similar tool) to see if that frees it up.

Kaleb Pederson
lsof was a very useful tool. It helped me realize the problem that an underlying library was holding onto file streams. Fixed and working now. Thanks!
Blake
`lsof` is very useful, you can even use it for tracking network connections. Glad it helped.
Kaleb Pederson