ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
1.On my machine with kernel (2.6.16.40) I am using a CD drive.
The problem is that :
When I eject the CD I am currently using (it does not get unmounted when I see it using 'mount' command) and insert some other CD and start using it, still I can see and use the data on the previous CD.
I used the kernel variable "dev.cdrom.lock = 0" to be able to eject the CD when I press the eject button on an external CD drive. By default "dev.cdrom.lock = 1" because of which I was not able to eject CD.
So, does anybody know the reason why I am seeing the data from old CD?
I do not want to run 'automount' on my system.
2. How do I know in my application that a particular CD drive is being used for last how many minutes?
Regards,
Girish
Last edited by girish_hilage; 09-15-2008 at 08:41 AM.
If you don't unmount it, how does the computer know that the disk isn't still there? You're forcing it to eject without unmounting, and that's a bad thing, since it's the umount command that tells the system the device is no longer present. You really need to always run it before removing a device, especially removable usb drives and such, but also optical disks.
One option might be to use ivman. You should be able to set it to automatically run umount when hal reports that the cd is no longer present. I don't really know if it's a good idea to run umount after the mounted device disappears though. See this article for more details.
Last edited by David the H.; 09-15-2008 at 03:46 AM.
Thanks for the reply.
Can I use udev rule to unmount the CD drive once 'eject' button is pressed?
If you have an application that's using the drive, it'll remain locked until it's unmounted. It's a bad idea to mess with the udev rules for something like this, they exist for a reason.
You say you can access the files, but what you can probably do is see the directory listing. If you try to open or run one of those files, it'll give you an error message.
The best thing you can do is to unmount the drive, before ejecting the CD. If you try to unmount it, and it gives a message about the device being busy, you're either still in that directory, or a program you have is still accessing that drive. Change directories, or stop the program.
1. In case 'hald' is running it shows following events :
add (when I plugin the CD ROM)
remove (when I plugout the CD ROM)
umount (when I eject the CD ROM)
mount (when I insert the CD ROM)
2. In case 'hald' is stopped I can only see add,remove events but not the umount,mount events.
So, I have following queries :
1. why I can not see umount and mount in the 2nd case
2. how 'hald' and 'udev' communicate
3. if I use 'hald' then is 'automount' not required
4. how 'automount' and 'udev' communicate
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.