Chapter 3. Automated Space Management
Prev |  | Next

## Chapter 3. Automated Space Management

The DMF file system monitor, `dmfsmon(8)`, is a daemon that monitors the free space levels in file systems configured as `auto` (that is, automated space management is enabled) and lets you maintain a specified level of free space. When the free space in one of the file systems falls below the free-space minimum, `dmfsmon` invokes `dmfsfree(8)`.

The `dmfsfree` command attempts to bring the free space and migrated space of a file system into compliance with configured values. The `dmfsmon` command uses `dmfsfree` to bring the free space and migrated space into compliance with configured values. `dmfsfree` may also be invoked by system administrators.

When the free space in one of the file systems falls below its free-space minimum, the `dmfsfree` command performs the following steps:

- Scans the file system for files that can be migrated and freed. Each of these candidates is assigned a file weight. This information is used to create a list, called a candidate list, that contains an entry for each file and is ordered by file weight (largest to smallest).

- Selects enough candidates to bring the free space back up to the desired level. Files are selected in order from largest file weight to smallest.

- Selects enough non-migrated files from the candidate list to achieve the migration target, which is the percentage of file system space you want to have as free space and space occupied by migrated but online files. Files are selected from the candidate list in order from largest file weight to smallest.

The `dmfsmon` daemon should be running whenever DMF is active. You control automated space management by setting the file system and policy configuration parameters in the DMF configuration file. The configuration parameters specify targets for migration and free-space as well as one or more policies for file weighting. Only file systems configured as `MIGRATION_LEVEL auto` in the configuration file are included in the space-management process. “DMF Policies” in Chapter 2, describes how to configure automated space management.

You can change the migration level of a file system by editing the configuration file.

The following sections describe space management and associated processes.

## Generating the Candidate List

The first step in the migration process occurs when `dmfsmon` determines it is time to invoke `dmfsfree`, which scans the file system and generates the candidate list. During candidate list generation, the inode of each online file in the specified file system is audited, and a weight is computed for it.

A file system is associated with a file weighting policy in the DMF configuration file. The applicable file weighting policy determines a file's total weight. Total file weight is the sum of the `AGE_WEIGHT` and `SPACE_WEIGHT` parameters. Defaults are provided for these parameters, and you can configure either to make a change. You do not need to configure a weighting policy if the defaults are acceptable, but you should be aware that the default selects files based on age and not on size. If you want to configure a policy based on size that ignores file age, you should overwrite the default for `AGE_WEIGHT`.

The default weighting policy bases the weight of the file on the time that has passed since the file was last accessed or modified. Usually, the more recent a file's access, the more likely it is to be accessed again.

The candidate list is ordered by total file weight (largest to smallest). You can configure the weighting parameters to have a negative value and ensure that certain files are never automatically migrated.

| Note:: If you use negative weights to exclude files from migration, you must ensure that a file system does not fill with files that are never selected for automatic migration.

You can use the `dmscanfs(8)` command to print file information to standard output (`stdout`).

## Selection of Migration Candidates

The `dmfsfree(8)` utility processes each ordered candidate list sequentially, seeking candidates to migrate and possibly free. The extent of the selection process is governed by values defined for the file system in the DMF configuration file as described in “DMF Policies” in Chapter 2.

The most essential parameters are as follows:

- `FREE_SPACE_MINIMUM` specifies the minimum percentage of file system space that must be free. When this value is reached, `dmfsmon` will take action to migrate and free enough files to bring the file system into compliance. For example, setting this parameter to 10 indicates that when less than 10% of the file system space is free, `dmfsmon` will migrate and free files to achieve the percentage of free space specified by `FREE_SPACE_TARGET`. For the information on how this parameter is used when automated space management is not configured, see the `dmf_config(5)` man page.

- `FREE_SPACE_TARGET` specifies the percentage of free file system space the `dmfsmon` will try to achieve if free space falls below `FREE_SPACE_MINIMUM`. For example, if this parameter is set to 15 and `FREE_SPACE_MINIMUM` is set to 10, `dmfsmon` takes action when the file system is less than 10% free and migrates and frees files until 15% of the file system is available.

- `MIGRATION_TARGET` specifies the percentage of file system capacity that is maintained as a reserve of space that is free or occupied by dual-state files. DMF attempts to maintain this reserve in the event that the file system free space reaches or falls below `FREE_SPACE_MINIMUM`.

When `dmfsmon` detects that the free space on a file system has fallen below the level you have set as `FREE_SPACE_MINIMUM`, it invokes `dmfsfree` to select a sufficient number of candidates to meet the `FREE_SPACE_TARGET`. The `dmfsfree` utility ensures that these files are fully migrated and releases their disk blocks. It then selects additional candidates to meet the `MIGRATION_TARGET` and migrates them.

Figure 3-1 shows the relationship of automated space management migration targets to each other. Migration events occur when file activity causes free file system space to drop below `FREE_SPACE_MINIMUM`. `dmfsmon` generates a candidate list and begins to migrate files and free the disk blocks until the `FREE_SPACE_TARGET` is met, and then it migrates regular files (creating dual-state files) until the `MIGRATION_TARGET` is met:

Figure 3-1. Relationship of Automated Space Management Targets

If `dmfsmon` does not find enough files to migrate (because all remaining files are exempt from migration), it uses another configuration parameter to decrement `FREE_SPACE_MINIMUM`.

`FREE_SPACE_DECREMENT` specifies the percentage of file system space by which `dmfsmon` will decrement `FREE_SPACE_MINIMUM` if it cannot find enough files to migrate to reach `FREE_SPACE_MINIMUM`. For example, suppose `FREE_SPACE_MINIMUM` is set to 10 and `FREE_SPACE_DECREMENT` is set to 2. If `dmfsmon` cannot find enough files to migrate to reach 10% free space, it will decrement `FREE_SPACE_MINIMUM` to 8 and try to find enough files to migrate so that 8% of the file system is free. If `dmfsmon` cannot achieve this percentage, it will decrement `FREE_SPACE_MINIMUM` to 6. `dmfsmon` will continue until it reaches a value for `FREE_SPACE_MINIMUM` that it can achieve, and it will try to maintain that new value. `dmfsmon` restores `FREE_SPACE_MINIMUM` to its configured value when it can be achieved. The default value for `FREE_SPACE_DECREMENT` is 2.

| Note: DMF manages real-time partitions differently than files in a normal partition. The `dmfsfree` command can only migrate files in the non-real-time partition; it ignores files in the real-time partition. Any configuration parameters you set will apply only to the non-real-time partition. Files in the real-time partition can be manually migrated with the commands `dmget(1)`, `dmput(1)`, and `dmmigrate(8)`. Files are retrieved automatically when they are read.

## Automated Space Management Log File

All of the space-management commands record their activities in a common log file, `autolog.yyyymmdd` (where yyyymmdd is the year, month, and day of log file creation). The first space-management command to execute on a given day creates the log file for that day. This log file resides in the directory `SPOOL_DIR/daemon_name` (SPOOL_DIR is specified by the `SPOOL_DIR` configuration parameter; see “Configuring the Base Object” in Chapter 2). The space-management commands create the `daemon_name` subdirectory in SPOOL_DIR if it does not already exist. The full path name of the common log file follows:

    SPOOL_DIR/daemon_name/autolog.yyyymmdd

Each line in the `autolog` file begins with the time of message issue, followed by the process number and program name of the message issuer. The remainder of the line contains informative or diagnostic information such as the following:

- The name of the file system being processed

- The number of files selected for migration and freeing

- The number of disk blocks that were migrated and freed

- The names of any other DMF commands executed

- The command's success or failure in meeting the migration and free-space targets

The following excerpt show the format of an `autolog` file:

    11:44:55-V 26968-dmfsmon /dmi - free_space=5.44, minimum=5
    11:46:55-V 26968-dmfsmon /dmi - free_space=5.12, minimum=5
    11:47:35-I 26968-dmfsmon Started 15135 for execution on /dmi
    11:48:55-V 26968-dmfsmon /dmi - free_space=4.79, minimum=5
    11:49:48-I 15135-dmfsmon Number of blocks in the filesystem = 17769424
    11:49:48-I 15135-dmfsmon Number of blocks in the migration target = 8884712 (50%)
    11:49:48-I 15135-dmfsmon Number of blocks currently migrated = 16428664 (92.5%)
    11:49:48-I 15135-dmfsmon Number of blocks to migrate = 0 (0.0%)
    11:49:48-I 15135-dmfsmon Number of blocks in the free space target = 1776942 (10%)
    11:49:48-I 15135-dmfsmon Number of blocks currently free = 886824 (5.0%)
    11:49:48-I 15135-dmfsmon Number of blocks to free = 890118 (5.0%)
    11:49:48-I 15135-dmfsmon Summary of files: online = 93050, offline = 342836, unmigrating = 0.
    11:49:48-I 15135-dmfsmon Number of candidates = 93050, rejected = 0
    11:50:55-V 26968-dmfsmon /dmi - free_space=7.26, minimum=5
    11:51:49-I 15135-dmfsmon Migrated 272 blocks in 1 files.
    11:51:49-I 15135-dmfsmon Freed 890184 blocks in 4197 files
    11:51:49-O 15135-dmfsmon Exiting: minimum reached - targets met by outstanding requests.
    11:52:55-V 26968-dmfsmon /dmi - free_space=9.73, minimum=5
    11:54:55-V 26968-dmfsmon /dmi - free_space=9.73, minimum=5

Prev | Table of Contents | Next
Chapter 2. Configuring DMF |  | Chapter 4. The DMF Daemon