Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am currently running CentOS 5 on a server that has a built-in CDROM drive. I currently have a setup where /media/cdrom is automatically mounted by autofs as needed and I am exporting /media/cdrom via NFS. I need to be able to unmount this cdrom, eject it, and put in a new one without breaking anything, but this doesn't seem to work. Is there a better way to do this (noting that I have very little control over the server that is attempting to mount /media/cdrom via NFS)?

share|improve this question
    
What is "breaking anything"? What are you actually doing? Why do you not use ISO-images instead? –  Nils Mar 21 '12 at 21:29

1 Answer 1

The problem is that when you want to export a directory via NFS, the Linux NFS server "hangs on" to the exported directory as if it were a process running with an open file descriptor in that directory, preventing the mountpoint from being unmounted (well, technically, the kernel is doing this in the nfs kernel module). You'd have to shut down the NFS server, unmount the CD (or tell autofs to unmount it), insert the new CD, then restart the NFS server. Hopefully, you can do this in the time before the NFS client times out.

It would be considerably easier to just mount ISO images, as Nils suggested.

share|improve this answer
    
Unfortunately, ISO images aren't physical CDs -- and the goal here is that the end user can insert a physical CD into the machine and have it appear on a different machine (I didn't write most of the code involved on the other machine, and there's a third machine that expects "ssh machine2 mount /media/cdrom" to do exactly what it needs -- I cannot change anything about that third machine). The only machine that has a physical CD drive in this system is the first machine. –  Jonathan Callen Mar 22 '12 at 2:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.