# Is there a way to automount cdrom with autofs/Automounter?

## heavyt

I have been trying to set up my TiBook so it will automount a cd when it is inserted in the drive.

I have emerge autofs and configure the following files:

```

/etc/autofs/auto.master

# $Id: auto.master,v 1.1 2000/08/08 17:53:33 achim Exp $

# Sample auto.master file

# Format of this file:

# mountpoint map options

# For details of the format look at autofs ( 8 ).

/mnt   /etc/autofs/auto.misc

#/home  /etc/autofs/auto.home

/etc/autofs/auto.misc

 

# $Id: auto.misc,v 1.2 2002/10/27 05:21:15 bcowan Exp $

# This is an automounter map and it has the following format

# key [ -mount-options-separated-by-comma ] location

# Details may be found in the autofs(5) manpage

#boot      -fstype=ext2      :/dev/hda1

cd      -fstype=iso9660,ro   :/dev/cdroms/cdrom0

#floppy      -fstype=auto      :/dev/fd0

 
```

I then comment out the line /dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro from /etc/fstab. And last I have CONFIG_AUTOFS4_FS=y in my kernel. But the cd will not automount  :Confused: 

Here are some more info that may help you help me   :Sad: 

```

 root # /etc/init.d/autofs stats

Configured Mount Points:

------------------------

/usr/sbin/automount --timeout 60 /mnt file /etc/autofs/auto.misc

 

Active Mount Points:

--------------------

 root # /etc/init.d/autofs reload

Reloading automounter: checking for changes ...

Stopping automounter: /misc pts/0    S      0:00 /usr/sbin/automount --timeout 60 /misc file /etc/autofs/auto.misc

/sbin/runscript.sh: line 196: kill: (1585) - No such process

 * WARNING:  "autofs" has already been started.

root # /etc/init.d/autofs start

 * WARNING:  "autofs" has already been started.

root # /etc/init.d/autofs stop

 * Stopping automounter...                                                [ !! ]

root # /etc/init.d/autofs start

 * WARNING:  "autofs" has already been started.

root # /etc/init.d/autofs restart

 * Stopping automounter...                                                [ !! ]

 * WARNING:  "autofs" has already been started.

```

Thanks for any help.

----------

## Z?

Throw a CD in the drive, open a terminal (or Konqueror/Nautilus -- whatever you prefer), and 

```
cd /mnt/cd
```

The way autofs works is that once you change to the managed directory ('cd', in this case), autofs will attempt to mount the specified device in the folder before allowing access to it.

What you're probably looking for is supermount, but I've never managed to get that sucker to work.

----------

## grant.mcdorman

Works for me. However, you probably don't want to point it at /mnt; autofs takes over the entire directory (any existing entries in the directory disappear); i.e.: 

```
mcd1600 root # /etc/init.d/autofs status

 * status:  stopped

mcd1600 root # ls /misc

mcd1600 root # mkdir /misc/dummy

mcd1600 root # ls /misc

dummy

mcd1600 root # /etc/init.d/autofs start

 * Starting automounter...  [ ok ]

mcd1600 root # /etc/init.d/autofs stats

Configured Mount Points:

------------------------

/usr/sbin/automount /misc file /etc/autofs/auto.misc

Active Mount Points:

--------------------

mcd1600 root # ls /misc

mcd1600 root # ls /misc/cd

AUTORUN.EXE  DirectX  GameSpy    MUSIC.TGW  Resources  Setup.exe  autorun.inf     data1.cab  data2.cab    kohan.ico   setup.inx

Acrobat      Extras   Kohan.exe  Manual     Setup.bmp  Setup.ini  cinematics.tgw  data1.hdr  ikernel.ex_  layout.bin

mcd1600 root # /etc/init.d/autofs stats

Configured Mount Points:

------------------------

/usr/sbin/automount /misc file /etc/autofs/auto.misc

Active Mount Points:

--------------------

mcd1600 root # ls /misc

cd

```

Note that the directory dummy has gone away. Also note that autofs stats doesn't list /misc/cd, even though it is mounted. 

I use /misc. My auto.master is: 

```
cat /etc/autofs/auto.master

# $Id: auto.master,v 1.1 2000/08/08 17:53:33 achim Exp $

# Sample auto.master file

# Format of this file:

# mountpoint map options

# For details of the format look at autofs(8).

/misc   /etc/autofs/auto.misc

#/home  /etc/autofs/auto.home
```

and my auto.misc is:

```
cat /etc/autofs/auto.misc

# $Id: auto.misc,v 1.2 2002/10/27 05:21:15 bcowan Exp $

# This is an automounter map and it has the following format

# key [ -mount-options-separated-by-comma ] location

# Details may be found in the autofs(5) manpage

#boot           -fstype=ext2            :/dev/hda1

#cd             -fstype=iso9660,ro      :/dev/cdrom

#floppy         -fstype=auto            :/dev/fd0

floppy  -fstype=vfat,uid=nobody,gid=users,umask=0,sync          :/dev/fd0

cd      -fstype=iso9660,ro      :/dev/cdrom

```

/dev/cdrom, by the way, is a link to /dev/cdroms/cdrom0; it's created by devfs.

----------

## heavyt

grant.mcdorman,

I tried your setting (/etc/autofs/auto.master.  /etc/autofs/auto.misc) and it worked if I do ls /misc/cd to mount the cd. But if I reboot or shutdown then start Gentoo the cd will not mount unless I repeat ls /mnt/cd. Is this what you do or does the cd mount automatically? 

Thanks for the help (Toronto is a nice city)  :Cool: 

----------

## grant.mcdorman

 *heavyt wrote:*   

> grant.mcdorman,
> 
> I tried your setting (/etc/autofs/auto.master.  /etc/autofs/auto.misc) and it worked if I do ls /misc/cd to mount the cd. But if I reboot or shutdown then start Gentoo the cd will not mount unless I repeat ls /mnt/cd. Is this what you do or does the cd mount automatically?

 

The CD mounts when it is referenced, and unmounts after a timeout (the default is 5 minutes). This is required - if it doesn't unmount, you can't eject it (and, for writable devices like a floppy, the cache may not be flushed). Unfortunately, as a side effect nothing shows up in the misc directory until you reference the device.

 *heavyt wrote:*   

> Thanks for the help (Toronto is a nice city) 

 Thank you.

----------

## heavyt

I Understand. It would be nice for it to automount as on the Mac OS  :Sad: 

----------

## grant.mcdorman

 *heavyt wrote:*   

> I Understand. It would be nice for it to automount as on the Mac OS 

 While I don't know what OSX does, I suspect it's closer to supermount. You can try that out, although I found it buggy last year when I tried it under Mandrake 8.

----------

## Robostyle

You can have a sort of automount feature with autofs by making a symbolic link. For example:

```

# cd /mnt

# ln -s /misc/floppy floppy

```

if you now do a "dir /mnt/floppy" it gets mounted in an instance. It even works in nautilus for example. A downside is that if you do a " dir /mnt" it also gets mounted. Not sure why yet.

Take a look at http://freespace.sourceforge.net/guidod/howto/autofs.html from where I got the idea. Maybe I skipped a piece, dunno but I'm tired to figure it out now coz it's to late.

----------

## theonlymcc

Why can't it just use the /mnt directory. I tried editing the autofs files to use /mnt instead of /misc and it won't work. But it does work with /misc and using the symlinks in /mnt to point to /misc.

----------

## grant.mcdorman

 *theonlymcc wrote:*   

> Why can't it just use the /mnt directory. I tried editing the autofs files to use /mnt instead of /misc and it won't work. But it does work with /misc and using the symlinks in /mnt to point to /misc.

 It should work if auto.master and auto.mnt are set up correctly. However, since autofs basically takes over the entire directory it's mounting in, this would mean that everything in /mnt would have to be autofs mounts. This may not be a good idea; for example, I have a Windows partition. With autofs pointed at /mnt, you can't mount the Windows partition under /mnt (except through autofs, which is rather silly for a hard drive partition).

----------

## serial.

Hi, I've been wanting this feature too. The programs you want are magicdev or autorun. Magicdev is supposedly for Gnome, and there exists an ebuild for it. autorun is supposedly for KDE, and I don't think there's an ebuild (you can get it at sf.net/projects/autorun)  Both were developed by redhat AFAIK.

I haven't tried either yet, I don't know how compatible each would be with the other's DE or with gentoo... good luck.

update: definitely stick with magicdev... the autorun script seems pretty sketchy and not updated much. magicdev works fine with KDE as just a plain old automounter (who wants to autorun things anyway?). To change the settings you can start up the gnome control center or call it directly (I forget the command).  the one quirk is that it must be started within X, I tried making an rc script for it but it dies if it can't connect to an X server. just put it in your ~/.xsession and you'll be golden.

----------

## leszcz

Hi,

I use cdde :

http://ericlathrop.com/cdde/

Flexible and userland app.

Regards.

----------

## tuxlover

I use supermount without any problems. once compiled into the kernel (gentoo kernels come with the patch already, you just need to turn it on), it's a lot easier to configure than autofs (basically you just need one change in /etc/fstab - no config files and non-existing directories, nothing).

read what you have to do in this post.

----------

