Hi All,

a couple of days ago, I once again ran into the issues regarding
layered mounts of diffrent filesystems and lofs mounts depending upon
other mounts. Two more or less recent pointers:

        http://bugs.opensolaris.org/view_bug.do?bug_id=6464201
        http://www.opensolaris.org/jive/thread.jspa?messageID=122908

>From my experience, the most important issues are that currently there
is no generic way to

- mount filesystems on a metaset (can fail if metaset auto-take does
  not work or not supported as in Sun Cluster)

  -> we need a metaset take import method and a filesystem mount
     method which depends upon the metaset

- mount filesystems which depend upon each other but are of different
  FSTypes like NFS, ZFS, UFS or lofs. The classic is that a lofs mount
  of an NFS mount or even an UFS mount fails (in some cases), if
  simply being added to the vfstab.

  There are two different kinds of dependencies, but both boil down to
  a dependency from one mount to another where one cannot be mounted
  until this other is (I was tempted to use the notion of the dependee
  and depender/dependend here, but this is always confusing, I think):

  - layered mounts where one FS is mounted into the namespace of
    another
  - loopback (lofs) mounts which need another FS as their "device"

As a first effort to solve these issues "once and for all", I have
written

- A simple metaset take/release method (trivial)
- and a proptotype of a generec mount method

I would like to introduce the latter.  Here's the general idea:

- Every mountpoint should be a service. If it depends upon other
  mountpoints, SMF dependencies should be used

- What is now in /etc/vfstab should be in SMF, but to make things
  easy, I would like a sync tool which generates an SMF config from
  vfstab, similar to inetconv.

- This could replace or at least amend

  svc:/system/filesystem/local:default and
  svc:/network/nfs/client:default .

The prototype which I have finished so far converts entries from
/etc/vfstab to SMF and automatically creates dependencies. To mark
entries which should be handled by SMF, I used the keyword "smf" in
the mount at boot column of /etc/vfstab.

Here's the prototype in action:

* Create a vfstab with dependencies:

  new-eclipse:~# grep smf /etc/vfstab
  /dev/md/dsk/d20 /dev/md/rdsk/d20        /home           ufs     2       smf   
  logging,noatime
  swap            -                       /mnt/test       tmpfs   2       smf   
  -
  /home/a/lib     -                       /home/test      lofs    2       smf   
  ro
  /usr            -                       /home/a         lofs    2       smf   
  ro
  swap            -                       /home/a/lib     tmpfs   2       smf   
  -

  - /home/a depends upon /home
  - /home/a/lib depends upon /home/a
  - /home/test depends upon /home/a/lib and /home

  /home/a also depends upon /usr, so for the prototype all mount
  services also depend upon svc:/system/filesystem/minimal. For the
  prototype, mount dependencies are only created for "mount at boot =
  smf" vfstab entries.

* of these, only /home is already mounted:

  new-eclipse:~# df -h
  Filesystem             size   used  avail capacity  Mounted on
  /dev/md/dsk/d10         20G    18G   1.7G    92%    /
  /devices                 0K     0K     0K     0%    /devices
  ctfs                     0K     0K     0K     0%    /system/contract
  proc                     0K     0K     0K     0%    /proc
  mnttab                   0K     0K     0K     0%    /etc/mnttab
  swap                   4.9G   1.2M   4.9G     1%    /etc/svc/volatile
  objfs                    0K     0K     0K     0%    /system/object
  fd                       0K     0K     0K     0%    /dev/fd
  swap                   512M   1.1M   511M     1%    /tmp
  swap                   4.9G    72K   4.9G     1%    /var/run
  /dev/md/dsk/d20         50G    39G    10G    79%    /home

* Run a create-smf-services-from-vfstab script:

  new-eclipse:~# bash /home/slink/smf-mount/mount-simple-admin.sh

* ... and there you are:

  new-eclipse:~# svcs -a | grep filesystem/mountpoint
  online         11:40:31 svc:/system/filesystem/mountpoint/home:mount
  online         11:40:31 svc:/system/filesystem/mountpoint/home:fsck
  online         11:40:33 svc:/system/filesystem/mountpoint/home/X_a:mount
  online         11:40:35 svc:/system/filesystem/mountpoint/home/X_a/lib:mount
  online         11:40:37 svc:/system/filesystem/mountpoint/home/test:mount
  online         11:40:38 svc:/system/filesystem/mountpoint/mnt/test:mount

  an fsck instance ist created for moutpoints of an fstype which
  supports fsck'ing.
  (side note: SMF does not accept FMRI components with just one
   character, so I am working around this by renaming the FMRI, e.g.
   /home/X_a for /home/a -- I have already opened a bug for this, no
   bug id yet)

  new-eclipse:~# df -h
  Filesystem             size   used  avail capacity  Mounted on
  /dev/md/dsk/d10         20G    18G   1.7G    92%    /
  /devices                 0K     0K     0K     0%    /devices
  ctfs                     0K     0K     0K     0%    /system/contract
  proc                     0K     0K     0K     0%    /proc
  mnttab                   0K     0K     0K     0%    /etc/mnttab
  swap                   4.9G   1.2M   4.9G     1%    /etc/svc/volatile
  objfs                    0K     0K     0K     0%    /system/object
  fd                       0K     0K     0K     0%    /dev/fd
  swap                   512M   1.1M   511M     1%    /tmp
  swap                   4.9G    72K   4.9G     1%    /var/run
  /dev/md/dsk/d20         50G    39G    10G    79%    /home
  /usr                    20G    18G   1.7G    92%    /home/a
  swap                   4.9G     0K   4.9G     0%    /home/a/lib
  /home/a/lib            4.9G     0K   4.9G     0%    /home/test
  swap                   4.9G     0K   4.9G     0%    /mnt/test

* Check dependencies:

  new-eclipse:~# svcs -l $(svcs -a | grep filesystem/mountpoint| awk '{ print 
$3 }')|egrep '^$|^fmri|dep\end'
  fmri         svc:/system/filesystem/mountpoint/home:mount
  dependency   optional_all/none svc:system/filesystem/mountpoint/home:fsck 
(online)
  dependency   require_all/none svc:/milestone/single-user (online)
  dependency   require_all/none svc:/system/filesystem/minimal (online)

  fmri         svc:/system/filesystem/mountpoint/home:fsck
  dependency   require_all/none svc:/milestone/single-user (online)
  dependency   require_all/none svc:/system/filesystem/minimal (online)

  fmri         svc:/system/filesystem/mountpoint/home/X_a:mount
  dependency   require_all/none svc:/system/filesystem/mountpoint/home:mount 
(online)
  dependency   require_all/none svc:/milestone/single-user (online)
  dependency   require_all/none svc:/system/filesystem/minimal (online)

  fmri         svc:/system/filesystem/mountpoint/home/X_a/lib:mount
  dependency   require_all/none 
svc:/system/filesystem/mountpoint/home/X_a:mount (online)
  dependency   require_all/none svc:/milestone/single-user (online)
  dependency   require_all/none svc:/system/filesystem/minimal (online)

  fmri         svc:/system/filesystem/mountpoint/home/test:mount
  dependency   require_all/none 
svc:/system/filesystem/mountpoint/home/X_a/lib:mount (online) 
svc:/syste\m/filesystem/mountpoint/home:mount (online)
  dependency   require_all/none svc:/milestone/single-user (online)
  dependency   require_all/none svc:/system/filesystem/minimal (online)

  fmri         svc:/system/filesystem/mountpoint/mnt/test:mount
  dependency   require_all/none svc:/milestone/single-user (online)
  dependency   require_all/none svc:/system/filesystem/minimal (online)

  Please note that the home:mount instance depends on home:fsck

I also added properties to make not only the mount options
configurable, but also fsck. This is something I was missing in the
past in certain corner cases when the defaults used by /sbin/mountall
and friends were not suitable:

new-eclipse:~# svcprop svc:/system/filesystem/mountpoint/home |egrep 
'^(fs/|mount/|umount/|fsck/)'
fs/type astring ufs
mount/device astring /dev/md/dsk/d20
mount/generic_options astring -
mount/point astring /home
mount/retry_overlay boolean false
mount/specific_options astring logging noatime
umount/generic_options astring -
umount/retry_with_force boolean false
umount/specific_options astring -
fsck/device astring /dev/md/rdsk/d20
fsck/generic_options astring -
fsck/specific_options astring -

Status of the prototype:

* DONEs:

  - sh code for SMF methods:
    fsck  : Based upon /lib/svc/share/fs_include.sh, but modfied to
            support setting fsck options
    mount : Using mountfs from /lib/svc/share/fs_include.sh,
            additional support to try remount with -O if
            svcprop mount/retry_overlay = true
    umount: Simple umount with support for umount options
            forced umount if umount/retry_with_force = true

  - perl code to parse vfstab and extract dependencies

  - admin script: bash code to do the basic vfstab to smf conversion

* TODOs (those which came to my mind)

  - admin script: sync-with-vfstab -- modify properties if something
    has been changed in vfstab, delete mpoints which have been
    removed...

  - automate dependencies to metasets and vxvm diskgroups

  - test with zfs

  - move ufs qouta-support from filesystem/local to mount methods
    (:quota instance ?)

  - finish all the details , ? rewrite admin script in perl ?

This mini project is really not in a state where is should be
published, but if people are interested, I will definitely publish
it. But first of all I would like to hear some opinions...

My questions:

- What do you think about this? Is this the right way to go? I believe
  that it is, but maybe someone has a better idea?

- If this is something that the world needs, I would like to make this
  an official opensolaris (mini-) project. Who would help to set this
  up? Who would participate? Would Sun support this concept?

Nils
 
 
This message posted from opensolaris.org

Reply via email to