HOWTO Submount

From Gentoo Linux Wiki

Jump to: navigation, search
This page is a candidate for deletion 
Reason given: Submount has been removed from portage, and adequate replacements, such as ivman, exist. In addition, Submount is broken with the latest kernels, and is no longer maintained.
If you disagree with its deletion, please explain why on its discussion page.
If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Make sure no other pages link here and check the page's history before deleting.
This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

[edit] Introduction

Submount is a system for automatically mounting and unmounting removable media drives like CD-ROMs and Floppy disk drives and even NFS shares. 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. So it is an alternative to Supermount. A drawback of Supermount is the need to patch the kernel. Submount on the other hand is a kernel module, so it should run with virtually any current kernel and kernel patch set (e.g. gentoo-sources or mm-sources).

Homepage: http://submount.sourceforge.net

[edit] Installing

[edit] From Portage

The 0.9-r1 ebuild is now marked as stable so you don't need to add it to package.keywords anymore.

You can now install submount the normal way:

emerge submount

To test your install run:

modprobe subfs

Normally, if the module is not loaded when you try to mount a drive, mount will automatically load the module for you. You can now skip the next section.

[edit] Manually

First, you need to acquire the source code of submount. You can grab it from SourceForge. The current version is 0.9.

Next, you need to extract the source code. The following commands copy the archive to /usr/src and extract the source code.

cp submount-0.9.tar.gz /usr/src/
cd /usr/src/
tar xfzv submount-0.9.tar.gz
cd submount-0.9

Now you are in the directory where the submount source code resides. You will find 2 directories: subfs-0.9 and submountd-0.9

First, we will make the kernel module:

cd subfs-0.9
make && make install
cd ..

You should see some compiler messages run down your screen. After the compiling is complete, make install copies it to your module directory.

Now we will load the module for the first time (hooray!):

modprobe subfs

If everything went smooth, you can find the module in the list given by lsmod.

Next we will make submountd, the program which is also needed for submount to work.

cd submountd-0.9
./configure
make && make install

If you want to put submountd to another directory, you can provide a parameter to the configure script.

[edit] Usage

So, all the work is done now. (Next paragraph shamelessly stolen from HOWTO Supermount).

Before you can get happy with submount, make the directories for your mount points, e.g.

mkdir /mnt/dvd
mkdir /mnt/cdrw
mkdir /mnt/floppy

and edit your /etc/fstab file to include the following entries. Make sure the mount points here correspond with the mount points we just created above. Also verify that you have the correct path to your cdrom: ls -l /dev/cd*

File: /etc/fstab
/dev/cdroms/cdrom0      /mnt/dvd      subfs       fs=cdfss,ro,user             0 0
/dev/cdroms/cdrom1      /mnt/cdrw     subfs       fs=cdfss,ro,user             0 0
/dev/fd0                /mnt/floppy   subfs       fs=floppyfss,rw,user         0 0

The layout for this should be fairly self-explanatory. Be aware of the difference for fstype of the CD-ROMs (cdfss) and the Floppy drive (floppyfss).

The df command will show disk usage for your mounted file systems. When using submount all your removable drives will be accessed even if they have no media inserted. To avoid this you can use df -x subfs to exclude all subfs file systems. If you like, edit your ~/.bashrc, and add the following line:

File: ~/.bashrc
alias df='df -x subfs'


It's also a good idea to make sure slocate also skips subfs. Edit the following line in /etc/updatedb.conf and add subfs to the end of the PRUNEFS variable:

File: /etc/updatedb.conf
PRUNEFS="NFS nfs afs proc smbfs autofs auto iso9660 devfs tmpfs ncpfs sysfs supermount devpts usbfs cifs nnpfs subfs"
export PRUNEFS

[edit] Problems

  • Submount was not working automatically, but was working with manual mount, so I put defaults in /etc/fstab options and it worked. Example:
File: /etc/fstab
/dev/cdroms/cdrom1      /mnt/cdrw     subfs       fs=cdfss,ro,user,defaults             0 0
  • In my Gentoo stable installation I was unable to get submount to work until I have specified a program= parameter while mounting. I was getting messages like:
subfs: submountd mount failure

in my log files. This is probably because subfs has a hardcoded path to the submountd program (/sbin/submountd) while Gentoo puts this program in /usr/sbin. So, if you see messages as shown above, change your /etc/fstab entry so that it reads:

File: /etc/fstab
/dev/cdrom  /mnt/cdrom  subfs fs=cdfss,program=/usr/sbin/submountd,ro,umask=0   0 0
  • The program parameter did not work for me. Creating a symlink from /usr/sbin/submountd to /sbin/submountd did the trick. Run the following as root: ln -s /usr/sbin/submountd /sbin/submountd.
  • Submount (0.9-r2) made my system very unstable (hardlocked every half hour). Programs would stop responding or crash, then a minute later: complete hard-lock.

[edit] See Also

Personal tools
In other languages