cd/dvd mount problem - where to start?
A couple of years ago I wrote a small utility (in C) to read CDs and DVDs, and index their contents. It just mounts the disk, reads the filenames, and ejects the disk.
With a recent update of the OS, I increasingly experience problems. The program irregularly couldn't mount the disk, or ejected it too soon. According to what I read in several threads, the problem is probably
with udev, which seems to automount (and then unmount) the drive.
The problem also exists if just running 'mount /mnt/dvd' if the disk has just been inserted. If I wait a considerable time, the mount command does work. I suspect one of the problems is that udev only assigns device names after the disk has been detected?
Finally the Question:
What is the correct way to mount/unmount a (removable) disk by software?
- Do I have to retry till mount works correctly?
- Do I need to talk to udev/hal directly?
- any other solution/pointer/suggestion?
I'm running Slackware64 13.1, kernel is updated to 188.8.131.52.
To eject a non-data disk, simply use the eject command from the command line.
To eject a data disk, you must first unmount the device or the mount point (umount /dev/hdc or umount /mnt/cdrom for example) before you can eject the disk.
There are strange things though: With a data disk in the drive:
- I (previously) set fstab to noauto, so it should not mount automatically.
- Still, udev does something with the drive this makes a too-fast mount command fail with 'no media'
till after about 30 seconds, when it mounts correctly.
- If I remove the mount point (/mnt/dvd), mount complains with 'No mount point' - it doesn't generate
a mount point automatically.
- Even though /media has /dvd, /dvd0, /dvd1 the dvd is not mounted under any of those either, and those
points are not generated dynamically either.
This describes the same problem:
|All times are GMT -5. The time now is 11:23 AM.|