ZFS: Set or Change the Mount Point of a Filesystem

Creating new ZFS filesystems may seem strange at first since they are initially mounted under their parent filesystem. This is no problem since ZFS provides a simple and powerful mechanism for setting the mount point for a filesystem.


To change the mount point of the filesystem techrx/logs to /var/logs, you must first create the mount point (just mkdir a directory) if it does not exist, and then use the zfs command:

mkdir /var/logs
zfs set mountpoint=/var/logs techrx/logs

The filesystem will be unmounted (as long as you are not currently in that filesystem) and remounted as /var/logs.

One great consequence of this design is that a huge pool can be created (multi-volume mirror or raidz or a SAN lun, etc.) and as many filesystems as you can imagine created in that pool. These filesystems can then be mounted anywhere in the system that you want.

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.