# ZFS multiple mountpoints



## honza801 (Feb 16, 2012)

Hi,

is it possible to set multiple mountpoints for one ZFS file system?
For example following config:


```
# zfs list
NAME               USED  AVAIL  REFER  MOUNTPOINT
zpool              219K  97.9G    32K  /zpool
zpool/jail          63K  97.9G    32K  /jail
zpool/jail/mach1    31K  97.9G    31K  /jail/mach1
zpool/ports         31K  97.9G    31K  /zpool/ports
```

And I want to mount zpool/ports to /usr/ports and /jail/mach1/usr/ports.

Any hints?
Thanks
Fous


----------



## SirDice (Feb 16, 2012)

honza801 said:
			
		

> is it possible to set multiple mountpoints for one ZFS file system?


No.



> And I want to mount zpool/ports to /usr/ports and /jail/mach1/usr/ports.



Use nullfs(5):

`# zfs set mountpoint=/usr/ports zpool/ports`
`# mount -t nullfs /usr/ports /jail/mach1/usr/ports`

Or in fstab:

```
/usr/ports   /jail/mach1/usr/ports  nullfs  rw      0       0
```

Make it really funky by adding it to /etc/fstab.mach1 and use:

```
jail_mach1_mount_enable="YES"
```

Then it'll be mounted when the jail starts and unmount when it stops.


----------



## honza801 (Feb 16, 2012)

Thanks,

I know about mount_nullfs, but I want ZFS to do it for me. 
Is there some other ZFS feature?


----------



## gkontos (Feb 16, 2012)

honza801 said:
			
		

> Thanks,
> 
> I know about mount_nullfs, but I want ZFS to do it for me.
> Is there some other ZFS feature?



I think SirDice gave you an exact answer to your question.

If you want to know more about ZFS features have a look at Oracle's documentation:

http://docs.oracle.com/cd/E19963-01/html/821-1448/toc.html


----------



## honza801 (Feb 22, 2012)

True, thanks.


----------

