Friday 28 October 2011

Supermount - automatic mouting


For a quick background, supermount is a way of automatically mounting removable disk drives (floppys, cd-roms, dvd-roms, etc) without having to manually mount them or using some sort of kde/gnome on-the-fly (u)mount magic. Because of the nature of supermount, it allows you to eject the drive while it is mounted (if it's reading it blocks it) and will automatically handle the appropriate mounting/unmounting.
The first step is to acquire a kernel which has the appropriate kernel patch on it. I just went ahead and grabbed the gentoo-dev-sources which has supermount/bootsplash and a few other things. You could also use the vanilla sources and the patch from supermount at sourceforge (also has more information on the supermount-ng).
If you want to patch the kernel yourself, first make sure that /usr/src/linux is the kernel you wish to patch. The Gentoo kernel gentoo-sources already has this patch. Copy the patch to /usr/src/linux and apply using the following commands:
   cp supermount-2.0.3-2.6.0.patch.gz /usr/src/linux
   cd /usr/src/linux
   gzcat supermount-2.0.3-2.6.0.patch.gz | patch -p1
You will get a listing of the files that were patched and if there were any errors it'll tell you. Keep in mind that the patch will not work on all pre-patched kernels as another patch could break this patch.
Next step is to be sure to enable the appropriate option in the kernel. It is sorta hidden and I couldn't find it without looking through the .config file.
`` File systems >`` Pseudo filesystems > <*> Supermount removable media support
I have mine built in to the kernel, but it might also be a good idea to build it as a module so that if it crashes it doesn't take your kernel down with it.
Before you reboot with your new kernel, make the directories for your mount points
   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 go along with the mount points we just created above.
none /mnt/dvd supermount fs=auto,dev=/dev/cdroms/cdrom1 0 0
none /mnt/cdrw supermount fs=auto,dev=/dev/cdroms/cdrom0 0 0
none /mnt/floppy supermount fs=auto,dev=/dev/fd0,--,user,rw 0 0
Now you can reboot.
The layout for this should be fairly self explanatory. I've never had to use anything but "auto" for the fstype and of course your device point to the device of your drive. The second option is your mount point. Make sure that the first field is "none" as having the device name in this field may cause things to be slow.

No comments:

Post a Comment