Linux automount recipes

Note: This is largely deprecated by udev

Linux's automount is a handy utility, and not just for mounting NFS shares. I find it useful for mounting removable media (USB sticks, external hard drives and DVD/CDROM drives) and SAMBA shares.

SAMBA

Here's an example showing automount listing and mounting all SAMBA shares on a remote host:

[athomas@cavern:~]df -k | grep smb
[athomas@cavern:~]cd /smb/iris/storage
[athomas@cavern:/smb/iris/storage]df -k | grep smb
//iris/music          37074944  31778816   5296128  86% /smb/iris/music
//iris/images           501216    158272    342944  32% /smb/iris/images
//iris/backup         41922560  17125376  24797184  41% /smb/iris/backup
//iris/storage        38787072  33626112   5160960  87% /smb/iris/storage
[athomas@cavern:/smb/iris/storage]

I use auto.samba for automounting SAMBA shares.

USB Mass Storage Devices

Here is another, showing automounting of my USB memory stick:

[athomas@o2zeopslin01:~]df -k | grep media
[athomas@o2zeopslin01:~]cd /media/stick
[athomas@o2zeopslin01:/media/stick]df -k | grep media
/dev/sdb1               889108      6124    882984   1% /media/stick

Automounting arbitrary devices

I have written a custom program automap for automounting arbitrary devices. It currently recognises static devices (eg. /dev/cdroms/cdrom0), and USB devices by their serial number.

Here is an example auto.media.conf:

# type  identifier  name  options
disk            scsi-usb        DEF107679C83:1                  -fstype=auto,uid=10000,gid=10000
rdisk           scsi-usb        DEF107679C83                    -fstype=auto,uid=10000,gid=10000
stick           scsi-usb        242842A6A48500DA:1              -fstype=auto,uid=10000,gid=10000
rstick          scsi-usb        242842A6A48500DA                -fstype=auto,uid=10000,gid=10000
dvd             dev             /dev/cdroms/cdrom0              -fstype=iso9660,ro
cd              dev             /dev/cdroms/cdrom0              -fstype=iso9660,ro