Is it ok if I reference this howto in a guide I'm currently writing? I'm not going to follow it exactly, but the ZFS setup is heavily inspired by this guide.
vermaden said:
zfs list
:NAME USED AVAIL REFER MOUNTPOINT
zroot 5.26G 14.3G 4.23G /
zroot/swap 1.03G 15.3G 108K -
mount
:zroot on / (zfs, local, noatime, nfsv4acls)
devfs on /dev (devfs, local, multilabel)
# zfs snapshot zroot@beadm
# zfs create zroot/ROOT
# zfs send zroot@beadm | zfs receive zroot/ROOT/default
# zpool set bootfs=zroot/ROOT/default zroot
# reboot
vermaden said:@xy16644
Then you need to do these changes to use beadm:
Code:# zfs snapshot zroot@beadm # zfs create zroot/ROOT # zfs send zroot@beadm | zfs receive zroot/ROOT/default
Now edit /zroot/ROOT/default/boot/loader.conf and put there vfs.root.mountfrom="zfs:zroot/ROOT/default" line instead of the existing vfs.root.mountfrom one.
If it works, then the beadm command should work properly now and you can delete everything in the /zroot directory except the ROOT directory, the zroot@beadm snapshot will also not be needed anymore.Code:# zpool set bootfs=zroot/ROOT/default zroot # reboot
zfs snapshot zroot@beadm
zfs create zroot/ROOT
zfs send zroot@beadm | zfs receive zroot/ROOT/default
vfs.root.mountfrom="zfs:zroot/ROOT/default"
zpool set bootfs=zroot/ROOT/default zroot
beadm list
gives me the following (BEFORE rebooting):BE Active Mountpoint Space Created
default R /ROOT/default 4.2G 2013-04-28 20:54
Savagedlight said:Is it possible to have child data sets of the BEADM data set, and have it mount only when its parent is used?
One of many use cases for this would be to store /usr/src with compression enabled, while not sharing it between BEADM data sets, as that would make little sense.
curlew:/home/mike% zfs list -o name,compression,mountpoint -r sys/ROOT/kde4.10a sys/DATA sys/NOBACKUP
NAME COMPRESS MOUNTPOINT
sys/DATA off none
sys/DATA/home gzip /home
sys/DATA/home/camera off /home/camera
sys/DATA/home/db off /home/db
sys/DATA/home/photos off /home/photos
sys/DATA/root off /root
sys/DATA/var off none
sys/DATA/var/log on /var/log
sys/NOBACKUP off none
sys/NOBACKUP/nobackup off /nobackup
sys/NOBACKUP/usr off none
sys/NOBACKUP/usr/ports off none
sys/NOBACKUP/usr/ports/distfiles off /usr/ports/distfiles
sys/NOBACKUP/usr/ports/packages off /usr/ports/packages
sys/ROOT/kde4.10a off legacy
sys/ROOT/kde4.10a/tmp on /tmp
sys/ROOT/kde4.10a/usr on /usr
sys/ROOT/kde4.10a/usr/ports gzip-9 /usr/ports
sys/ROOT/kde4.10a/usr/src gzip-9 /usr/src
sys/ROOT/kde4.10a/var off /var
sys/ROOT/kde4.10a/var/db off /var/db
sys/ROOT/kde4.10a/var/db/pkg on /var/db/pkg
sys/ROOT/kde4.10a/var/empty off /var/empty
sys/ROOT/kde4.10a/var/mail on /var/mail
sys/ROOT/kde4.10a/var/run off /var/run
sys/ROOT/kde4.10a/var/tmp on /var/tmp
Interesting. I would have thought that sys/ROOT/kde4.10a/var and sys/ROOT/somethingelse/var would clash when both have a mountpoint of /var; Does beadm() do some "magic" to the child data sets to decide which ones are automounted?rawthey said:Yes, this is what I have:
Each BE has it's own version of /usr/src and /usr/ports. When I create a new BE I want to continue to use my existing distfiles for ports so /usr/ports/distfiles are mounted from sys/NOBACKUP which is outside the BE filesystems, as are various other directories like /home. Note that for this to work some filesystems like sys/NOBACKUP/usr and sys/NOBACKUP/usr/ports need to have their mountpoint set to none
Show me output of thexy16644 said:
zfs get -r mountpoint zroot
command. zfs get -r mountpoint zroot
NAME PROPERTY VALUE SOURCE
zroot mountpoint / local
zroot@beadm mountpoint - -
zroot/ROOT mountpoint /ROOT inherited from zroot
zroot/ROOT/default mountpoint /ROOT/default inherited from zroot
zroot/ROOT/default@beadm mountpoint - -
zroot/swap mountpoint - -
vermaden said:Try that and reboot.
# zfs set mountpoint=none zroot
# zfs set mountpoint=none zroot/ROOT
# zfs set mountpoint=legacy zroot/ROOT/default
zfs set mountpoint=none zroot
gave me
cannot unmount '/': Invalid argument
vermaden said:Do that using live USB or live CD.
xy16644 said:I'm not. FreeBSD is installed in a VM but its not a live CD/USB.
vermaden said:Try that and reboot.
# zfs set mountpoint=none zroot
# zfs set mountpoint=none zroot/ROOT
# zfs set mountpoint=legacy zroot/ROOT/default
If a file system's mount point is set to legacy, ZFS makes no attempt to manage the file system, and the administrator is responsible for mounting and unmounting the file system.
# zpool set bootfs=sys/ROOT/default sys
implies to ignore the mountpoint option.Dies_Irae said:In section "3.1. Server with Two Disks" you created an empty fstab and set the mountpoint of the root filesystem to legacy
The only things needed areDies_Irae said:I expect to have to insert a line in fstab for the root filesystem, but apparently this is not needed.
zfs_enable=YES
zfs_load=YES
Yep.Dies_Irae said:It seems that# zpool set bootfs=sys/ROOT/default sys
implies to ignore the mountpoint option.
Generally the option 'legacy' is just the option that I used for the first time for Boot Environments to distinguish the Boot Environment from other ZFS datasets, it has no other function.Dies_Irae said:So how does this work?
vermaden said:The / has to be mounted anyway, so that property is not important here.
(...)
Generally the option 'legacy' is just the option that I used for the first time for Boot Environments to distinguish the Boot Environment from other ZFS datasets, it has no other function.
xy16644 said:Runningzfs set mountpoint=none zroot
gave meCode:cannot unmount '/': Invalid argument
The second and third command ran fine. When I rebooted after running the commands I get the same error as described in my previous post. Any other ideas?
Thanks for your help!
zfs send/receive
command over ssh I got the same error:
cannot unmount '/': Invalid argument
cannot umount "operation not permitted"
Cmnd_Alias ZFS = /sbin/zfs
john ALL = NOPASSWD: ZFS
zfs send/receive
command was:zfs send -R tank/ROOT@2013-06-01 | ssh john@10.0.0.127 sudo zfs recv -Fduv tank
zpool create -f -o cachefile=/tmp/zpool.cache sys /dev/gpt/sys0
zpool create -f -o cachefile=/tmp/zpool.cache local /dev/gpt/local0.eli
cp /tmp/zpool.cache /mnt/boot/zfs/
vermaden said:@overmind,
You were probably hit by that BUG in 9.1-RELEASE:
http://lists.freebsd.org/pipermail/freebsd-bugs/2012-May/048757.html
Its fixed in STABLE, but not in RELEASE, well 8.4-RELEASE also has it fixed.