This script is orphaned. Although I believe it is still useful, I no longer use AFS and am no longer maintaining this script. If you would like to pick up maintenance of it, please feel free. Contact me if you would like this page to redirect to its new home.


Given a set of AFS server partitions, this script extracts information from an AFS reporting database using SQL and generates an AMPL input file, the solution to which will be a balance of volumes across those AFS server partitions. The input file can be used to balance any combination of volume count, total usage, total quota, and total accesses. Provided here are AMPL models that balance count, usage, and accesses or just count and usage.

Given an AMPL solution to the generated input file, afs-balance can also turn that solution into an input file for mvto that will move the necessary volumes to implement that solution.

For more detailed information, see my white paper on AFS server balancing, which explains the goals and algorithms used here.


afs-balance gets its data from the AFS reporting database. See the white paper on that database for more details. It uses the Stanford::LSDB::AFSDB wrapper to connect to the database, available (as an example) from the tools page for the AFS reporting database. The scripts used to load that database are also available there. You will want to change Stanford::LSDB::AFSDB to connect to your own local database.

Alternatively, afs-balance could use vos listvol -long output directly to gather its information. I didn't bother to implement this since we have that information available in an easier form in our reporting database, but that modification shouldn't be too difficult to make.

You will need a linear programming optimizer that supports AMPL input to solve the problem generated by this script. We use ILOG CPLEX for this, which is a commercial package. I don't know if any other available optimizers would also work. afs-balance also parses the output from the optimizer, and I don't know if other AMPL-based optimizers would present the output in a different format.

afs-balance uses partinfo to get partition usage information, although it could be easily modified to use vos partinfo directly. Its output is intended for use with mvto to do the actual volume moves, although the output format is fairly simple and could doubtless be used by many other tools.


The program:

afs-balance 1.7 2007-10-16 Download

The AMPL models:



Copyright 1998, 1999, 2005 The Board of Trustees of the Leland Stanford Junior University

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. This means that you may choose between the two licenses that Perl is released under: the GNU GPL and the Artistic License. Please see your Perl distribution for the details and copies of the licenses.

Last spun 2021-09-25 from thread modified 2014-08-10