Feeback on patch to add ZFS support to mdconfig rc.d scripts
Hiroki Sato
hrs at FreeBSD.org
Mon Jun 10 09:26:19 UTC 2013
"Steven Hartland" <killing at multiplay.co.uk> wrote
in <5E2843FF4724492FBF2A29E43B698385 at multiplay.co.uk>:
ki> ----- Original Message -----
ki> From: "Hiroki Sato" <hrs at FreeBSD.org>
ki> > I think this should be separated into adding non-fs md support into
ki> > rc.d/mdconfig and on-the-fly zpool creation/import into rc.d/zfs
ki> > since the rc.d/mdconfig script does not (and should not) depend on
ki> > zfs.ko module.
ki> >
ki> > rc.d/mdconfig is located before mountcritlocal, so probably
ki> > rc.d/zfs_md or something is needed just after rc.d/mdconfig2.
ki>
ki> Thanks for that Hiroki. If I understand correctly that your only
ki> concern is the zfs module dependency? If so then its easier to make
ki> that a dynamic dependency using a prestart.
Not only that. What I am concerned about is adding ZFS support into
rc.d/mdconfig makes mount sequence in rc.d script more complicated.
Currently, /etc/rc.d/mdconfig runs, /etc/fstab is parsed, and then
"zfs mount -a" is done in rc.d/zfs. The rc.d scripts is not good at
handling dependency, so mounting/unmounting ZFS datasets in multiple
scripts make difficult to use these scripts separetely at run time
while probably they work fine at boot time. If we support md-backed
zpool, "rc.d/zfs stop" should also handle unmounting all of ZFS
datasets and destroy the md devices, for example, because it is
responsible for stopping the ZFS and its related functionality.
This is difficult to realize by using only rc.d scripts, I created
and attached a prototype to add ZFS support directly to mount_mfs(8).
Does this satisfy your needs? Just adding /etc/fstab entry like the
following, md-backed zpools are automatically created and mounted via
rc.d/mountcritlocal. If it is too early, "late" flag can be used as
other file systems. Unmounting them is handled only by rc.d/zfs in
this case. The mount options in an fstab entry look a bit odd
because most of letters are already used in mount_mfs(8), but they
are flexible to support zpool's command-line arguments.
----
# /etc/fstab examples:
#
# create swap-backed md and zpool "poola" on it, and then mount it on /a.
md /a mfs rw,-s1g,-zpoola,-kcompression:on,-kexec:off 0 0
#
# create vnode-backed md and zpool "poolb" on it, and then mount it on /b.
md /b mfs rw,-s1g,-zpoolb,-F/var/tmp/zero 0 0
#
# import (-P flag) a zpool "zpoolc" on vnode-backed md "/var/tmp/zero".
# Mountpoint is automatically determined (/c is ignored).
md /c mfs rw,-s1g,-zpoolc,-F/var/tmp/zero,-P 0 0
#
# import a zpool "zpoold" on vnode-backed md at rc.d/mountlate stage.
# Mountpoint is automatically determined (/d is ignored).
md /d mfs rw,-s1g,-zpoold,-F/var/tmp/zero,-P,late 0 0
----
The following command line should work with the above example:
# mount /a
# sh /etc/rc.d/zfs stop
-- Hiroki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdmfs_zfs_support.20130610-1.diff
Type: text/x-patch
Size: 7351 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/zfs-devel/attachments/20130610/22008fa8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/zfs-devel/attachments/20130610/22008fa8/attachment.sig>
More information about the zfs-devel
mailing list