Submount is a system for automatically mounting and unmounting removable media drives like cdroms and floppy disk drives. It works with the Linux 2.6 kernel series. A backport to the 2.4 kernel series is available now as well. Once installed, it allows removable media drives to be accessed as if they were permanently mounted.
For many distributions, there are packages for 2 different kernels available. This usually means one is for the original distribution kernel, and the second for a kernel released with recent security updates included. Check the package name and the version of the kernel installed on your system carefully to make sure that they match.
For Redhat, Fedora, and Mandrake, Choose the RPM that matches your kernel package.
For Debian, download the subfs-modules package that matches your kernel-image deb,
download the submountd package, and install both.
The .tgz packages for Slackware 9.1 were built for the basic ide kernels, but also work
for the scsi.s kernels, and hopefully for others. If you want a package for
a different stock kernel from these distributions (such as smp)
email me directly.
SuSE 9 contains version 0.2 of submount, with the kernel modules included in the kernel packages, and the userspace portion in a separate "submount" package. The package is included with the professional version, but not with the personal edition, so if you have the latter, get the package from SuSE's ftp site. There's no integration with yast, however, so you'll still have to edit your /etc/fstab file by hand.
SuSE 9.1 will use submount to handle removable media by default.
Updated Suse 9.0 packages are now available. Instructions for using them can be found on the SuSE page.
Gentoo has included submount in the portage tree. I think "emerge submount" ought to work. See the submount ebuild page for more info.
Contact me if you want to help with building packages for other kernels or other distributions.
The 2.4.x version has been tested with 2.4.20 through 2.4.24, but should work with recent 2.4.x kernels.
mount -t subfs /dev/scd0 /mnt/cdrom -o fs=iso9660,roor for fstab
/dev/scd0 /mnt/cdrom subfs fs=iso9660,ro
I've copied the function to find the filesystem type by reading the superblock from the standard mount program, so fs=auto will work. It can, however, cause a noticeable pause, particularly on floppies, so there is another method for using multiple filesystems. If a keyword is used in the fs= option, submountd will attempt to mount filesystems from a list. Currently there are two options: fs=floppyfss attempts vfat and ext2, and fs=cdfss tries iso9660 and udf. Submountd will strip the options codepage, iocharset and umask from filesystems that don't take them, so these can be included in list mounts, or auto-detected mounts.
These fstab lines should work:
/dev/scd0 /mnt/cdrom subfs fs=cdfss,ro,iocharset=iso8859-1,umask=0 0 0
/dev/fd0 /mnt/floppy subfs fs=floppyfss,iocharset=iso8859-1,sync,umask=0 0 0
Another option is to use a colon separated list of filesystems:
/dev/scd0 /mnt/cdrom subfs fs=udf:iso9660,ro,iocharset=iso8859-1,umask=0 0 0
Once this is done, just access the mountpoint directory as usual.
Note: The option iocharset should only be used for kernels which require it. If the installation program of your distribution used it, you should as well. Otherwise, you should not.
If you try submount, please let me know if it worked for you.
As of version 0.6 a second client program has been included for the purpose of allowing submount to be used with NFS and other network filesystems. It works by calling the standard /bin/mount and /bin/umount programs. It is named "net-submountd" and is installed by default in the /sbin directory. To use net-submountd instead of the standard submountd, add the option program=/sbin/net-submountd in the list of options. It accepts the option "interval=XX" where XX represents the time in seconds between attempts to unmount the filesystem. If it is not specified, the interval defaults to 15 seconds.
An example of an NFS share mounted with net-submountd fstab entry follows:
192.168.1.12:/myshare /mnt/myshare subfs fs=nfs,program=/sbin/net-submountd,interval=5,....[usual NFS options]
Net-submountd is intended for use for simple network shares only, where editing /etc/auto.master and related files are a hassle rather than an opportunity to automate the configuration of many shares. For complex NFS setups automount is, and will continue to be the appropriate tool.
As of version 0.5, it is possible to use a program other than /sbin/submountd as the helper application. As of now, net-submountd (see above) is the only alternative application available to substitute for /sbin/submountd . You can also use this capability it to put submountd in a directory other than /sbin if you wish.
To use this capability, add program=xxxx to the list of options on the /etc/fstab line, where xxxx is the full path of the application.
Further info can be found at the Sourceforge project page, or you can contact me via email.
A mailing list is available to track submount development.
This page last updated 04/18/2004