
Aufs -- Another Unionfs
Junjiro Okajima

# $Id: README,v 1.22 2006/10/09 00:27:40 sfjro Exp $

0. Introduction
Aufs was entirely re-designed and re-implemented Unionfs. After
enhancing with many original ideas, approaches and implementations, it
becomes totally different source code while keeping the basic features.
Unionfs is being developed by Professor Erez Zadok at Stony Brook
University and his team.
If you don't know Unionfs, I recommend you to try and know it before
using aufs. Some terminology in aufs follows Unionfs's.

Bug reports, suggestions, comments and donations are always welcome.

1. Features
- unite several directories into a single writable virtual
  filesystem. The member directory is called as a branch.
- you can specify the permission flags to the branch, which are
  'readonly', 'readwrite' and 'whiteout-able.'
- by upper writable branch, internal copyup and whiteout, files/dirs
  on readonly branch are modifiable logically.
- dynamic branch manipulation, add, del.
- etc... see Unionfs in detail

Also there are many enhancements in aufs, such like,,,
- simplified, safer and faster
- keep inode number by external inode number table
- keep the timestamps of file/dir in internal copyup operation
- seekable directory
- support mmap(2) without page-copy
- whiteout is hardlinked in order to reduce the consumption of inodes
  on branch
- do not copyup, nor create a whiteout when it is unnecessary
- revert a single systemcall when an error occurs in aufs
- remount interface instead of ioctl
- loopback mounted filesystem as a branch
- kernel thread for removing the dir who has a plenty of whiteouts
- support copyup sparse file (a file which has a 'hole' in it)
- default permission flags for branches
- selectable permission flags for ro branch, whether whiteout can
  exist or not
- and more... see util/aufs.5 in detail

Aufs is in still development stage, especially,,,
- pseudo hardlink (hardlink over branches)
- allow a direct access manually to a file on branch,
  eg. bypassing aufs. including NFS or remote filesystem branch.
- remount option copy/move between two branches
- O_DIRECT (unnecessary?)
- export via nfs (unnecessary?)
- light version, without branch manipulation.
- SMP, because I don't have such machine.
- xattr
- and documentation

2. Download and Contact
CVS tree is in aufs project of SourceForge.

When you have any problems or strange behaviour in aufs, please let me
know with,,,
- /proc/mounts (instead of the output of mount(8))
- linux kernel version
- AUFS_VERSION (defined in include/linux/aufs_type.h)
- configuration (define/undefine CONFIG_AUFS_xxx, or plain local.mk is
  used or not)
- phenomenon
- actual operation, reproducible one is better
- mailto: aufs-users at lists.sourceforge.net

3. Install and Usage
Aufs is being developed and tested on linux-2.6.16 and later.
Usually, ./local.mk will work for you.
	$ make -f local.mk
The local.mk searches your kernel source files by
	KDIR = /lib/modules/$(shell uname -r)/build
If you are cross-compiling the aufs module, try
	$ make KDIR=/your/kernel/source/path -f local.mk

You need to apply the ./ksize.patch to your linux kernel, in order to
export 'ksize' kernel internal function.
If you don't want to apply this patch, you can compile and use aufs
without the patch by defining CONFIG_AUFS_NO_KSIZE (cf. local.mk). But
some operations (add a branch, readdir to a large directory, and the
first access to files after add/del branches) will be inefficient.
If you link aufs to your kernel statically, ie. CONFIG_AUFS=y instead of
=m, you don't need ./ksize.patch.

	(after 'make')
	$ man -l ./aufs.5
	# install -m 500 -p mount.aufs /sbin (optional)
	# insmod ./aufs.ko
	$ mkdir /tmp/rw /tmp/aufs
	# mount -t aufs -o dirs=/tmp/rw:${HOME}=ro none /tmp/aufs

Here is another example.

	# mount -t aufs -o br:/tmp/rw:${HOME} none /tmp/aufs
	or
	# mount -t aufs -o br:/tmp/rw none /tmp/aufs
	# mount -o remount,append:${HOME} /tmp/aufs

Then, you can see whole tree of your home dir through /tmp/aufs. If
you modify a file under /tmp/aufs, the one on your home directory is
not affected, but the same named file will be newly created under
/tmp/rw. And all of your modification to the file will be applied to
the one under /tmp/rw. This is called Copy on Write (COW) method.
Aufs mount options are described in util/aufs.in.5, and ./aufs.5 would
be built by the first 'make'.
When you finish using aufs, you can unmount it by umount(8) simply.

When you load aufs module, aufs shows its version as
	'tested linux version'-'release or cvs committed date'
like
	2.6.18rc4-20060828
While I am trying to support linux after 2.6.16, I cannot have such
many test environment. This sample version means that "I have tested
on 2.6.18-rc4 fully, and tested on 2.6.17 partially."

If you enable CONFIG_DEBUG_PROVE_LOCKING in your linux kernel, you
will be warned at aufs compile time. And at aufs run time, some
harmless warnings will be issued, and CONFIG_DEBUG_PROVE_LOCKING will
be disabled automatically.
See detail in aufs.5.

If you are using 'sparse' which is commonly used for checking linux
kernel source files. You will meet
	'error: undefined identifier '__func__''
since aufs uses 'nested function' GCC extension.
While it is used in very limited and simple manner in aufs, sparse
says it is an error. You can ignore this message if your compilation
succeeds.
If you want to shut your sparse up, then apply
'./nested__func__.patch' to it (of course, it is absolutely no
warranty too).

If you want to enable CONFIG_AUFS_DBA for 'Direct Branch Access', you
need to enable CONFIG_INOTIFY.

If you are an experienced user, no explanation is needed. Aufs is
just a linux filesystem module. take a glance at ./local.mk,
aufs.in.5, and Unionfs.

Enjoy!

# Local variables: ;
# mode: text;
# End: ;
