SourceForge.net Logo

Submount


Linux Removable Media Handling System





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.

What's New

04/18/2004:   SuSE 9.1 to use submount. SuSE 9.1 uses submount by default to handle removable media. SuSE was the first major distribution to include submount, and now is the first to use it in the standard installation. (Now I get to find out if millions of users expose bugs that haven't come to light yet. Yes, I am paranoid.)
04/18/2004:   Submount now included in Gentoo portage. Packages for submount 0.9 are available from the Gentoo portage tree.
02/27/2004:   Version 0.9 released. The primary reason for this release is to address a couple of fairly serious bugs recently discovered. (Submount is benefiting from some professional testing at SuSE.) One bug has prevented the options nosuid, nodev and noexec from operating correctly. The other could produce kernel oopses if subfs was mounted with no options whatsoever.
There is a new feature: the option "procuid" will mount non-unix filesystems with the uid and gid of the process accessing the mount. Uid and gid are now properly stripped from filesystems that don't support them.
02/24/2004:   Updated packages are now available for SuSE 9. Submount user Miguel Angel Alvarez has kindly made packages for submountd and the kernel module source. He has also provided instructions for building the updated modules. You can find them on the new SuSE page.
Older News

Warning:

Submount is still under development.   It has had moderate testing so far.   If it crashes your system, destroys your data, or causes your computer to go mad and try to murder you, the author is not responsible.

Installation:

The latest release, Submount version 0.9, can be downloaded from the Sourceforge project page.  Submount is composed of two part: a kernel module called "subfs" and a user program titled "submountd".   Both must be properly installed for submount to work.   The software is contained in the two directories underneath the submount directory.   To build and install the software, read the files titled "INSTALL" in both directories.   A few binary packages are now available.



Packages are available for the most popular stock-kernels
from the following distributions:
Fedora Core 1
RedHat Enterprise Linux 3
Mandrake 9.2
Redhat 9
Slackware 9.1
Debian Sarge
SuSE 9

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.

Requirements:

The 2.6.x version of submount has been tested with kernels up to 2.6.3 as of this writing.  It has also been successfully tested against 2.6.3-mm3.

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.

Usage:

Once the software is installed, and the kernel module is loaded, you can mount a submount filesystem.

To mount a drive under subfs, use the usual syntax, except put "subfs" in the filesystem type field, and add the option "fs=<fstype>" in the options list.

for example

mount -t subfs /dev/scd0 /mnt/cdrom -o fs=iso9660,ro

or 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.


Author:

Eugene Weiss


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