[comp.sys.sun] Problems with lofs on Sun-3/4, SunOS 4.0, 4.0.1

perw@holtec.se (Per Westerlund) (02/10/89)

Using SunOS 4.0 (4.0.1) there is available a so called "loopback virtual
file system", lofs.  The use of it is not apparent, but I would like to
use it to mount /var/tmp on /tmp, increasing the apparent size of /tmp,
without increasing the true size of the root partition.  (Replacing /tmp
with a symbolic link to /var/tmp is not acceptable, makes single-user mode
without /var mounted a bit hard.)

All that should be needed is to add the following line to the config-file

	options		LOFS

and make a new kernel.

The file-system type is 'lo', and trial runs work,

	mount -t lo /var/tmp /tmp

gives the desired result.

Next step is to modify /etc/fstab and /etc/rc to have this mounting
automatic.  Add the line

	/var/tmp	/tmp	lo	rw	0	0

to /etc/fstab.  Since I have looked at how this is done on the 386i, I add
a line to /etc/rc to make it look like this:

	mount -at 4.2	>/dev/console 2>&1
	mount -at lo	>/dev/console 2>&1

THIS DOES NOT WORK!  During startup this message appears:

	"mount: unknown filesystem type: lo"

but the same command works as long as it is not run from within /etc/rc
(by init?).

A few possible explanations have been tried, without success:

- /etc/mount is statically linked.
- /sbin/mount is identical to (/usr)/etc/mount.

I have not been able to follow /etc/mount's doings with trace(1), since it
does a fork(2), and I loose it.  Debugging with adb(1) without a symbol
table is so hard that I wont even think about it.

Ideas, someone?

		Per Westerlund
		Holistic Technology AB
		Gothenburg
		SWEDEN
		+46 31 420370
		perw@holtec.se

bukys@cs.rochester.edu (Liudvikas Bukys) (02/16/89)

In article <677@holtec.se> perw@holtec.se (Per Westerlund) writes:
>Using SunOS 4.0 (4.0.1) there is available a so called "loopback virtual
>file system", lofs....I would like to use it to mount /var/tmp on /tmp,
>...(Replacing /tmp with a symbolic link to /var/tmp is not acceptable,
>makes single-user mode without /var mounted a bit hard.)

If that's your only objection to a symbolic link, then, while single-user,
with /var UNMOUNTED, do a "mkdir /var/tmp".  Then you'll have a small
/var/tmp on your root, to use when standalone, and you'll have your large
/var/tmp when you go multi-user.

rayan@ai.toronto.edu (Rayan Zachariassen) (02/16/89)

In the root filesystem, create /var/tmp (/var already exists as a mount
pt), and make /tmp -> var/tmp.  Then remember there might be files in
there if you are ever puzzled by some size vs usage discrepancy in / while
you have /var mounted.

perw@holtec.se (Per Westerlund) (02/23/89)

Short recapitulation of the problem: Paraphrased, loop-back filesystems
(lofs(4)) are for directories what symbolic links are for files.  But, I
did not succeed in mounting filesystems of type lofs from the /etc/rc
script, which always worked from a shell.

The solution: The variable PATH is not exported in /etc/rc, add "export
PATH" and mounting lofs-type filesystems works.  (Aside: Why is PATH not
exported?  Will I break something when I export it, due to some very
subtle interaction?)

The explanation of the solution:
Whenever /usr/etc/mount encounters a file system type that it does not
recognize, it tries to execute a program called '"mount_%s", <file system
type>', in this case mount_lo.  (This is not documented, I got a
suggestion this was the case by Greg Earle, <earle@sun.com>. Thanks,
Greg.) There is a program /usr/etc/mount_lo, but /usr/etc/mount did not
find it, since it had the default PATH in the environment.  If /etc/rc
exports its PATH, which contains /usr/etc, /usr/etc/mount will find
mount_lo.

	Per Westerlund
	Holistic Technology AB
	Grona Gatan 59
	Gothenburg
	SWEDEN
	+46 31 420370
	perw@holtec.se

joerg@sun.com (Joerg Schilling - H. Berthold AG Berlin) (02/28/89)

/sbin/mount and /usr/etc/mount only know  how to deal with the filesystem
types "ufs", "nfs" and "pc". If you specify any other filesystem type, it
calls a program named mount_xxx where xxx is the filesystem type.  To
mount any filesystem of type "lo" it generates an arg vector similar to an
struct mntent and then calls the program mount_lo via execlp.

If you want to mount any "lo" filesystems, you schould have
/usr/etc/mount_lo available and /usr/etc in your search path. 

Add after the line:

PATH=/bin:/usr/bin:/usr/etc:/usr/ucb

a line :

EXPORT PATH

to the file /etc/rc.local

and your mount will work.


NOTE:
I positively know this for 4.0 and 4.0.1. I hope this will work as well if 
you have the  NSE extensions for 3.4/5.

        J. Schilling 
        H. Berthold AG 
        Teltowkanalstr. 1-4 
        D 1000 Berlin 46 
        +49 30  7795 - 400 


joerg@berthold.de

... tub!berthold!joerg 
... unido!berthold!joerg 
... sunmuc!berthold!joerg 
... sun!sunmuc!berthold!joerg