[buildd-tools-devel] Bug#679726: aufs

Roger Leigh rleigh at codelibre.net
Mon Jul 2 21:12:03 UTC 2012


On Mon, Jul 02, 2012 at 09:30:36PM +0100, Nicholas Bamber wrote:
> I have not got very far with aufs yet. Obviously I need to rtfm a bit
> more. However I have tried to follow the scroot scripts as best as I can
> and what I get is as follows:

The only bit that matters is in 10mount (05union just creates
and removes the directories for the "overlay" and "underlay"):

CHROOT_UNION_MOUNT_OPTIONS=br:${CHROOT_UNION_OVERLAY_DIRECTORY}:${CHROOT_UNION_UNDERLAY_DIRECTORY}=ro
mount -t "$CHROOT_UNION_TYPE" -o "$CHROOT_UNION_MOUNT_OPTIONS" "$CHROOT_NAME" "$1"

So you just need to try doing

mount -t aufs -o "br:${overlay}:${underlay}=ro" ${name} ${mountpoint}

where
  overlay=overlay directory
  underlay=underlay directory
  name=any name you like
  mountpoint=where to mount

If you can do that directly on the host system as root, then aufs
is working properly.  But if it's not, something is wrong, either
with the setup script, or with how schroot has been configured.

Here's an example:

% mkdir /tmp/a /tmp/b
% touch /tmp/a/1 /tmp/b/2
% ls /tmp/a /tmp/b
/tmp/a:
1

/tmp/b:
2
% sudo mount -t aufs -o "br:/tmp/a:/tmp/b=ro" testaufs /mnt    
% mount | tail -n 1
testaufs on /mnt type aufs (rw,relatime,si=68977b847b3d0288)
ravenclaw% ls /mnt
1  2
ravenclaw% touch /mnt/3
ravenclaw% ls /tmp/a /tmp/b
/tmp/a:
1  3

/tmp/b:
2

So you can see that /tmp/a is the writable overlay, so files
created in /mnt go into /tmp/a, and /tmp/b is the read-only
underlay.  If you can do the above, then aufs is working
correctly.  Note that I did a "modprobe aufs" beforehand,
but this should not be necessary.

On the schroot side, you shouldn't need to do anything more
than set union-type=aufs.  Everything else should be automatic--
the chroot filesystem should be mounted/bind mounted/unpacked
on the underlay, and an empty directory should be the overlay.


Hope this helps,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800





More information about the Buildd-tools-devel mailing list