Trouble Configuring USB SSD to Mount Correctly

Hello,

Comp Specs:
Dell Laptop
OpenSuSE 11.4
GNOME
2.6.37.6-0.5-desktop #1 SMP PREEMPT 2011-04-25 21:48:33 +0200 i686 i686 i386 GNU/Linux

Drive Specs:
Kingston External SSD Drive 128GB

Ok, so for the last couple of weeks I have been playing with trying to configure auto-mounting my SSD drive. But it seems SO confusing trying to get this configured correctly. Between HAL, udev, autofs, automount, auto.master file, etc I feel like I am getting more confused the more I read about it… Not really sure how these work or how they are interconnected if at all?

First:
At first when I plug in my USB SSD Drive it automatically mounts to “/media/SSD” (but this is not where I want it mounted, for a few reasons). “SSD” → is the volume label as well.

Second:
Then I tried adding this line to fstab:

LABEL=SSD	     /mnt/SSD 		  ext3	     defaults		   1 2

When I add that line I can see during the boot message/log that it is waiting for me to plug it in so that it can mount it. Which is nice but I don’t always need it plugged in at that moment. Also, after adding that line, when I plug the SSD in, it no longer automatically mounts it anywhere.

Third:
Then I tried using the auto.master file to automount the drive (used this tutorial to do that → Configuring Autofs). Added the following lines to auto.master (Not at the same time though, tried each separately):

#File: auto.master
/mnt/SSD      /etc/auto.SSD      --timeout=10
/mnt      /etc/auto.SSD      --timeout=10
SSD      /etc/auto.SSD      --timeout=10

#File: auto.SSD
SSD		-rw	:/dev/sdb1

After doing the above and then restarting autofs I saw the following as the last line of the mount command (which seems VERY strange):


 > mount
/etc/auto.SSD on /mnt type autofs (rw,relatime,fd=6,pgrp=11202,timeout=600,minproto=5,maxproto=5,indirect)

Which also will not allow me to umount it??? Tells me it’s busy.

So basically I would just like to be able to plug in the USB SSD and have it automatically mount to “/mnt/SSD”. Could anybody give me a hand with this?

Also, I would LOVE to know how these things work or how they work together (HAL, udev, autofs, etc…) if anyone could explain?

Thanks in Advance,
Matt

I can not answer al your questions, but maybe some of them. So in no particular sequence.

I do not understand why you are so eager to mount it within* /mnt *instead of /media. Both are equaly good or bad, whatever you like.

HAL is no longer used in openSUSE 11.4, thus most of what you have learned about HAL you can forget.

That said, a few things are still as true as they were with HAL. Mounting dynamicaly on connection by the system is still allways in */media *and there will not be such a mount action when the device is found to have an entry in /etc/fstab.

The configuration file *auto.master *belongs to a very different type of actions. This is connected to NFS. In this scenario exported directories are available for mount, but they are not mounted on the NFS client until they are needed (by a user doing a cd inside, or oening a file inside that NFS mount). This feature is much older then Linux and like the rest of NFS/NIS is designed originaly by SUN Microsystems.

Entering an entry in /etc/fstab means that at boot the system tries to mount that entry (doing mount -a). This is the first and foremost task of the fstab. You can prevent this mount (and thus the waiting time you are mentioning), use the noauto parameter (see also man fstab).

As you most probably already have found out and as the above must have strengthened is the fact that the word “automounting” is a buzzword that is used very imprecisely. Thus I can understand that the different documentation you found seems to be contradictory. That is why I avoid to use hat word here.

What in any case is feasable is making an /etc/fstab entry with the noauto option. This will prevent it from mounting on boot and you still have the parameters there to allow root to mount it with a simple statement like:

mount /mnt/SSD

or

mount -L SSD

The rest of the parameters is then found in /etc/fstab.
It then also will not be mounted by a combination of udev and your desktop, which will also mean that the device notification will not pop-up.

I never tried it, but adding the parameter user might make it possible for any user to do that mount statement.

For a possible further going automation to your liking, you have to wait for others to tune in here.

HTH

Hey hcvv,

Thanks for the response and the much needed info (thank goodness I can forget about HAL… seems rather dumb that it would be included in the install of 11.4 if it isn’t even used???)

The reason I wanted it to mount to /mnt was because I had originally mounted it there when I first got the drive, and then had configured a bunch of things to use that directory including a couple of VMs and such. But oh well…

Also, the info you gave me about auto.master makes much more sense now, because all the examples I could find were for drives on the network, thanks…

Well, I’ve decided to keep the entry in fstab and use your advice about adding the noauto option to the entry.
So what I’ve done now is added a “Application Launcher” icon to the GNOME panel (i.e. “taskbar” at bottom) which will simply run a little Expect script that will mount and umount the drive for me where I want. It works great so far.

Thanks for all the info, you really cleared some things up that were boggling my mind.

Thanks,
Matt

I am glad I could help you. I admit that though I tried to understand HAL, there are still things misterious for me there. Hal is going to be depricated, but others are taking over and probably doing the same. Thus if it is still HAL or not is not that important.

The big problem with the “spontanious” mount when a storage device is dynamicaly entered is IMHO that the end user that is loged in on the keyboard/mouise/monitor of a PC thikns that it is just normal and logical that he gets “automaticaly” access to that device. Now that might be the only and thus logical way to go for when one works with a single user system like MS Windows variants, but it is not with a multi user system like Linux.

We had allready stories here about someone loged in and then blocking his session. His wife arrived and clicked the “new session” from the blocked session window enf loged in. She walked away. The daughter arived, saw that het mother did not block her session, but was so kind to start a new (the third) session, loged in and connected an USB storage device. Now who got the pop-up/automatic mount or what you call it?

These are basic problems, not easy to be solved. After al Unix/Linux was designed for multi user access (from terminals, a system manager that was the ony one that had the root passsword and an operator to mount removable devices. To day people are all executing all these roles at the same time without realizing it. And it is not easy to design software to care fort thi (network manager is another one in this class).

BTW when you have the time and the guts, you could try to solve your problem (at least from the mounting part of it, unmounting is a bit different) by trying to make some nice udev rules:
https://wiki.archlinux.org/index.php/Udev
Writing udev rules
I love the second one, it at least explains the basics of udev.

All,

If anyone finds themselves with this problem and would like to know the workaround I used, I will gladly post the steps and the code I used to get it to work.

Thanks,
Matt

Makes sense thanks for the info.

I am really interested in learning the ins and outs of udev, so I think I will check out the links you provided (recent convert from everyday Windows user). And now that I was recently hired (recent IT graduate as well) as a assistant systems administrator, the more knowledge/experience of linux I can get the better.

Again, thanks for all your help,
Matt