View Full Version : Automounting and music cds

12-15-2003, 11:34 AM
Hello all,
I think automounting is more practical than doing "mount /cdrom" all the time. I know Linux has "autofs" service which can do that. I enabled it using "ksysv". However, automounting of cds and dvds are not working. I have just tried, I was able to mount a CD-R and a DVD-RW disk in my Inspiron 8600's combo DVD+RW/CD+RW drive.

Moreover, I cannot play nor mount a music cd.

Trying to explore how automounting is configured in my Debian 2.4.23-xfs-acpi, I found out that /etc/auto.master is like this:
# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).
# /var/autofs/misc /etc/auto.misc
# /var/autofs/net /etc/auto.net
# KNOPPIX automounts for floppy and cdrom(s), see knoppix-autoconfig
# /mnt/auto /etc/auto.mnt --timeout=2
/mnt/auto /etc/automount.sh --timeout=2
The file /etc/automount.sh mentioned in the line above is like this:
# Generate an automounter entry automatically
# for automount /mnt/auto program this_script
# (C) Klaus Knopper 2002
# WARNING: This script is used for removable media in KNOPPIX,
# therefore the mount is always read-write (except for cdroms
# and ntfs).

[ -n "$1" ] || return 1

# Check if partition is already mounted
while read device mountpoint filesystem relax; do
case "$device" in *$1*) echo "$filesystem"; return 0;; esac
done <<EOT
$(cat /proc/mounts)

# Check if a device/medium is present at all
dd if="$1" count=1 bs=1024 >/dev/null 2>&1 || return 2
[ "$?" = "0" ] || return 2

# File systems to try first
case "$FILE" in
*[Ff][Aa][Tt]*|*[Xx]86*) FILESYSTEMS="vfat msdos ntfs";;
*[Rr][Ee][Ii][Ss][Ee][Rr]*) echo "reiserfs"; return 0;;
*[Xx][Ff][Ss]*) echo "xfs"; return 0;;
*[Ee][Xx][Tt]3*) echo "ext3"; return 0;;
*[Ee][Xx][Tt]2*) echo "ext2"; return 0;;
*[Ss][Ww][Aa][Pp]*) echo "swap"; return 0;;
# It seems that only reliable way to identify the filesystem is to attempt a mount
mkdir -p "$TMPDIR" || return 3
# Don't clobber console while attemting a mount
read LOGLEVEL relax < /proc/sys/kernel/printk
echo "0" >/proc/sys/kernel/printk
for f in $FILESYSTEMS $(</etc/filesystems); do
mount -r -t "$f" "$1" "$TMPDIR" >/dev/null 2>&1 && { umount "$TMPDIR"; FS="$f"; break; }
umount -f "$TMPDIR" >/dev/null 2>&1
echo "$LOGLEVEL" >/proc/sys/kernel/printk
rmdir "$TMPDIR"
[ -n "$FS" ] && echo "$FS" || return 4

# Defaults
case "$1" in
floppy) [ -s /etc/sysconfig/floppy ] || exit 1; device="/dev/fd0";;
cdrom*) rw="ro";;
dvd*) rw="ro";;

fs="$(fstype "$device")"

[ "$?" = "0" ] || exit 1

case "$fs" in
*fat|msdos) options="${rw},uid=knoppix,gid=knoppix,umask=000";;
ntfs) options="ro,uid=knoppix,gid=knoppix,umask=0222";;
iso9660) options="ro";;
*) options="${rw}";;

MNTLINE="-fstype=$fs,users,exec,$options :$device"

# Return line to the automounter
echo "$MNTLINE"
I also do have /etc/auto.mnt, like this:
# Knoppix automounter file for Directory /mnt/auto
# umask=000 only works for msdos/vfat floppies, but otherwise the floppy is read-only.
floppy -fstype=auto,user,exec,umask=000 :/dev/fd0
cdrom -fstype=auto,user,exec,ro :/dev/cdrom
# The following entries (if any) are auto-generated by knoppix-autoconfig

I would like your comments as to how to proceed to solve these two problems.

Thanks a lot for your time and effort.



12-15-2003, 04:56 PM
OK, with XMMS, I enter /dev/cdrom at the 'play location' menu, XMMS is able to see and play the music CD. So this part of my problem is solved.

Automounting issue still remains though.



12-15-2003, 06:14 PM
I don't care for automount myself so I'm not experienced with it. Here is a howto (http://www.faqs.org/docs/Linux-mini/Automount.html) for automount. Be advised that automount for a dvd+rw is a bad idea. Why? Everytime you insert a +rw disc it gets mounted which counts as a write! Your expensive disc won't last long at that rate.