I'm trying to do something a bit out of the ordinary with the linux
filesystem, and I was wondering if anyone had any thoughts as to
whether it was possible with autofs.

Normally with autofs, you cd into a directory, and the chdir() blocks
until automount has a chance to mount another filesystem at your
destination.  What I would like to do is be able to make a directory
tree on the fly in the current filesystem instead of mounting a new
one.  So, if /.autofs/ is on the root partition, then "cd
/.autofs/temp" would run a program map script which would
"mkdir /.autofs/temp; mkdir /.autofs/temp/link1; etc", where the
details of the symlinks to be placed in that directory are decided by
the program map script on the fly.  Then, when the directory has been
unused for the length of time specified in auto.master, it should be
"rm -rf"ed instead of umounted.

Is doing something like this even possible with autofs?  The only
thing I could think of is to have the program script copy a small
blank formatted ext2 disk image, mount it over loopback, make
subdirectories or symlinks in it, umount it, then spit out something
like:
"temp    -fstype=ext2,ro,loop    :/var/lib/autofs/image.5535"

Even if this worked, it would be a slow and ugly hack... but simply
making a directory rather than really mounting one would fail when
umount() time came around.

I know this is kind of stretching autofs, but I was hoping not to have
to write a new filesystem driver when something so simple would work
just as well for me.  Any thoughts?
---
Roy Stogner

Reply via email to