How to use union mount and does it work?

Status
Not open for further replies.

xaibex

Patron
Joined
Mar 19, 2013
Messages
340
Hello Folks,

I would like to use something like unionfs, but since unionsfs is simly not working with FreeNas/FreeBSD (as i read), I am looking for an alternative.

All I want to do is being able to add another drive(vdev) (without striping it with zfs) and see content from both drives in the same structure.

I found the mount Option -o union which seems to do exactly what i want.

from man:
union Causes the namespace at the mount point to appear as the
union of the mounted file system root and the existing
directory. Lookups will be done in the mounted file sys-
tem first. If those operations fail due to a non-exis-
tent file the underlying directory is then accessed. All
creates are done in the mounted file system.

Can someone tell me if this basically works, and how to use this mount option?

I tried to use it (mount -o union /mnt/pool/vdev/one /mnt/pool/vdev/two, but all i got was "Block device required"
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I don't think I can give much help, but vdevs aren't mountable entities--you'd need to mount a pool instead. Not sure if that will work either, but it's at least part of the problem. You'd probably also need to set the mountpoint in the ZFS options for both pools to "legacy".
 

xaibex

Patron
Joined
Mar 19, 2013
Messages
340
I may have figured it out.
You have to specify type nullfs.
Code:
mount -o union -t nullfs /mnt/vdev1/folder1/ /mnt/pool2/vdev2/folder2/

If you do it this way. Your content of folder1 will appear in folder2 while newly added files/folders are added to folder1.

Sems to do exactly what i want! Great!
 
Status
Not open for further replies.
Top