Auto-pilot includes a file system setup script, fs-setup.sh, that formats and mounts a file system, and a corresponding script fs-cleanup.sh that later unmounts it. By default, Ext2, Ext3, and Reiserfs are supported, but the scripts are sufficiently extensible to allow other types of file systems to be mounted. The special file system type none bypasses file system setup and cleanup (this can be used if you mount your file system outside of Auto-pilot, but do not want to modify the default scripts).
The file system setup script takes a single argument on the command line, which is the file system type to mount (e.g., ext2 or reiserfs).
Aside from the command line argument, the file system setup script is controlled by several environment variables:
First, TESTROOT and TESTDEV are unmounted using the
ap_unmount function. This is designed to prevent previous failed
iterations of a test from impacting this iteration.
Next, if FORMAT is 1,
ap_initfs is called to format the
ap_initfs function takes the file system type as its only
argument. It formats TESTDEV with the specified file system time,
and uses FSSIZE to determine how many megabytes the file system
Before executing mkfs, it calls the "mkfsopts" hook. This
hook takes four arguments, the file system time, the device, the block
size, and the file system size. It prints any additional options to
pass to mkfs on stdout. Next, for ext2, ext3, and
reiserfs the file system is formatted using mkfs.
For other file system types, a mkfs hook is called. The
mkfs hook takes the same arguments as mkfsopts, and
formats the file system according to the arguments and environment
variables. If a mkfs hook is not defined, then
After the file system is formatted, a tunefs hook is called
with two arguments: the file system type and the device. The tunefs
hook can modify file system properties. For example, a tunefs hook can
toggle directory indexing on an Ext2 or Ext3 partition.
After the file system is formatted, it is mounted. First, a mount hook
is called with arguments of
$FSTYPE $TESTDEV $TESTROOT. This
hook can perform pre-mount operations, or mount the file system itself.
To suppress fs-setup.sh from mounting the file system, the hook
can set DOMOUNT to zero.
After the mount is completed, a postmount hook is called with the same
arguments as the mount hook.
Finally, TESTDIR is created if it does not already exist.
The file system cleanup script, fs-cleanup.sh, is simpler than
the setup script. After loading commonsettings, the
unmount hook is called with arguments of
$TESTROOT, and then
ap_unmount is called with an argument of