10

On FreeBSD 10.0, when one creates zfs partitions and configures where they are mounted (permissions, etc.), where is this information stored? /etc/fstab is largely empty.

i.e.:

$ zfs mount
zpool0/ROOT/default             /
zpool0/home                     /home
zpool0/tmp                      /tmp
zpool0/usr                      /usr
zpool0/usr/local                /usr/local
zpool0/usr/obj                  /usr/obj
zpool0/usr/ports                /usr/ports
zpool0/usr/ports/distfiles      /usr/ports/distfiles
zpool0/usr/ports/packages       /usr/ports/packages
zpool0/usr/src                  /usr/src
zpool0/var                      /var
zpool0/var/crash                /var/crash
zpool0/var/db                   /var/db
zpool0/var/db/pkg               /var/db/pkg
zpool0/var/empty                /var/empty
zpool0/var/log                  /var/log
zpool0/var/mail                 /var/mail
zpool0/var/run                  /var/run
zpool0/var/tmp                  /var/tmp

I have grepped thru /etc and /var for strings found above and I am not getting any hits.

2 Answers 2

13

ZFS pool information is not stored in a plain text file. Information about a pool is stored on the disks themselves. ZFS pool information can also be written to a ZFS cache file, but it does not contain mount point information.

If you want to get mount point values for your ZFS pools you can use the following:

zfs get mountpoint <pool name>
zfs get mountpoint <pool name>/<dataset>

If you want to change mount point values you can use the zfs set command. More information about managing mount points.

Additionally, here are some other helpful commands you can use to get information about your ZFS pools:

zfs list
zpool list
zpool status

If you would like to find out where your ZFS pool cache file is you can use the following command:

zpool get cachefile <pool name>

Specifically for your case:

zpool get cachefile zpool0

If you want to read information from that file you can use the zdb command. Be careful using this command. It can be dangerous to use. More information.

A ZFS pool can be created without a cache file, so if the zpool get cachefile command doesn't show one don't panic.

Edit: I updated my answer, Michael is correct that the ZFS pool cache file doesn't contain informaiton about mount points. However, I'll still leave the information about the cache file just in case someone finds it useful.

5

As Gene points out, the list of file systems (not partitions!) in a ZFS pool is stored within the pool itself. Specifically, it is stored as a part of the pool metadata, which is not easily accessible in raw form.

You can access the metadata using zdb (the ZFS debugger tool), but you need to be careful as well as have some familiarity with the ZFS on-disk format to correctly interpret the output from some of the possible invocations of zdb. (It is, after all, a debugger.)

You can also work with it using other ZFS commands, including the subcommands of the zpool and zfs commands.

Normally when working with ZFS file systems you will just use the zfs commands, likely zfs create, zfs destroy (careful; this one really does do what it says on the tin!), zfs get and zfs set. In your specific case you will probably be most interested in the mountpoint attribute, which specifies two things:

  • If set as a path, the mount point of that ZFS file system in the overall file system hierarchy, and automatic mounting
  • If set to legacy, that the file system is mounted "manually" (using non-ZFS-aware tools) such as plain old mount (possibly through /etc/fstab) while specifying a mount point
  • If set to none, the file system cannot be mounted; this is similar to setting canmount to off

ZFS cache files are not related to this, as the cache file only contains pool information, and you are asking about filesystem information. Filesystem metadata is always stored in the pool itself.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .