When I built the kernel, I add the autofs4 module to automount the SD and CF card.

If you use autofs4, you don't need to manually mount the cards. Just plug-in the card then that's it. Also you don't need to unmount to plug-out the card.

This module is also useful to automount smb or nfs. You can find very good howto to install and use the autofs in following links.

Here I summarized what I did to set it up.

  1. Install autofs.
    apt-get install autofs

  2. Modify /etc/fstab
    /dev/mmcblk0p1 /media/card vfat rw,user,noauto 0 0
    /dev/hdc1 /media/cf vfat rw,user,noauto 0 0

  3. Add the following line into /etc/auto.master
    /var/autofs/removable /etc/auto.removable --timeout=2

  4. Make a new file, /etc/auto.removable.
    card_cf -fstype=vfat,rw,gid=100,umask=002 :/dev/hdc1
    card_sd -fstype=vfat,rw,gid=100,umask=002 :/dev/mmcblk0p1

  5. Restart autofs daemon.
    /etc/init.d/autofs restart

  6. Make the link. If there are already the files or the folders, then remove them.
    ln -s /var/autofs/removable/card_cf /media/cf
    ln -s /var/autofs/removable/card_sd /media/card

Posted by yonggun