# Root on ZFS



## gkontos (Dec 10, 2009)

Hi everyone,

I have been experimenting lately with ZFS boot on FreeBSD. I have performed different kind of methods and I've reached to the conclusion that using the "vfs.root.mountfrom" method instead of traditional fstab mounts is more flexible. However, when I try to perform an installation using this guide my system boots and doesn't mount /usr /var /tmp patitions

I can only boot to single user mode with readonly ZFS /

I suspect that it has something to do with:

```
'vfs.root.mountfrom="zfs:zroot"'
```
maybe it should be ?

```
'vfs.root.mountfrom="zfs:zroot/root"'
```
From the Fixit environment I can see all the mount points

Please some help!!!


----------



## graudeejs (Dec 10, 2009)

as i understand zpool name is zroot?
then you set 

```
vfs.root.mountfrom="zfs:zroot/root
```

about /usr and /var if you fallow my zfs tips.... and

```
zfs set mountpoint=none zpool
```
set zpool root mountpoint to none, that every new zfs filesystem in zpools root will have none mountpoint....
for this you need to 
	
	



```
# zfs set mountpoint=/usr zroot/usr
```

note, that if now create zroot/usr/local, you don't need to set mountpoint for local. it will be mounted under usr


----------



## gkontos (Dec 11, 2009)

Sorry I forgot to insert the link for the guide!

So, instead of:

```
Fixit# zfs set mountpoint=legacy zroot
```
it should be

```
Fixit# zfs set mountpoint=none zroot
```

I will try it this evening!


----------



## graudeejs (Dec 11, 2009)

ah, *zfs set mountpoint=legacy* should be set for *zroot/root*

sorry I forgot


----------



## jem (Dec 11, 2009)

gkontos said:
			
		

> my system boots and doesn't mount /usr /var /tmp patitions



Your root ZFS is mounted by the kernel according to the vfs.root.mountfrom="zfs:<zpool>/<rootzfs>" setting in /boot/loader.conf.  You may also need to set the 'bootfs' property for your root pool.

Mounting the rest of your ZFS filesystems is done by /etc/rc.d/zfs, and requires 'zfs_enable="YES"' in rc.conf.


----------



## gkontos (Dec 11, 2009)

jem said:
			
		

> Your root ZFS is mounted by the kernel according to the vfs.root.mountfrom="zfs:<zpool>/<rootzfs>" setting in /boot/loader.conf.  You may also need to set the 'bootfs' property for your root pool.
> 
> Mounting the rest of your ZFS filesystems is done by /etc/rc.d/zfs, and requires 'zfs_enable="YES"' in rc.conf.



In all of my tests I have it enabled in rc.conf

Thanks, I will try the:

```
vfs.root.mountfrom="zfs:<zpool>/<rootzfs>"
```
And let you all know


----------



## jem (Dec 11, 2009)

Just to clarify, 'vfs.root.mountfrom' is specifying the path of the ZFS that contains your root filesystem.

On my system, my ZFS's are organised as follows (I'm copying the default OpenSolaris filesystem layout):


```
[jason@saturn ~]$ zpool get all rpool
NAME                             USED  AVAIL  REFER  MOUNTPOINT
rpool                           10.9G   576G    21K  /rpool
rpool/ROOT                      2.31G   576G    20K  legacy
rpool/ROOT/freebsd              2.31G   576G  2.17G  /
rpool/ROOT/freebsd@install      96.5M      -  1.24G  -
rpool/ROOT/freebsd@8.0-RELEASE  31.6M      -  1.38G  -
rpool/export                     626M   576G   626M  /export
rpool/home                       292K   576G    19K  /home
rpool/home/jason                 274K   576G   274K  /home/jason
rpool/swap                         8G   584G    16K  -
tank                             107G  3.90T  31.4K  /tank
```

(Note I don't have seperate ZFS's for /usr, /var etc.)

So I have the following set in /boot/loader.conf:

```
vfs.root.mountfrom="zfs:rpool/ROOT/freebsd"
```

And, I also have:


```
[jason@saturn ~]$ zpool get bootfs rpool
NAME   PROPERTY  VALUE               SOURCE
rpool  bootfs    rpool/ROOT/freebsd  local
```


----------



## gkontos (Dec 12, 2009)

Solved! I suspected there was something wrong but not:

```
vfs.root.mountfrom="zfs:zroot"
```



> Just to clarify, 'vfs.root.mountfrom' is specifying the path of the ZFS that contains your root filesystem


Got me thinking that my path was correct so what solved the issue was to:

```
zpool set bootfs=zroot zroot
```
in the end after:

```
Fixit# zfs set mountpoint=legacy zroot
Fixit# zfs set mountpoint=/tmp zroot/tmp
Fixit# zfs set mountpoint=/usr zroot/usr
Fixit# zfs set mountpoint=/var zroot/var
```
and not after creating the pool!

Thank you all for your responses!


----------

