10.1 ZFS - why canmount=off for /usr and /var by default?

Ben Woods woodsb02 at gmail.com
Sun Feb 15 05:58:10 UTC 2015


To quote Allan Jude when I posed this question to him:

"The /usr dataset has 'canmount' set to off. It only exists so that other
datasets can be created under it.

The idea here is that you want /usr/bin and /usr/local etc to be included
in the / dataset, as that is the one used for boot environments.

To use boot environments, you need to install the tool from the ports tree:
sysutils/beadm-devel

We'll discuss this more on the [bsdnow.tv] show, and maybe do a tutorial
sometime soonish."

In summary, the /usr and /var datasets will not actually have any files
stored in them. Any sub-datasets that ARE mounted will have the files in
them, and other files that sit under /usr or /var which are not in a
sub-dataset will actually be stored in the zroot/ROOT/default dataset (and
available for boot environments).


--
From: Benjamin Woods
woodsb02 at gmail.com

On 15 February 2015 at 11:53, John Goerzen <jgoerzen at complete.org> wrote:
>
> So this is a fresh 10.1-RELEASE install, with the guided/automatic ZFS
> setup on a single hard disk.  Couldn't be simpler, right?  Except
> something is odd with /usr and /var.  Consider:
>
> # zfs list | egrep 'NAME|usr'
> NAME                 USED  AVAIL  REFER  MOUNTPOINT
> zroot/usr            607M   216G    96K  /usr
> zroot/usr/home       180K   216G   180K  /usr/home
> zroot/usr/ports      607M   216G   607M  /usr/ports
> zroot/usr/src         96K   216G    96K  /usr/src
>
> Now, I've installed 5GB of packages into /usr/local.  There's no way
> /usr is only using 607M.  So I thought, hmm, maybe they're not being
> mounted.  And indeed:
>
> # zfs list -o name,mountpoint,canmount,mounted | egrep 'NAME|no'
> NAME                MOUNTPOINT  CANMOUNT  MOUNTED
> zroot               none              on       no
> zroot/ROOT          none              on       no
> zroot/usr           /usr             off       no
> zroot/var           /var             off       no
>
> And, of course:
>
> # df -h /usr/local
> Filesystem            Size    Used   Avail Capacity  Mounted on
> zroot/ROOT/default    220G    4.5G    216G     2%    /
>
> (I have compress=lz4 set for everything)
>
> So, the next question is: why?  Why is there a /usr and a /var, which
> show up in zfs list with a mountpoint of /usr and /var, but which aren't
> being mounted?  Why is canmount=off for these?  And if canmount=off, why
> give it a mountpoint which looks rather misleading in a zfs list?
>
> I promise to stop asking questions soon! :-)
>
> Thanks,
>
> John
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list