Re: magicdev question



Well,

This was true in the past, but not anymore, since kernel 2.4.11, so why
not take advantage of this.

You can try this now to see what happens:

echo 0 >  /proc/sys/dev/cdrom/lock    
# this will prevent locking the cd door while mounted
mount /mnt/cdrom ; cd /mnt/cdrom ; vi some_file_on_cd 
#this will make the cd busy and unable to unmount normaly
NOW press the eject button on the cd.
The cd is ejected BUT the filesystem is still mounted which is bad.
The solution is to "umount -l /dev/cdrom" which should work if you have
a kernel >= 2.4.11, and I bet you have it.
After this everything is OK except the vi process which does not know
that there is no more a CD in drive. If instead of vi, you use nautilus
to browse the cd, when unmounted, nautilus gets informed by IPC that
there is no more a cd mounted and changes automaticaly the view.

Actualy I make a patch for magicdev 1.1.4 which does this thing and is
preaty neat. It is just a quick/dirty hack as a proof of concept, but it
works like expected on my fedora core 1. If somebody wants to see how it
realy works, just ask me for it.


On Wed, 2004-01-07 at 09:19, Simon Wong wrote:
> On Mon, 2004-01-05 at 19:00, Paul Ionescu wrote:
> > Now, how do I make magicdev to do an action if it detects that a CD is
> > removed ?
> > For instance, I insert a data CD, and magicdev mounts it automaticaly
> > under /mnt/cdrom. 
> > If I eject the CD via the eject button on the CDROM (not the eject
> > command), I want magicdev to unmount the cd, but it does not.
> > So, the CD is gone, but it is still mounted.
> 
> Interesting!  On my laptops, Linux always locks out the button when a CD
> is mounted so that I cannot eject it manually (without using a
> paperclip).
Yes, this is the default. 
Use echo 0 >  /proc/sys/dev/cdrom/lock  to prevent it.
or if you have /etc/sysctl.conf add a line
dev.cdrom.lock = 0 
or just for one time: sysctl -w dev.cdrom.lock = 0 
and try mounting after that
> 
> My experience is that you can get the system really screwed up by
> ejecting things before unmounting them.  The system can hang for quite
> long periods trying to access the device.
> 
Yes, but if some programm unmount it after ejecting, like described
before, none  of this happens. 
> My advice is to right-click on the CD icon on your desktop and choose
> "eject" right at the bottom.  This will unmount and eject the CD.
> 
> Don't use the CD drive button EVER!!
> 
> This is more of a Linux OS issue than magicdev.
> 
> HTH
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]