From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 10 21:42:34 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DACB9106566B for ; Mon, 10 Mar 2008 21:42:33 +0000 (UTC) (envelope-from ady@ady.ro) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.171]) by mx1.freebsd.org (Postfix) with ESMTP id A19AB8FC14 for ; Mon, 10 Mar 2008 21:42:33 +0000 (UTC) (envelope-from ady@ady.ro) Received: by wf-out-1314.google.com with SMTP id 25so2052297wfa.7 for ; Mon, 10 Mar 2008 14:42:30 -0700 (PDT) Received: by 10.142.177.7 with SMTP id z7mr2272691wfe.238.1205185243818; Mon, 10 Mar 2008 14:40:43 -0700 (PDT) Received: by 10.143.159.13 with HTTP; Mon, 10 Mar 2008 14:40:43 -0700 (PDT) Message-ID: <78cb3d3f0803101440l54384d82rf57044aa9418efdf@mail.gmail.com> Date: Mon, 10 Mar 2008 23:40:43 +0200 From: "Adrian Penisoara" Sender: ady@ady.ro To: "Zaphod Beeblebrox" MIME-Version: 1.0 X-Google-Sender-Auth: 4be664f25ea8e449 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org, freebsd-rc@freebsd.org Subject: ZFS startup scripts (was Re: On ZFS and 64/32 dual-booting.) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Mar 2008 21:42:34 -0000 Hi, In particular to ZFS rc.d scripts comments below... On Sat, Mar 8, 2008 at 9:53 PM, Zaphod Beeblebrox wrote: [...] > === What doesn't work OOTB === > > The startup scripts for ZFS are still a little green. One issue is that > the > startup script 'requires' mountcritlocal --- I assume because it figures > it > requires it so that it's own filesystems will mount on top of other local > UFS ones. At least in my case, this is backwards. I need zfs to run > BEFORE > mountcritlocal and BEFORE mdconfig. I have changed my require line to > 'root I'm not sure why you would need to have ZFS filesystems up before mdconfig. However, if you need ZFS volumes up before mdconfig, that's understandable and it is easily doable with a split ZFS startups scripts configuration, like the one I proposed in PR conf/120228 ( http://www.freebsd.org/cgi/query-pr.cgi?pr=120228 ). Basically the ZFS volumes initialization needs to occur as a "disks" requirement. > > hostid' ... since it's good to have the hostid already set and having root > r/w is also good. I don't think I've solved the "BEFORE" problem, but the > my requirements might make it into the CVS tree. > Actually, to respect the Un*x philospphy, I think you would need to list the "critical" filesystems in /etc/fstab. You could do that by specifying the filesystem type "zfs" and the ZFS path as device node, e.g., for a sysvol pool with "usr" filesystem: system/usr /usr zfs rw 0 0 Otherwise I think you are right, ZFS filesystems mounting should occur around the same time as "mountcritlocal". I have done a test with the following /etc/rc.d/zfs script header and appears to do the trick (you don't have to list the individual ZFS mounts in /etc/fstab): # PROVIDE: mountcritlocal zfs # REQUIRE: root However, that change proved to be unnecessary (and perhaps wrong) since /etc/rc.d/FILESYSTEMS already lists zfs as a dependency and most of the scripts keep FILESYSTEMS as a requirement. You would still need to use vfs.root.mountfrom in /boot/loader.conf to start from a ZFS filesystem root. > > This dependancy issue is an interesting one. I assume that the fstab code > make sure that filesystems are mounted in a sane order ... or maybe it's > just the order in the file itself --- I've never had a problem, so I don't > know. However, having this information in two places poses the immediate > problem... one person might have a ufs /usr and a zfs /usr/ports and > another > might have a zfs /usr and a ufs or nfs /usr/home. Calling zfs mount -a > either before or after mountcritlocal isn't going to make everyone happy. > Maybe it needs to be called both times? I dunno. I dunno if zfs can fail > gracefully when things it needs arn't mounted yet. > I guess FreeBSD philosophy (and Un*x in general) is to keep all filesystems to be mounted in /etc/fstab -- this way the order would be quite clear. Since this occurs in [/etc/rc.d/]mountcritlocal and mountcritlocal is listed as a requirement in /etc/rc.d/zfs, then you can rest assured that "zfs mount -a" will occur after mounting stuff in /etc/fstab. If you need to have an exception then forcibly mount it early in /etc/fstab (I guess you should do that anyway for important mountpoints like /usr and /var). [...] > > 2. Dependencies of /etc/rc.d/zfs need rethinking Check proposed patch in above quoted PR. Let me know if you have comments on that. Thank you, Adrian Penisoara ROFUG / EnterpriseBSD