Solved What are the advantages/disadvantages of rooted ZFS

Hello everybody.

Is there anybody here who can explain to me what the advantages of rooted ZFS are?

And also what the advantages/disadvantages of rooted ZFS vs UFS with ZFS installed on it are?

Furthermore I would like to know if there is a good manual or book how to work with rooted ZFS (on FreeBSD if possible).
I ask this because I can not create/rollback a snapshot of for instance the (rooted) usr map, though ZFS is working as it should and can I create/rollback with any other pool I created. But I can not find the reason for this anywhere. Or maybe I don't understand what has been written about rooted ZFS completely as I am a newbie.

Your help would be appreciated very much.
 
You can snapshot but cannot rollback (in complete safety) a snapshot of a root filesystem (including /usr, /var). You need a reboot after such a rollback.
The default root on ZFS install creates zroot/ROOT/your_actual_root_instance but leaves several filesystems (/usr, /var, /tmp) outside of your root environment.
One may want to tweak the default ZFS layout by zfs rename zroot/usr zroot/ROOT/yourinstance/usr (/var, /tmp) and set the proper ZFS mountpoints. This should be done running a live CD. I use FreeNAS on USB for this purpose.
A useful tool is beadm after you have a proper ZFS layout.
 
The default root on ZFS install creates zroot/ROOT/your_actual_root_instance but leaves several filesystems (/usr, /var, /tmp) outside of your root environment.

Does it actually do that? The whole point of the zroot/ROOT/your_actual_root_instance filesystem is that it should be a full self contained base system that includes the /usr and /var directories either directly or as child filesystems (zroot/ROOT/your_actual_root_instance/usr etc.).
 
You can snapshot but cannot rollback (in complete safety) a snapshot of a root filesystem (including /usr, /var). You need a reboot after such a rollback.
The default root on ZFS install creates zroot/ROOT/your_actual_root_instance but leaves several filesystems (/usr, /var, /tmp) outside of your root environment.
One may want to tweak the default ZFS layout by zfs rename zroot/usr zroot/ROOT/yourinstance/usr (/var, /tmp) and set the proper ZFS mountpoints. This should be done running a live CD. I use FreeNAS on USB for this purpose.

I believe the comment of kpa is right
Does it actually do that? The whole point of the zroot/ROOT/your_actual_root_instance filesystem is that it should be a full self contained base system that includes the /usr and /var directories either directly or as child filesystems (zroot/ROOT/your_actual_root_instance/usr etc.).

This is my zfs list immediately after the installation of FreeBSD 10.0
Code:
zroot               2.65G   927G   148K  none
zroot/ROOT          1.49G   927G   144K  none
zroot/ROOT/default   220K   927G  1.49G  /
zroot/ROOT/upgrade  1.49G   927G  1.49G  /
zroot/tmp            276K   927G   276K  /tmp
zroot/usr            813M   927G   144K  /usr
zroot/usr/home       196K   927G   196K  /usr/home
zroot/usr/ports      813M   927G   813M  /usr/ports
zroot/usr/src        144K   927G   144K  /usr/src
zroot/var            376M   927G   374M  /var
zroot/var/crash      148K   927G   148K  /var/crash
zroot/var/log        748K   927G   748K  /var/log
zroot/var/mail       216K   927G   216K  /var/mail
zroot/var/tmp        200K   927G   200K  /var/tmp

Is it maybe different in FreeNAS?

A useful tool is beadm after you have a proper ZFS layout.

I still could not get rollback working, but I suppose that will be a lot easier with beadm. What a great tool. Thanks a lot for your tip about beadm
I hope I also can get rollback working according to your advice with beadm

Thanks.
 
My experience was with FreeBSD 9. They may have fixed the ZFS layout at some point. I'm glad if they did that. My "fixed" layout looks like
Code:
tank1/ROOT/trueos10 307G 93.5G 4.33G legacy
tank1/ROOT/trueos10/tmp 3.59M 93.5G 2.19M /tmp
tank1/ROOT/trueos10/usr 299G 93.5G 144K /mnt/usr
tank1/ROOT/trueos10/usr/home 10.2G 93.5G 836M /usr/home
tank1/ROOT/trueos10/usr/home/youruser 9.30G 93.5G 8.18G /usr/home/youruser
tank1/ROOT/trueos10/usr/jails 286G 93.5G 292K /usr/jails
tank1/ROOT/trueos10/usr/jails/www 16.3G 93.5G 4.00G /usr/jails/www
tank1/ROOT/trueos10/usr/obj 152K 93.5G 144K /usr/obj
tank1/ROOT/trueos10/usr/ports 2.34G 93.5G 848M /usr/ports
tank1/ROOT/trueos10/usr/ports/distfiles 22.5M 93.5G 22.3M /usr/ports/distfiles
tank1/ROOT/trueos10/usr/src 152K 93.5G 144K /usr/src
tank1/ROOT/trueos10/var 24.7M 93.5G 144K /mnt/var
tank1/ROOT/trueos10/var/audit 168K 93.5G 160K /var/audit
tank1/ROOT/trueos10/var/log 23.8M 93.5G 22.2M /var/log
tank1/ROOT/trueos10/var/tmp 528K 93.5G 220K /var/tmp
You'll get the beadm working once you get a layout similar to mine.
The main advantage of root on ZFS for me is that I never get a corrupted filsystem between reboots.
 
You'll get the beadm working once you get a layout similar to mine.
I don't understand what you mean? I already got beadm working with my layout as shown above. Or do you mean rollback because I still could not get that working yet?
 
beadm actions only on what's beneath zroot/ROOT/yourroot
Any modifications to you userland (/usr(/local)) are not dealt with this tool, unless they are under /zroot/ROOT/yourroot/usr.
 
As you can see, your /usr is not a ZFS under zroot/ROOT/default
Therefore it will not be snapshotted/rolledback by beadm
Move (by zfs renaming it) such as zfs rename zroot/usr zroot/ROOT/default/usr ..var,eventually /tmp under zroot/ROOT/default. Test this on a non-production (virtual) system before trying it on your real machine.
I really don't need my fridge full of your meat ;-)
I believe the comment of kpa is right


This is my zfs list immediately after the installation of FreeBSD 10.0
Code:
zroot               2.65G   927G   148K  none
zroot/ROOT          1.49G   927G   144K  none
zroot/ROOT/default   220K   927G  1.49G  /
zroot/ROOT/upgrade  1.49G   927G  1.49G  /
zroot/tmp            276K   927G   276K  /tmp
zroot/usr            813M   927G   144K  /usr
zroot/usr/home       196K   927G   196K  /usr/home
zroot/usr/ports      813M   927G   813M  /usr/ports
zroot/usr/src        144K   927G   144K  /usr/src
zroot/var            376M   927G   374M  /var
zroot/var/crash      148K   927G   148K  /var/crash
zroot/var/log        748K   927G   748K  /var/log
zroot/var/mail       216K   927G   216K  /var/mail
zroot/var/tmp        200K   927G   200K  /var/tmp

Is it maybe different in FreeNAS?



I still could not get rollback working, but I suppose that will be a lot easier with beadm. What a great tool. Thanks a lot for your tip about beadm
I hope I also can get rollback working according to your advice with beadm

Thanks.
Your
 
beadm actions only on what's beneath zroot/ROOT/yourroot
Any modifications to you userland (/usr(/local)) are not dealt with this tool, unless they are under /zroot/ROOT/yourroot/usr.
OK, I understand what you say. But beside beadm I still don't understand (completely) what rooted ZFS is doing. I made a snaphot with zfs snapshot -r zroot@snap1 with this as the result
Code:
zroot@snap1                                 0      -   148K  -
zroot/ROOT@snap1                            0      -   144K  -
zroot/ROOT/default@snap1                    0      -  1.49G  -
zroot/ROOT/upgrade@2014-12-21-19:40:20   600K      -  1.49G  -
zroot/ROOT/upgrade@snap1                    0      -  1.49G  -
zroot/tmp@snap1                             0      -   300K  -
zroot/usr@snap1                             0      -   148K  -
zroot/usr/home@snap1                        0      -   196K  -
zroot/usr/ports@snap1                       0      -   813M  -
zroot/usr/src@snap1                         0      -   144K  -
zroot/var@snap1                             0      -   374M  -
zroot/var/crash@snap1                       0      -   148K  -
zroot/var/log@snap1                         0      -   712K  -
zroot/var/mail@snap1                        0      -   216K  -
zroot/var/tmp@snap1

but rollback does not do anything, also not after a reboot.
But I have had it for today. Tomorrow I will try to understand what must be done

Thanks anyway
 
You have to create a script or manually rollback each of
Code:
zroot@snap1
zroot/ROOT@snap1  
zroot/ROOT/default@snap1
zroot/ROOT/upgrade@snap1  
zroot/tmp@snap1  #not really necessary to roll back
zroot/usr@snap1
zroot/usr/home@snap1 #not really necessary to roll back
zroot/usr/ports@snap1
zroot/usr/src@snap1
zroot/var@snap1
zroot/var/crash@snap1  
zroot/var/log@snap1
zroot/var/mail@snap1  
zroot/var/tmp@snap1 #not really necessary to roll back
the zfs rollback -r zroot@snap rolls back only the zroot filesystem. The -r switch does not mean recursive...
 
You have to create a script or manually rollback each of ..........
the zfs rollback -r zroot@snap rolls back only the zroot filesystem. The -r switch does not mean recursive...
Hello HarryE

I believe my problem is much more fundamental as I can't create a snapshot of zroot/usr at all because zroot/usr is not mounted. And ofcourse, if I can't create a snapshot, I also can't do rollback

But I really need a snapshot of zroot/usr because when I get, for example, problems with (an upgrade of) any of my installed user software, I just can do a rollback to return to the situation before the problem originated. This is one of the most important reasons why I started using ZFS.

So the core of my problem is that I only have one zpool which is called "zroot" that is generated by FreeBSD on my rooted ZFS FreeBSD installation on a single disk.

My disk layout is as follows gpart show
Code:
[NOPARSE]=>        34  2047999933  vtbd0  GPT  (977G)
          34        1024      1  freebsd-boot  (512K)
        1058    67108864      2  freebsd-swap  (32G)
    67109922  1980890045      3  freebsd-zfs  (945G)
[/NOPARSE]

Thus it is not possible to create another pool. Which means I have to create and work with datasets like zroot/usr in order to achieve the above.

But as I will show underneath, it seems to be impossible to create a snapshot of zroot/usr.

This is what happens:

First I will display all datasets in my system after a clean install: zfs list
Code:
[NOPARSE]NAME                 USED  AVAIL  REFER  MOUNTPOINT
zroot               2.65G   927G   148K  none
zroot/ROOT          1.49G   927G   144K  none
zroot/ROOT/default  1.49G   927G  1.49G  /
zroot/tmp            264K   927G   264K  /tmp
zroot/usr            813M   927G   144K  /usr
zroot/usr/home       196K   927G   196K  /usr/home
zroot/usr/ports      813M   927G   813M  /usr/ports
zroot/usr/src        144K   927G   144K  /usr/src
zroot/var            375M   927G   374M  /var
zroot/var/crash      148K   927G   148K  /var/crash
zroot/var/log        748K   927G   748K  /var/log
zroot/var/mail       216K   927G   216K  /var/mail
zroot/var/tmp        200K   927G   200K  /var/tmp
[/NOPARSE]

then: zfs mount
Code:
[NOPARSE]zroot/ROOT/default              /
zroot/tmp                       /tmp
zroot/usr/home                  /usr/home
zroot/usr/ports                 /usr/ports
zroot/usr/src                   /usr/src
zroot/var                       /var
zroot/var/crash                 /var/crash
zroot/var/log                   /var/log
zroot/var/mail                  /var/mail
zroot/var/tmp                   /var/tmp
[/NOPARSE]

zroot/usr seems not to be mounted: zfs get mounted zroot/usr
Code:
[NOPARSE]NAME       PROPERTY  VALUE    SOURCE
zroot/usr  mounted   no       -
[/NOPARSE]
which means: canmount=off
So now I do: zfs set canmount=on zroot/usr

see what is in /usr: ls /usr
Code:
bin    games    home    include    lib    lib32    libdata    libexec    local    obj    ports    sbin    share    src    tests

but when zroot/usr is not mounted I can not make a snapshot!
zfs snapshot -r zroot/usr/snap1
Code:
[NOPARSE]usage:
    snapshot [-r] [-o property=value] ... <filesystem@snapname|volume@snapname> ...

For the property list, run: zfs set|get

For the delegated permission list, run: zfs allow|unallow
[/NOPARSE]

When I do: zfs mount -a zroot/usr will be mounted
zfs get mounted zroot/usr
Code:
[NOPARSE]NAME       PROPERTY  VALUE    SOURCE
zroot/usr  mounted   yes      -
[/NOPARSE]

But now, when I do: ls /usr zroot/usr is completely empty and also lost the connections with all files in /usr

I really don't know what is happening that I can't make a new dataset at zroot/usr
Also I don't understand, though zroot/usr is not mounted, everything is normally working in /usr

Is there really nobody who can tell me what is going on here, or what I am doing wrong? Or went something wrong with the installation of FreeBSD??
 
Partly solved: How stupid can I be? What I wanted is that I can rollback to a point before a problem was originated.

I was trying to do this in the wrong directory. I tried to make a snapshot of
Code:
zroot/usr
But instead that can be done in
Code:
zroot/ROOT/default
zfs snapshot -r zroot/ROOT/default@snap1
Now I can anyway roll back to the complete root.

When I was trying to solve my problem because I wanted to make a rollback of a specific subdirectory, in this case
Code:
/usr
I also created a new child dataset like
Code:
zroot/ROOT/default/usr/
but this did not work either.

So I still have to find out how I can create a snapshot of a specific subdir.

But the most important thing is that I at least can make a rollback of the complete root!
 
Back
Top