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 big, honkin’ pool can be created (multi volume mirror or raidz or a SAN lun, whatever) 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.

One Response to “ZFS: Set or change the mount point of a filesystem”

  1. November 18, 2010 at 12:04 am, Nikkkor said:

    Thanks it was very helpful for me :)

    Reply

Leave a Reply

You may also like-

ZFS: Create a new filesystem from an existing poolA previous recipe showed the command to create a ZFS pool using zpool. While this created a mounted filesystem, the fun doesn't stop there. ...