Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jan 2012 12:58:34 +0000
From:      Johannes Totz <johannes@jo-t.de>
To:        freebsd-fs@freebsd.org
Subject:   Re: Booting from zfs snapshot
Message-ID:  <jfjlhq$p77$1@dough.gmane.org>
In-Reply-To: <CAPS9%2BSvtYZt1m26jCqRH6c3w_aB3hWt56ZFoYJAw_cEu2NANzg@mail.gmail.com>
References:  <CAPS9%2BSsyvw=Day%2B1XC8HmzWQG3M=GZE=Nt-qaEQiQTPYME9MrA@mail.gmail.com> <jfgv8j$82s$1@dough.gmane.org> <CAPS9%2BSvtYZt1m26jCqRH6c3w_aB3hWt56ZFoYJAw_cEu2NANzg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 22/01/2012 20:15, Andreas Nilsson wrote:
> On Sun, Jan 22, 2012 at 1:25 PM, Johannes Totz<johannes@jo-t.de>  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<insert random gadget here>
>>
>
> 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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?jfjlhq$p77$1>