Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: nested file system types



On Fri 13 Mar 2009 at 21:47:44 -0400, Steven M. Bellovin wrote:
> As I mentioned the other day, I'm working on mount_vnd(8).  It's pretty
> straight-forward; the catch is that I need to be able to specify the
> file system type that's layered on top of vnd.  That in turn raises the
> question of whether two levels is enough -- it's not; ffs on cgd on vnd
> is a perfectly legal (and very useful) construct.  At that point, I
> have to wonder about the proper way to next things.  1 is an
> interesting number.  2 might be.  3 definitely is not; if we support 3,
> we should support N.  How is that best done?

There are some precedents for commands that take (parts of) other
commands as arguments and run them after some preparation. Off the top
of my head I can think of chroot, sudo, ssh-agent, xargs. These can
obviously be chained and hence work like a sort of pre-modifier to the
final command. How about applying the same idea here?

I'm thinking of something like (for your example of ffs on cgd on vnd)

    mount_nest -t vnd disk.img -t cgd mount_cgd_args -t ffs /mount/point

where each -t argument will cause a mount to be done of the most recent
device (or the given one, for the first -t) on a temporary mount
point/device (or the given one, for the last -t).  You can even specify
extra arguments for the specific mount if you agree about whether they
should be placed before or after the -t they go with (this example
assumes after).

Resulting command sequence:

    mount_vnd disk.img /dev/vnd0
    mount_cgd mount_cgd_args /dev/vnd0 /dev/cgd0
    mount_ffs /dev/cgd0 /mount/point

The difficulty is probably in finding out for each intermediate mount
where it ( ends up being | must be ) mounted, but that is exactly the
thing that would make it easier than writing out the sequence by hand.

(-t vnd ends up on some /dev/vnd*, similar for -t cgd, but is this
generally true?)

(for the -t options to work like with mount -t ffs, it would need
(non-nesting) mount_vnd and mount_cgd, etc)


>               --Steve Bellovin, http://www.cs.columbia.edu/~smb
-Olaf.
-- 
___ Olaf 'Rhialto' Seibert    -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl      -- Cetero censeo "authored" delendum esse.


Home | Main Index | Thread Index | Old Index