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.
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:
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
% insmod driver/allocfs.oTo 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/alloctestFinally, mount the filesystem as follows:
% mount -t allocfs /dev/loop0 /mnt/alloctestAnd, each time you mount the filesystem, you must run the fixalloc program to fix up the allocation state:
% fixalloc /mnt/alloctest
% 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 exceededTo 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/adirOr, 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/adirFinally, 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
First, load the allocfs module into your kernel:
% insmod driver/allocfs.oMount the desired EXT2 filesystem using a normal mount command, except be sure to specify -t allocfs. For example:
% mount -t allocfs /dev/hdb2 /home/dataAnd, 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/dataIf, 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