Friday, April 20, 2012

Auto mount CD/DVD drive using Devmon in Ubuntu

I have shared my CD/DVD drive in my Ubuntu machine for my diskless Mac. The problem is I have to login to Ubuntu every time I change the CD/DVD.

Until I found a nice tool called Devmon to do the job perfectly. It's a script that helps you refresh content of CD or DVD automatically.

In this tutorial I will share to you how to install Devmon in Ubuntu. You have to setup shared DVD in your Ubuntu machine first. Follow this tutorial if you haven't.

I use Ubuntu 11.04 Natty Narwhal, and Mac OSX 10.7.3.

Install Devmon

Go to your Ubuntu machine. Make a backup of sources.list file, just in case..

# sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

Add the following PPA to the sources.list file:

# sudo nano /etc/apt/sources.list

Add the following line at the end of the file:

deb unstable main

Now you have to be root to register PGP key for Devmon. Open terminal, type su then press enter, enter your password. Then register PGP key for the Devmon.

# gpg --keyserver --recv-keys 7977070A723C6CCB696C0B0227A5AC5A01937621

# sudo apt-get update

# sudo apt-get install devmon

Wait until installation is finished.

To run devmon just type it in Terminal. That's all you have to do.

Start Devmon on startup

Go to your Ubuntu machine. Click from menu System - Preferences - Startup Applications. Click Add button, enter Devmon in the Name field and devmon in the Command field. Click Add button.

To start devmon for all users in Ubuntu, move it to user's share startup folder.

sudo mv ~/.config/autostart/devmon.desktop /usr/share/gnome/autostart/

Testing from Mac

Now let's do the fun part. Insert CD audio and play on iTunes. Change it to DVD movie and play on DVD Player or VLC.

After you finished watch the movie and if you wanna see another movie, you have to close and eject from DVD Player before you change the disc otherwise DVD Player will not immediately respond to the new disc and give you "Media not supported" error.

If that happened, you have to remount the DVD drive from Finder.


IgonrantGuru's Blog, Script: Devmon

No comments: