From owner-freebsd-fs@FreeBSD.ORG Mon Jan 23 22:39:12 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BD8C106564A for ; Mon, 23 Jan 2012 22:39:12 +0000 (UTC) (envelope-from andrnils@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id AC84D8FC13 for ; Mon, 23 Jan 2012 22:39:11 +0000 (UTC) Received: by bkbc12 with SMTP id c12so3803321bkb.13 for ; Mon, 23 Jan 2012 14:39:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SOZ/Ocxge01/cqnFa+AJoA9FrnI2KvyJ4WUoiJITkQE=; b=f+0yEg4cdmkeHH8m4o/n14LPKxGgKa8jgc4wDY//FUhDzm9yFYDItJXQUZVsLIGrLb bkLyszFUk1mhbVSfrAQ75gvsL98XpluEAv6ud/ugD2ekOMP4EFxNJ2n7Qm//BSY3XF6C P30PaEwTEO5Bm1ECJcnNfgoQW44qegIjnXW5Q= MIME-Version: 1.0 Received: by 10.204.129.208 with SMTP id p16mr3993973bks.131.1327358350475; Mon, 23 Jan 2012 14:39:10 -0800 (PST) Received: by 10.204.40.74 with HTTP; Mon, 23 Jan 2012 14:39:10 -0800 (PST) In-Reply-To: <20120123224717.55de7481@dijkstra> References: <20120123224717.55de7481@dijkstra> Date: Mon, 23 Jan 2012 23:39:10 +0100 Message-ID: From: Andreas Nilsson To: "Christopher J. Ruwe" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-fs@freebsd.org Subject: Re: Booting from zfs snapshot X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 22:39:12 -0000 On Mon, Jan 23, 2012 at 10:47 PM, Christopher J. Ruwe wrote: > On Mon, 23 Jan 2012 14:42:19 +0100 > Andreas Nilsson wrote: > > > On Mon, Jan 23, 2012 at 1:58 PM, Johannes Totz > > wrote: > > > > > On 22/01/2012 20:15, Andreas Nilsson wrote: > > > > > >> On Sun, Jan 22, 2012 at 1:25 PM, Johannes Totz > > >> wrote: > > >> > > >> On 19/01/2012 16:26, Andreas Nilsson wrote: > > >>> > > >>> Hello, > > >>>> > > >>>> I'm trying to wrap my head around the process of booting from a > > >>>> zfs snapshot. I have hit a few roadblocks, which I hope this is > > >>>> the adequate list to post to regarding those. > > >>>> > > >>>> A short note on what I'm trying to achieve might be in order. In > > >>>> short: a > > >>>> nanobsd system on zfs only. I want to boot from a snapshot so > > >>>> that when I > > >>>> push out an upgrade with zfs send, I want the root filesystem to > > >>>> remain unchanged. > > >>>> > > >>>> The problems I've hit so far: > > >>>> *1 Making the zpool.cache file available > > >>>> *2 Having / mount via entry in fstab. > > >>>> > > >>>> > > >>> FWIW, I dont use any fstab for my zfs-only machine. Works > > >>> perfectly fine with mountpoint property. > > >>> > > >> > > >> > > >> It was just a small hope that the boot would continue with the > > >> filesystem pointed out by the bootfs property. I'm setting > > >> vfs.root.mountfrom in loader.conf now. > > >> > > >> > > >> > > >>> > > >>> *1: The zpool.cache is needed to autoimport a pool as I > > >>> understand it. Is > > >>> > > >>>> there a way to force the kernel to import a pool during bootup > > >>>> even though > > >>>> no zpool.cache is around? What does this file actually contain? > > >>>> > > >>>> I made an experiment and booted a disk with zfs root from > > >>>> machine a in machine b and that worked. I did partition the disk > > >>>> with gpart using a gpt > > >>>> scheme, and labeled the partition on which the pool resides as > > >>>> os, and upon > > >>>> creation of the zpool used gpt/os as device. Does this mean that > > >>>> as long as > > >>>> gpt/os is available, any machine boot this disk will have the > > >>>> zpool autoimported? > > >>>> > > >>>> > > >>> Not quite sure I understand you here. Just a note: booting kernel > > >>> and mounting root fs are two different things. the *zfsloader > > >>> will happily load > > >>> the kernel off a pool and boot it but mounting root might fail > > >>> later (I guess if no cachefile is present?). > > >>> > > >>> Sorry for being unclear. What I experience is exactly what you're > > >> describing: gptzfsloader loads the kernel and runs it just fine, > > >> but mounting root fails due to missing zpool.cache. > > >> > > >> I'm looking for a way to have the pool imported without the > > >> zpool.cache > > >> > > >> > > >> > > >>> > > >>> *2: Having a line like > > >>>> tank/root/8.2-RELEASE-p5@ro / zfs ro 0 0 > > >>>> in fstab causes mount to throw an error and leave me in single > > >>>> user mode, > > >>>> when the system is booted however mount can mount a zfs snapshot > > >>>> just fine. > > >>>> Setting vfs.root.mountfrom in loader.conf works just fine though. > > >>>> > > >>>> > > >>> The above I still think is rather strange: setting > > >>> vfs.root.mountfrom > > >> to a > > >> snapshot ( given that the snapshot has the zpool.cache file) > > >> works, but not > > >> having the corresponding line in fstab. > > >> > > >> > > >>> > > >>> -- > > >>> Sent from my > > >>> > > >>> > > >> What I'm seeking a solution to is this: Boot several machines from > > >> one zfs snapshot. Since the stream from zfs send is also used to > > >> do the initial install there is no easy way to get the correct > > >> zpool.cache file in the snapshot. I guess one possible way to > > >> tackle this problem is to modify zpool so that all pools get > > >> created with the same id. > > >> > > > > > > There's a way to pre-load a zpool.cache via the loader (from an > > > alternative location). Can't remember the correct variables to set > > > right now... > > > > > > As for w/o any cache file... no idea. > > > > > > Ok, I'll research that. If it could be loaded from another > > > disk/partition > > I could really use it :) > > > > It is of course possible to edit the cachefile property of the > > zpool, but I think one can only set it to something relative the > > dataset from which one boots. > > > > Regards > > Andreas > > _______________________________________________ > > freebsd-fs@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-fs > > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org" > > > Just a curious question: Will what you are trying to implement be > similar to Solaris boot environments/beadm? > Yes and no. I want my systems read-only, whereas solaris has root rw. And the bootenv is not really a snapshot, but a zfs clone of a snapshot ( ie writable ), which is not what I'm after. > > In short, Solaris boot environments are similar to what you described > (booting of snapshots) and are used to facilitate maintainance, > cf. > http://www.c0t0d0s0.org/archives/4372-New-features-of-Solaris-Alternate-boot-environments-based-on-snapshots.html > . > If so, maybe you can salvage code from there (or Illumos)? > > For general purpose fbsd setup, that is how I try to run the system. I actually did when I had fbsd on my laptop. I did start trying to port/implement it, which I thought would be easy since it is python-based, but I had more pressing issues so "doing it by hand" had to do. > Cheers, > -- > Christopher J. Ruwe > TZ GMT + 1 > > Cheers Andreas