8

I am trying to understand the way ZFS works when I do for example, a snapshot. When I use zfs list on machine I get some mount points and some paths. For example I get something like that:

rpool/ROOT/s10x_u10_wos_17b      5.3gb   58.2gb    5.3gb     /

I get the as a mount point the root /.

My first thought was that there is the actual file and when I navigated to the /rpool directory there was no ROOT directory. After some thinking I saw that /rpool/ROOT is actually mounted on legacy so that must be somewhere else.

Could someone explain where the files are when it is mounted on legacy and maybe why this legacy mode is used?

Jens Erat
  • 18,485
  • 14
  • 68
  • 80

2 Answers2

10

I do not understand the purpose of legacy mount point.

ZFS provides a hierarchical structure of datasets within a pool. In your case you have a pool named rpool, and at least the following datasets:

  • rpool
  • rpool/ROOT
  • rpool/ROOT/s10x_u10_wos_17b

Each of these datasets is often a filesystem (though it can be a volume / block device instead).

Just as each of these is datasets is likely a full / independent filesystem, each can also be mounted or not mounted independently.

By default, ZFS will mount children datasets at their logical location within the parent... If the rpool dataset is mounted at /rpool (i.e: default), then you would find that the rpool/ROOT dataset mounted at /rpool/ROOT, etc...

This is controlled by the mountpoint property - run zfs get -rt filesystem mountpoint to see its current value for each dataset.

  • If the value is a path, then ZFS will automatically mount the dataset at that path when the pool is imported. The default (as mentioned above) is to mount the filesystem under the parent.
  • If the value is none, then ZFS will not mount the filesystem, and the filesystem cannot be mounted using mount either.
  • If the value is legacy, then ZFS will not mount the filesystem, but you can use mount and umount to manage the filesystem's mountpoint manually. You could also use /etc/fstab to guide automatic mounting.

In your situation, the rpool/ROOT/s10x_u10_wos_17b dataset is mounted at / (i.e: it is your root filesystem). To achieve this, you could either set mountpoint=/ and let ZFS handle things, or set mountpoint=legacy and mount it explicitly.

As this is your root filesystem, letting ZFS manage it for you isn't really an option, and you'll need to specify the mountpoint explicitly.

Therefore, rpool/ROOT/s10x_u10_wos_17b has mountpoint=legacy.

Attie
  • 20,734
3

Legacy mountpoint is usually used when the filesystems are mounted using fstab.

From FreeBSD manual page:

If needed, ZFS file systems can also be managed with traditional tools (mount(8), umount(8), fstab(5)). 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.