Aufs2

Aufs2 is a virtual filesystem similar to UnionFS. It allows to mount two or more filesystems at the same time merging them to a single filesystem.

= Installation = This section will guide you through the installation process of aufs2. Although an aufs2 ebuild is located in the official portage tree, there is no support for newer kernel versions [1] as of 2011-08-11. Follow the instructions of the subsection below to get aufs2 running on kernels newer than 2.6.39.

Add the aufs2 ebuild to your keywords:

Enable the USE flag for aufs2 in order to automatically patch your kernel sources. For manual patching, refer to the ebuild or the aufs2 project page.

Now, simply run and it should install out of the box.

Preparations for >=Kernel-3.0.0
For higher kernel versions, you need to copy your ebuild and the required patches to your PORTDIR_OVERLAY specified in make.conf and apply a patch. The patch below has been applied by the Gentoo developers, who added aufs2 support to the Gentoo LiveDVD 11.2 (kernel 3.0.0) and was taken from the LiveDVD.

Assumung your PORTDIR_OVERLAY is /usr/local/portage/, you need to run:

Copy the ebuild:

Copy the patches:

Save this patch: {{File|aufs2-kernel-3.0.1.patch| --- /usr/portage/sys-fs/aufs2/aufs2-0_p20110627.ebuild	2011-06-27 10:12:45.000000000 +0200 +++ /usr/local/portage/sys-fs/aufs2/aufs2-0_p20110627.ebuild	2011-08-11 11:43:18.627596233 +0200 @@ -34,24 +34,24 @@ 	get_version kernel_is lt 2 6 31 && die "kernel too old" -	kernel_is gt 2 6 39 && die "kernel too new" +	kernel_is gt 3 0 1 && die "kernel too new" linux-mod_pkg_setup -	if ! ( patch -p1 --dry-run --force -R -d ${KV_DIR} < "${FILESDIR}"/aufs2-standalone-${KV_PATCH}.patch >/dev/null && \ -		patch -p1 --dry-run --force -R -d ${KV_DIR} < "${FILESDIR}"/aufs2-base-${KV_PATCH}.patch >/dev/null ); then +	if ! ( patch -p1 --dry-run --force -R -d ${KV_DIR} < "${FILESDIR}"/aufs2-standalone-39.patch >/dev/null && \ +		patch -p1 --dry-run --force -R -d ${KV_DIR} < "${FILESDIR}"/aufs2-base-39.patch >/dev/null ); then if use kernel-patch; then cd ${KV_DIR} ewarn "Patching your kernel..." -			patch --no-backup-if-mismatch --force -p1 -R -d ${KV_DIR} < "${FILESDIR}"/aufs2-standalone-${KV_PATCH}.patch >/dev/null -			patch --no-backup-if-mismatch --force -p1 -R -d ${KV_DIR} < "${FILESDIR}"/aufs2-base-${KV_PATCH}.patch >/dev/null -			epatch "${FILESDIR}"/aufs2-{base,standalone}-${KV_PATCH}.patch +			patch --no-backup-if-mismatch --force -p1 -R -d ${KV_DIR} < "${FILESDIR}"/aufs2-standalone-39.patch >/dev/null +			patch --no-backup-if-mismatch --force -p1 -R -d ${KV_DIR} < "${FILESDIR}"/aufs2-base-39.patch >/dev/null +			epatch "${FILESDIR}"/aufs2-{base,standalone}-39.patch ewarn "You need to compile your kernel with the applied patch" ewarn "to be able to load and use the aufs kernel module" else eerror "You need to apply a patch to your kernel to compile and run the aufs2 module" eerror "Either enable the kernel-patch useflag to do it with this ebuild" -			eerror "or apply ${FILESDIR}/aufs2-base-${KV_PATCH}.patch and" -			eerror "${FILESDIR}/aufs2-standalone-${KV_PATCH}.patch by hand" +			eerror "or apply ${FILESDIR}/aufs2-base-39.patch and" +			eerror "${FILESDIR}/aufs2-standalone-39.patch by hand" die "missing kernel patch, please apply it first" fi fi @@ -66,7 +66,7 @@ } src_prepare { -	local branch=origin/aufs2.1-${KV_PATCH} +	local branch=origin/aufs2.1-39 git checkout -q $branch || die # All config options to off }}

And patch the ebuild:

Clean the patch:

Digest ebuild:

Now you can install aufs2 the same way as described earlier.

= References =
 * 1) aufs2 compatiblity with linux kernel 3