ShaoLin Microsystems  
The Enterprise Linux Solutions Expert
Corporate Products Services Support Partners
Download  Contact Us
 

A.2. Union File System Reference

Unionfs is suitable to use with NFS daemon nfsd. It uses a fake block device /dev/unionfs[0-255] with major number 231 and minor number from 0-255 . Unionfs have the following behavior,

Example A-1. Example Unionfs Mount


 mount -t unionfs -o master=/master,slave=/slave /dev/unionfs1 /unionfs

/master/a
/master/b
/master/c
+
/slave/a
/slave/d
/slave/e

Unionfs -> /unionfs/a
/unionfs/b
/unionfs/c
/unionfs/d
/unionfs/e
This is also known as union mount. In this example, there are 'a' in both /master and /slave. In this case, unionfs will take a from /master. If there are subdirectories with the same name in both master and slave, the contents of the subdirectories will be merged together as well.

A.2.1. Mount time options

master=[dir]

The master file system dir.

slave=[dir]

The slave file system dir.

Notes: Both master and slave must be on the same partition ( from the same block device ), otherwise, unionfs mount will fail.

A.2.2. The .unionfs file

The .unionfs control a run-time per directory behavior of Unionfs. The .unionfs file must reside in the master tree, and it will be read into memory in directory lookups, it will not refresh itself unless the directory cache is dropped. It contains the following sections and have the following meaning,

[Options]

The [Options] section is for controlling options of this directory, you can specify no_slave option to make this directory not merge with slave sub directory. Example,

Example A-2. .unionfs options


[Options]
no_slave
Currently we only support one option.

[Exclude]

You can specify a list of file name entries to be excluded from merging with its slave subdirectories. Each of the entry is separated by end of line character.

Example A-3. .unionfs exclude


[Exclude]
name1
name2
name3
When the no_slave is on, the [Exclude] section has no meaning.