![]() |
Software >
www.autofs.org [ 1 ] (archive)
Automatically mount stuff like CD-ROM disks when inserted.
-
- .. detects Disks, Partitions, CD-ROMs, Floppies etc. and sets up an automount configuration.
Basic setup ∞
-
2009-03-17 - (version not recorded) on (distribution not recorded)
Specify mountpoint directories and map files ∞
Edit the main configuration file:
su nano /etc/autofs/auto.master
There are three things to learn:
/mnt/autofs/optical /etc/autofs/optical.txt --timeout=4 /mnt/autofs/sd /etc/autofs/sd.txt --timeout=4 1 2 3
-
The directory which autofs will control.
- WARNING: Make certain this is a unique directory which autofs can delete and create directories at will!
- The map file which will be used. More on that next.
-
The number of seconds of disuse before autofs unmounts it.
- This is important, because regular users won't be able to eject a cdrom without a timeout.
Create your map file(s) ∞
Edit the configuration file(s):
su nano /etc/autofs/optical.txt
There are 3 things to learn:
dvdr -fstype=iso9660,ro,nosuid,nodev :/dev/hda dvdrw -fstype=iso9660,ro,nosuid,nodev :/dev/hdb 1 2 3
-
The mountpoint. This will be created in
/mnt/autofs/optical/
in this example./mnt/autofs/optical/dvdr/
/mnt/autofs/optical/dvdrw/
- The options given. This is like
mount
. -
The device to watch.
OPTIONAL: It's the same for everything else, if you keep them in different configuration files:
su nano /etc/autofs/sd.txt
and add:
sdh1 -fstype=auto,rw,nosuid,async,nodev :/dev/sdh1
-
NOTE:
async
is used to help the SD card's longevity.
Set up your system ∞
OPTIONAL: If you don't like a mountpoint like /mnt/autofs/dvdr
then change it with ln
:
ln -s /mnt/autofs/optical/dvdr/ /mnt/dvdr ln -s /mnt/autofs/optical/dvdrw/ /mnt/dvdrw
Note that these will flash red until the item is mounted.
- If you cannot eject your disks by pressing the button on the device
- You cannot eject when the disk is in use by any program.
- You need to wait for the timeout - four seconds in these instructions.
-
Lastly, you can fix it with this:
su chmod a+r /dev/hda chmod a+r /dev/hdb
- NOTE
-
I had no success with this surviving when I rebooted. I tried
pcc
and then Security > Tune permissions on system. But that doesn't seem to do anything. Hrm.
Test ∞
1. Restart the service (do this whenever you make configuration changes):
su
service autofs restart
2. Insert a disk.
3. View the appropriate directory:
ls /mnt/autofs/optical/dvdr/
4. Wait 4 seconds. This is the value we specified with --timeout
5. Eject the disk by pressing the button on the device
Auto-mounting an ISO ∞
-
2009-05-22 - (version not recorded) on (distribution not recorded)
For playing a movie-ISO, I can just use VLC directly on it.
mount ∞
(mount)
mount -o loop test.iso /mnt/mnt
mount: only root can do that
fstab ∞
(fstab)
I see no way to give permission for a user to do something like this.
Autofs ∞
I thought this might be a cool idea. I played with it, and it didn't work.
Make something prompt for the root password, and run as root ∞
(Make something prompt for the root password, and run as root)
su ln -s /usr/bin/consolehelper /usr/bin/mount-root cp /etc/pam.d/synaptic /etc/pam.d/mount-root ln -s /bin/mount /usr/sbin/mount-root
Aha, it works!
In your file manager, you could associate .iso
with a few things:
mount-root -o loop '%s' /mnt/iso umount-root /mnt/iso mount-iso-and-play.sh '%s'
Notes ∞
-
Build a Virtual CD-ROM Jukebox
- Use a low-cost, scalable Linux server to share CD-ROM image files to Windows clients.
- Nautilus Script to Mount ISO files
ported