|
发表于 2006-12-16 13:30:22
|
显示全部楼层
Aufs -- Another Unionfs
Junjiro Okajima
# $Id: README,v 1.28 2006/12/11 02:21:16 sfjro Exp $
0. Introduction
Aufs was entirely re-designed and re-implemented Unionfs. After
many original ideas, approaches, improvements and implementations, it
becomes totally different from Unionfs 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 (including to my broken English), suggestions, comments
and donations are always welcome.
1. Features
- unite several directories into a single 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 NFS readdir.
- support mmap(2) including /proc/PID/exe symlink, 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
- maintain /etc/mtab by an external shell script, /sbin/mount.aufs.
- 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 aufs manual in detail
Aufs is in still development stage, especially,,,
- pseudo hardlink (hardlink over branches)
- NFS or remote filesystem branch
- 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, selecting writable branch
policy.
- O_DIRECT (unnecessary?)
- export via NFS (unnecessary?)
- light version, without branch manipulation.
- SMP, because I don't have such machine.
- xattr, acl
- and documentation
2. Download and Contact
CVS tree is in aufs project of SourceForge.
I always try putting the stable version in CVS, so you can try CVS
instead of SourceForge File Release. And every changes are summarized
and reported to aufs-users at lists.sourceforge.net ML. It is recommended to
join this ML.
When you have any problems or strange behaviour in aufs, please let me
know with,,,
- /proc/mounts (instead of the output of mount()
- 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. Configuration and Install
Aufs is being developed and tested on linux-2.6.16 and later.
o CONFIG_AUFS_UDBA_INOTIFY
"User's Direct Branch Access, UDBA" means to access a file on a branch
directly, eg. bypassing aufs.
If you want to modify files on branches directly and want aufs to
detect the changes of them fully, use 'udba=inotify' mount option.
To support this option, you need to enable both of CONFIG_INOTIFY and
CONFIG_AUFS_UDBA_INOTIFY.
This is valid for linux-2.6.18 and later.
See detail in aufs.5.
o CONFIG_AUFS_KSIZE_PATCH
Aufs sometimes needs to 'realloc' memory. In linux kernel, people
usually writes the sequence which is alloc/copy/free memory. If
'ksize' kernel internal function is exported to modules, aufs can omit
alloc and free in the sequence and runs efficiently in some cases.
Here is a patch for it, called ./ksize.patch which only exports the
function.
It is recommended to apply this patch to your kernel and enable
CONFIG_AUFS_KSIZE_PATCH (cf. local.mk).
This is valid for linux-2.6.16 and later.
If you don't want to modify/recompile your kernel, you can use aufs
without this patch and leave CONFIG_AUFS_KSIZE_PATCH as disabled.
When you link aufs to your kernel statically, ie. CONFIG_AUFS=y
instead of '=m', you don't need ./ksize.patch.
o CONFIG_AUFS_LHASH_PATCH
If you use NFS as an aufs branch filesystem in linux-2.6.19 or later, then
you need to apply the patch './lhash.patch' to you kernel source, and enable
CONFIG_AUFS_LHASH_PATCH (cf. local.mk).
This patch exports the kernel internal function __lookup_hash().
If your kernel is before 2.6.19 or you don't use NFS as a branch, you don't
need this patch.
o CONFIG_DEBUG_PROVE_LOCKING (in linux kernel)
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.
Currently these configurations are written in ./local.mk, ./local.mk will work
for you in most cases.
$ 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
If you are using 'sparse' which is commonly used for checking linux
kernel source files. You will meet this error.
'error: undefined identifier '__func__''
Because 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 your sparse souce file (of course, it is
absolutely no warranty too).
4. Usage
(after 'make')
$ man -l ./aufs.5
# install -m 500 -p mount.aufs /sbin (recommended)
# 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}=ro none /tmp/aufs
or
# mount -t aufs -o br:/tmp/rw none /tmp/aufs
# mount -o remount,append:${HOME}=ro /tmp/aufs
If you disable CONFIG_AUFS_COMPAT in your configuration, you can remove the
default branch permission '=ro.'
# mount -t aufs -o br:/tmp/rw:${HOME} none /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( 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 environments. This sample version means that "I have tested
on 2.6.18-rc4 fully, and tested on 2.6.17 partially."
5.
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: ; |
|