# ZFS boot on FreeBSD 9.2



## spanglefox (Oct 18, 2013)

Hi,

I recently performed a root install of FreeBSD using ZFS. When I boot the machine it takes 10 -15 seconds after the initial kernel load:

```
Copyright (c) 1992-2012 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21 20:30:17 UTC 2013
    root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386
```

To follow through with the rest of the kernel loading\detections. I followed the instructions to be found here ZFS on Root

I understand that ZFS probes devices on boot to determine the pool structure and had assumed that the 9.2 version creates a ZFS cachefile. It looks like it does not however. Would I be right in thinking the pause in boot would be the device probe?

I did try to set a cachefile to see if it made a difference using `zfs set cachefile=/boot/zfs/zpool.cache` but when I examined `zfs get all zroot` it did not appear in there.

Am I missing a trick somewhere as booting via UFS is extremely fast in comparison?


----------



## SirDice (Oct 18, 2013)

Try exporting and importing the pool. That should create the cache file.


----------



## spanglefox (Oct 18, 2013)

Hi,

Many thanks. Sadly the export did not work even with the -f option. It replied 
	
	



```
cannot unmount '/': Invalid Argument
```

I did try booting to live CD, `kldload zfs` and seeing if I could export/import that way. It responded that there were no ZFS pools. 

The machine has a single disk and the ZFS actually resides on a partition. I saw in the zpool manual page that export should be given to whole disks. Is that the nub of the problem?

After reading the an OpenSolaris manual I'm going to try destroying the ZFS pool and then reimport using  `zpool import -Df`. Luckily the machine is a test machine and destroying anything is not so much of a concern.

I tried reinstalling the OS and when I issued the command `zfs set cachefile=/boot/zfs/zpool.cache zroot` it responds that cachefile is an invalid property. In addition I ran a `zfs get all | grep cachefile` and no results. The `zfs get all` can be found here.


----------



## kpa (Oct 18, 2013)

The cachefile property is a property of the pool and is set with the zpool(8) command.


----------



## spanglefox (Oct 18, 2013)

Sorry, yes typo here. The command issued to the machine was actually `zpool`


----------



## spanglefox (Oct 23, 2013)

Well I am a little further on. I have managed to change the install routine to generate a zpool.cache file in /var/tmp/ which then gets copied to an alternatively mounted zroot on /mnt/zroot/boot/zfs/zpool.cache. I have `cat`'d the file to see that it is not just a blank. I use `zpool cachefile=/boot/zfs/zpool.cache zroot` before and after boot.

Still the `zfs get all` shows a blank (-) for the cachefile and that the policy is set as default rather than local.

In addition during the install the zpool is created as a reference, exported then imported explicitly setting the cachefile property.


----------

