How to release /dev entry of unplugged storage device while a program has a file open
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I plug a USB device, it gets a /dev entry, e.g. sdf, i mount its filesystem, then some program opens a file on this filesystem. I unplug this device, its /dev entry disappears, but if i replug this device again, it gets another name - sdg.
How can i force the program to close the file so the filesystem is ready to be unmounted without using "lazy unmount" to release the device name, BUT so that the program doesn't crash after trying to make I/O to this file, and, of course, without having to kill the program?
How can i force the program to close the file so the filesystem is ready to be unmounted without using "lazy unmount" to release the device name, BUT so that the program doesn't crash after trying to make I/O to this file, and, of course, without having to kill the program?
If the filesystem a file resides on is no longer available then it would be not be a design flaw or application error but rather a human misunderstanding of concepts to assert it is still valid to write to it.
I didn't mean any of this. There exist some programs which is wouldn't like to stop running, but i need them to release any file pointers which make OS give newly inserted devices not next unused name, but some greater one (e.g. sdg instead of sdf), leaving sdf inexistant in /dev at all. So, the question is how to do this.
There exist some programs which is wouldn't like to stop running, but i need them to release any file pointers
As far as I know there are only two possibilities: a) kill the application or b) do not unplug and change the device. As far as releasing file pointers there is no middle way I know of.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.