On Tue, 9 Nov 1999, H. Peter Anvin wrote:
> Anders Melchiorsen wrote:
> >
> > I have to find a medium-sized project (that is, half time work for a
> > couple of months) to do in University. I want to do something that I
> > can benefit from personally, and so I thought about an automounter for
> > Windows shares. (I live in a dorm with lots of Windows machines
> > sharing things through SMB).
I've been working on the same thing for a while. You can find my
current (working, but too buggy to be useful yet) perl code at
ftp://mycroft.jones.rice.edu/pub/roy/autosmb/
... actually, that port may be firewalled. I'll have it at
http://www.owlnet.rice.edu/~roystgnr/autosmb/ too.
> > As far as I can tell, autofs does support smbmount, but only on a per
> > share basis; you need to specify a mount rule for each share on each
> > server. What I want is dynamic browsing capabilities like Windows
> > offers.
You can get autofs to automatically mount a SMB share such that
"cd /smb/server=share" will take you there, or with a little more work
so that "cd /smb/server/share" will take you there. Unfortunately, I
haven't been able to figure out how to make "ls /smb" or
"ls /smb/server" do useful things efficiently. My first attempt has
to get a complete server/share listing on every scanned subnet at
once, which is grossly inefficient.
> > I think the main problem is that the virtual file system needs two
> > levels, the first with the servers and the second with shares on each
> > server.
Exactly. I've thought of some hacks to do this, but they all involve
either writing a new autofs module, writing a new vfs driver, or doing
hideous loopback mounts of small ext2 image files.
> > Is autofs able to do this, perhaps with a few scripts hacked together?
> > Would it be hard to expand autofs in this direction? Is there some
> > reason it cannot be done?
What I envisioned: First level: /smb contains a list of symlinks,
one for each server, to /.autosmb, which is automounted, with a
program map set up to get a list of shares on that server. When you
"cd /smb/server" it mounts "the magic filesystem", which is just a
directory containing a list of symlinks to sharenames, in
"/.autosmb/server=share" format. The same program map can then mount
an SMB share for that server and sharename. The question is how to
create "the impossible filesystem" on demand.
> > If it is not currently possible in autofs, would one be able to do
> > it with amd (I understand that amd is a bit more powerful, at the
> > cost of being vastly more complex)?
Is amd still supported? I thought it was being phased out.
> It should be doable by using an autofs nested mount on the first level
> and a program mount on the second level. Shouldn't be too difficult.
The trick is not browsing any SMB share on demand, but also getting an
on-demand list of shares that are browsable.
Oh, yeah, and there's still a nasty parsing bug in autofs that makes it
impossible to mount shares that have whitespace in their server name
or share name.
Plus the whole "smbmount" thing is shaky at best. I advise giving up
on the smbfs specific support in autofs, and simply making sure your
system is configured so that "mount -t smb" and "mount -t smbfs" work
as expected.
HPA: that's the second time I've hit reply and sent something to you
only accidentally... sorry!
---
Roy Stogner