PDA

View Full Version : Automatically created/deleted mountpoints



Hrod Beraht
26th October 2007, 01:44 AM
When I insert a USB memory stick, a folder at /media/memorystick is automatically created.
When the memory stick is unmounted, that folder disappears.
That makes a lot of sense since if the folder isn't there it makes it pretty obvious that the memory stick is not mounted.

Is it possible to do a mount like that with a smbfs/cifs network folder? That is, where it only shows the folder when the network folder is actually mounted?

Bob

FriedChips
26th October 2007, 02:02 AM
I'm really not 100% sure but, I am really thinking it isn't. at least I do not know of a way to do this.

brr872002
26th October 2007, 10:32 AM
When I insert a USB memory stick, a folder at /media/memorystick is automatically created.
When the memory stick is unmounted, that folder disappears.
That makes a lot of sense since if the folder isn't there it makes it pretty obvious that the memory stick is not mounted.

Is it possible to do a mount like that with a smbfs/cifs network folder? That is, where it only shows the folder when the network folder is actually mounted?

Bob

/media entries were created by haldaemon for storage hardware
other mount points are user created folder.

goldenbrown
26th October 2007, 11:38 AM
Hello Bob,
you are looking to automount the file system. I share folders between two linux boxes using NFS using this method and I bet you can do the same with smbfs and cifs.
This is done using the /etc/auto.net script, which finds what directories are available on the lan using showmount/kshowmount and creates a directory under /net for each mounted file system. Use the /etc/hosts file to give a name to the ipaddress of your windows box. This (I think) requires a static mapping, so if you use dhcp on your lan, then this require extra work.
Not sure if the directory disappears when the share is not available, but it only appears when you cd/ls into it.
Unfortuantely, I have found this method won't mount the share when you try and open a file in the share via an application.

Nigel

Hrod Beraht
26th October 2007, 03:13 PM
Unfortuantely, I have found this method won't mount the share when you try and open a file in the share via an application.
Well this is kind of the thing I was trying to have it do.
I can, of course, mount the networked drive either manually or via fstab. I had a problem the other day, though, where it didn't actually mount via fstab (network wasn't ready when it tried to mount), so some files I transferred there (thinking it was the network drive) actually just copied to the local folder.

Realistically, I'd just like some way to actually tell if a folder is local or networked. Right now, in Nautilus, the folder icon looks the same whether it's the local folder or the mounted network folder

Bob
.

goldenbrown
26th October 2007, 09:23 PM
looked at man showmount, and found it only works with NFS shares :) / :mad: So this is no good for your situation.
Is there a command that interrogates the remote windows host for info on which folders are shared? If so you can edit the /etc/auto.net file to run this way. I don't know the answer to this :confused: .
I found that nautilus WILL automount, but you have to use file->open location, and then it works. This may be the same for applications, the share folder will not appear, until you actively choose it i.e. by using the keyboard (sorry,slightly off-thread, but it cleared up an issue in my mind :) .

Nigel
(sorry about excessive use of :p , :D)