C H A P T E R 6 |
Recycling |
Recycling is the process of reclaiming space on archive volumes. The recycler works with the archiver to reclaim the space occupied by unused archive copies. As users modify files, the archive copies associated with the old versions can be purged from the system. The recycler identifies the volumes with the largest proportions of expired archive copies and directs the movement of unexpired copies to different volumes. If only expired copies exist on a given volume, a site-defined action is taken. For example, such a volume can be relabeled for immediate reuse or exported to offsite storage, thus keeping a separate historical record of file changes. Users are unaware of the recycling process as it relates to their data files.
This chapter describes the recycling process and directives. It includes the following topics:
The recycler keeps the amount of space consumed by expired archive copies to a minimum as defined by site-specified parameters. At any time, the space on a given archive volume consists of the following:
The capacity of a volume is the total amount of space for data on a volume. For example, a 10-gigabyte tape volume with 3 gigabytes written to it has a capacity of 10 gigabytes and 7 gigabytes of free space.
New or newly labeled archive media starts out with all its capacity as free space. As data is archived to the media, the amount of free space decreases and the amount of current data increases.
As archived files in the file system are changed or removed, their archive images expire and they move from the current data classification to the expired data classification. The physical space used by these images remains the same; there is simply no longer a file in the file system pointing to that space. Only when space is recycled can these images be removed and the space they occupy become free. The goal of the recycler is to transform space used by expired data into free space without losing any current data.
You initiate recycling by entering the sam-recycler(1M) command either manually or through a cron(1) job. TABLE 6-1 shows recycling methods.
As TABLE 6-1 shows, you can recycle either by library or by archive set. If you are archiving to disk, you can recycle only by archive set.
The recycler and the archiver work together, as follows:
1. The recycler marks all the current (valid) archive images that are present on a volume with the rearchive attribute.
2. If you are archiving to removable media, the recycler marks the selected archive volume with the recycle attribute. This prevents the archiver from writing any more archive images to the volume.
3. The archiver moves all the marked images to another volume. This operation is called rearchiving. After the archiver moves the current archive images from the old volume to the new volume, the old volume contains only free space and expired space. If you are archiving to removable media cartridges, you can relabel and reuse the cartridge. If you are archiving to disk, the recycler removes the file that contains the expired archive images.
The recycler is designed to run periodically. It performs as much work as it can each time it is invoked. The recycler has to finish marking copies for rearchiving before the archiver can rearchive the files.
Sometimes expired archive images, with the rearchive attribute set, remain on media. This can happen under the following conditions:
Between executions, the recycler keeps state information in the library catalogs and the inodes. During the recycling process, you can use the sls(1) command and its -D option to display information about a file. The output from the sls(1) command shows whether or not a file is scheduled for rearchiving.
The recycler.cmd file accepts the directives described in the following sections:
The logfile directive specifies a recycler log file. This directive has the following format:
For filename, specify the path to the log file.
The following is an example of a logfile= directive line:
The no_recycle directive enables you to prevent recycling of volumes. To specify the VSNs, you use regular expressions and one or more specific media types.
This directive has the following format:
One or more space-separated regular expressions to describe the volumes. For information, see the regexp(5) man page or see File Name search-criterion Using Pattern Matching: -name regex. |
By specifying a media type, you can prevent the recycling of volumes stored on a particular type of media. One or more VSN-regexp specifications enable you to identify specific cartridges to be excluded from recycling.
For example, the following directive line excludes from recycling any tape volumes whose VSN identifiers begin with DLT:
The library directive enables you to specify various recycling parameters for the VSNs associated with a specific library.
This directive has the following format:
For library, specify the library's name as specified in the family set field of the mcf(4) file.
For parameter, specify one or more space-separated parameter keywords from TABLE 6-3.
For example, consider the following directive line:
It specifies the following for library gr47:
In addition, no more than 1 gigabyte is to be rearchived. This is the default, so it is not specified in the recycler.cmd file.
Before configuring the recycler, note the following:
The recycler is not enabled by default. You must initiate recycling by entering the sam-recycler(1M) command. When the recycler is initiated, the default recycler settings specified in Specifying Recycling for an Entire Automated Library: The Library Directive take effect. For more information on the recycler, see the sam-recycler(1M) man page.
Configuring the recycler involves the tasks described in the following sections, in this order:
1. Creating a recycler.cmd File
2. Editing the archiver.cmd File
4. Creating a crontab File for the Recycler
5. Removing -recycle_ignore and ignore Parameters
6. Creating a recycler.sh File
If you are archiving to cartridges in a library, this process involves creating a recycler.cmd file and, optionally, editing the archiver.cmd file. If you are archiving to disk, editing the archiver.cmd file.
The following procedures describe configuring the recycler for any archive media using the recycler.cmd and archiver.cmd files.
Perform this step if you are recycling archive copies on cartridges in a library.
The recycler.cmd file contains general recycling directives and can also contain directives for each library in the Sun StorEdge SAM-FS environment. A typical recycler.cmd file contains the following directive lines:
Because you are creating the recycler.cmd line and it has not yet been tested, use the ignore keyword. You remove the ignore keyword in a later step in this process.
To create a recycler.cmd file, perform the following steps:
2. Use vi(1) or another editor to open file /etc/opt/SUNWsamfs/recycler.cmd.
3. Add one or more directives described in this chapter to control recycler activity.
Alternatively, you can create a recycler.cmd file by using File System Manager software. For more information, see the File System Manager online help.
CODE EXAMPLE 6-1 shows an example of a recycler.cmd file.
logfile = /usr/tmp/recycler.log stk30 -hwm 51 -mingain 60 -ignore -mail root |
The following sections describe the parameters specified in CODE EXAMPLE 6-1.
By specifying a high water mark, you can set the percentage of media usage below which recycling cannot occur. This percentage is the ratio of the used space in the library to its total capacity. As an example, a library that holds ten 20-gigabyte tapes, three of them 100 percent full and the remaining seven each 30 percent full, has the following media utilization percentage:
Note that this calculation does not distinguish between current data and expired data. It only addresses the amount of media used.
In this example, if the utilization percentage is 51 percent or less, the recycler does not automatically select any of the automated library's VSNs for recycling.
The minimum VSN gain percentage sets a lower limit on the amount of space to be gained by recycling a cartridge. For example, if a cartridge in an automated library is 95 percent current data and 5 percent expired data, the gain obtained by recycling the cartridge would be only 5 percent. It might not be worth moving the other 95 percent to retrieve this space. Setting the minimum gain to 6 percent or more inhibits the recycler from automatically selecting this VSN.
The -ignore parameter keeps the recycler from recycling a particular library. Use it when you are configuring the recycler.
The -mail parameter specifies that the recycler send mail when recycling occurs on a given library. The mail message has the following subject line:
TABLE 6-2 shows sample message bodies.
If you are archiving to disk, you must edit the archiver.cmd file in order to recycle.
If you are recycling by library, this step is optional.
To edit the archiver.cmd file, follow the steps described in To Create or Modify an archiver.cmd File and Propagate Your Changes.
Alternatively, you can edit the archiver.cmd file by using the File System Manager. For more information, see the File System Manager online help.
To enable recycling by archive set, you must add archive set recycling directives between the params and endparams directives. TABLE 6-4 shows the archive set recycling directives that you can use.
For more information about archiver directives, see Chapter 3 or see the archiver.cmd(4) man page.
1. Issue the sam-recycler(1M) command.
The recycler reads the recycler.cmd file.
2. Examine the standard output log, Sun StorEdge SAM-FS log, and /var/adm/messages for any error messages from the recycler.
Correct your files if errors appear.
CODE EXAMPLE 6-3 shows a sample recycler log file for recycling removable media cartridges.
CODE EXAMPLE 6-4 shows a sample recycler log file for recycling disk archive files.
If the system is performing as expected, you are ready to make a crontab entry for the superuser to run the recycler periodically, every two hours or more, depending on your site's conditions.
For instructions on creating a crontab entry, see the cron(1M) man page.
The following example entry in root's crontab file specifies that the cron daemon run the recycler every five minutes after the hour for every odd-numbered hour:
As an alternative to the following procedure, you can use the File System Manager. For more information, see the File System Manager online help.
1. Use vi(1) or another editor to remove the -recycle_ignore parameters from the archiver.cmd file.
2. Use vi(1) or another editor to remove the ignore parameters from the recycler.cmd files.
Create a recycler.sh file if you are recycling archive copies on removable media cartridges. If you are archiving only to disk, do not perform this step.
The recycler executes the recycler.sh script when all the current images from a VSN have been rearchived to another VSN. You should determine your site requirements for dispensing with recycled cartridges. Some sites choose to relabel and reuse the cartridges; others choose to remove the cartridges from the automated library to use later for accessing historical files.
The recycler calls the /opt/SUNWsamfs/scripts/recycler.sh script with the following arguments:
For examples of the script, see the recycler.sh(1M) man page or /opt/SUNWsamfs/examples/recycler.sh. The latter shows how to relabel a recycled VSN and send mail to the superuser.
For more information, see the recycler(1M) and recycler.sh(1M) man pages.
Copyright © 2006, Sun Microsystems, Inc. All Rights Reserved.