AllocFS User's Manual

13 September 2006

AllocFS is a derivative work of the Ext2 filesystem, which is Copyright (C) 1992, 1993, 1994, 1995 Remy Card (card@masi.ibp.fr). Therefore, it is licensed under the GNU General Public License. Please read the file COPYING for details.

Introduction

AllocFS is a filesystem that provides a hierarchical allocation facility, It allows a space allocation to be attached to a directory, for example, 2 GB to /var/spool/mail. This allocation both guarantees that the given amount of space will be available, and it also prevents files outside of that directory from consuming the space. Unlike traditional partitioning, allocations can be added, deleted, and resized instantaneously without re-formatting or even taking the filesystem offline. In addition, allocations are hierarchical: they may be subdivided into smaller allocations as needed.

As described in this paper, allocations are particularly useful to distributed systems and computing grids that must allocate space in order to prevent multiple processes from interfering with each other when a system is under heavy load. However, they may also be useful to the administrators of more conventional systems that wish to reduce the headache of disk partitioning for space management.

Note that AllocFS is still a research prototype, so you shouldn't undertake this unless you know a little bit about filesystems and system administration.

To make use of AllocFS, use must do the following:

  • Download and compile an appropriate Linux kernel.
  • Download and compile the AllocFS package against that kernel.
  • Install the driver and mount a file system.
  • Use the tools mkalloc, lsalloc, fixalloc to manage allocations.
  • Compiling

    In order to compile AllocFS, you must first have a compiled and configured Linux source tree. (Yes, we understand this is a real pain, but this just how Linux works, and there is nothing we can do about it.)

    Note: Currently, this will only work with Linux-2.4.21. We are investigating how to make this code portable across multiple Linux versions.

    Download Linux 2.4.21.tar.gz, and configure and compile the kernel.

    Once that is complete, download the AllocFS source package allocfs-src-0.2.tar.gz. Then, compile it as follows:

    % tar xvzf allocfs-src-x.y.tar.gz
    % cd allocfs-src-x.y
    % ./configure --with-linux-source /path/to/linux-2.4.21
    % make
    % make install
    

    Installing for Testing

    First, load the allocfs module into your kernel:
    % insmod driver/allocfs.o
    
    To test allocfs, we recommend that you create a temporary loopback partition to try things out. Here is how to create a temporary loopback filesystem of 100MB:
    % dd if=/dev/zero of=/tmp/tmpdisk bs=1024k count=100
    % losetup /dev/loop0 /tmp/tempdisk
    % mke2fs /dev/loop0
    % mkdir /mnt/alloctest
    
    Finally, mount the filesystem as follows:
    % mount -t allocfs /dev/loop0 /mnt/alloctest
    
    And, each time you mount the filesystem, you must run the fixalloc program to fix up the allocation state:
    % fixalloc /mnt/alloctest
    

    Using

    Although AllocFS is a little clunky to get installed, it is easy to use. To make a new allocation, simply call mkalloc with a new directory name and the size of the allocation:
    % mkalloc /mnt/alloctest/adir 10MB
    mkalloc: /mnt/alloctest/adir allocated 10240 blocks.
    
    You may now store up to 10MB of data in this new directory, and will be guaranteed to have the space available. If you attempt to put more data than will fit in the allocation, you will receive the following error:
    % cp /tmp/big /mnt/alloctest/adir/big
    cp: writing `/mnt/alloctest/adir/big': Disk quota exceeded
    
    To examine the state of an allocation, use lsalloc on the directory itself:
    % lsalloc /mnt/alloctest/adir 
         USED     TOTAL  PCT PATH
       10.00M    10.00M  99% /mnt/alloctest/adir
    
    Or, use the -r option to look at the entire tree of allocations:
    % lsalloc -r /mnt/alloctest
         USED     TOTAL  PCT PATH
       10.01M    87.14M  11% /mnt/alloctest
       10.00M    10.00M  99% /mnt/alloctest/adir
    
    Finally, to increase or decrease the size of an existing allocation, simply call mkalloc again with a new size:
    % mkalloc /mnt/alloctest/adir 25M
    mkalloc: /mnt/alloctest/adir allocated 25600 blocks.
    
    % lsalloc -r /mnt/alloctest
         USED     TOTAL  PCT PATH
       25.01M    87.14M  28% /mnt/alloctest
       10.00M    25.00M  39% /mnt/alloctest/adir
    

    Installing for Production Use

    If, after testing AllocFS, you are satisfied that it will work for production purposes, you can install it on top of an existing EXT2 filesystem without reformatting.

    First, load the allocfs module into your kernel:

    % insmod driver/allocfs.o
    
    Mount the desired EXT2 filesystem using a normal mount command, except be sure to specify -t allocfs. For example:
    % mount -t allocfs /dev/hdb2 /home/data
    
    And, each time you mount the filesystem, you must run the fixalloc program to fix up the allocation state. Don't be alarmed if you see a few warnings the first time you do this.
    % fixalloc /home/data
    
    If, at any point, you wish to abandon AllocFS and convert back to a normal EXT2 filesystem, simply un-mount and re-mount the filesystem without the -t allocfs flag:
    % umount /home/data
    % mount /dev/hdb2 /home/data
    

    Getting Help

    For more information about AllocFS, please consult the CCL web page, and consider subscribing to our mailing lists.