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.
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.
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.
You initiate recycling for tape libraries 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.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 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.
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 for a tape library involves the tasks described in the following sections, in this order:
1. Creating a recycler.cmd File
2. Editing the archiver.cmd File (This step is optional for recycling tape libraries)
4. Creating a crontab File for the Recycler
5. To Remove -recycle_ignore and ignore Parameters
6. Creating a recycler.sh File
Create a recycler.cmd file if you are recycling archive copies on cartridges in a library.
The recycler.cmd file contains general recycling directives. It can also contain directives for each library in the Sun StorageTek SAM 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.
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 email when recycling occurs on a given library. The email message has the following subject line:
TABLE 6-2 shows sample message bodies.
Follow these instructions to manually run the recycler.
1. Issue the sam-recycler(1M) command.
The recycler reads the recycler.cmd file.
2. Examine the standard output log, Sun StorageTek SAM 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.
If the system is performing as expected, you can make a crontab entry for the superuser to run the recycler periodically. The frequency you choose depends 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:
If you have used the -recycle_ignore or ignore parameter to disable recycling during configuration, use this procedure to remove them. 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.
Configuring the recycler for recycling disk archive volumes involves the tasks described in the following sections, in this order:
1. Editing the archiver.cmd File
3. Creating a crontab File for the Recycler
4. To Remove -recycle_ignore and ignore Parameters
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.
|
Follow these instructions to manually run the recycler.
1. Issue the sam-recycler(1M) command.
The recycler reads the recycler.cmd file.
2. Examine the standard output log, Sun StorageTek SAM log, and /var/adm/messages for any error messages from the recycler.
Correct your files if errors appear.
CODE EXAMPLE 6-4 shows a sample recycler log file for recycling disk archive files.
If the system is performing as expected, you can make a crontab entry for the superuser to run the recycler periodically. The frequency depends 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:
|
If you have used the -recycle_ignore or ignore parameter to disable recycling during configuration, use this procedure to remove them. 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.
As an alternate to the normal recycling process, the sam-nrecycler(1M) tool can be used to work in conjunction with the File System Manager's backup and recovery point features. This tool removes expired archive copies and frees up archive volumes to aid in the ability to use Sun StorageTek SAM dump files for archive retention. If you want to take advantage of this functionality, you must use this recycler in place of the existing sam-recycler command.
The sam-nrecycler(1M) tool scans file system metadata and Sun StorageTek SAM dump files to determine which removable media and disk archive volumes contain archive images. It can be invoked through the crontab(1) file at an off-peak time, or invoked at any time using the sam-nrecycler command. The nrecycler identifies all archive images present on a removable media volume or in a disk archive tar file by scanning all file system .inodes files and specified Sun StorageTek SAM dump files. By scanning the file systems and Sun StorageTek SAM dump files, the nrecycler can determine if there are volumes that do not contain any archive images, and the space on these volumes can be reclaimed. If a removable media volume does not contain any archive images, it is safe to relabel the cartridge. If a disk archive tar file does not contain any archive images, it is safe to remove the tar file from the disk archive directory.
Directives for sam-nrecycler(1M) must be provided using the /etc/opt/SUNWsamfs/nrecycler.cmd file. You must specify a path to the directories that contain the Sun StorageTek SAM dump files to be searched. If no directories are specified in the command file, recycling does not occur. The list of directories must be complete and all Sun StorageTek SAM dump files must be contained in the directory list.
You can also include a logfile= directive line in the nrecycler.cmd file to specify an nrecycler log file. The system writes recycling messages and recycling reports to this file.
When sam-nrecycler(1M) detects that a removable media volume contains only free or expired space and is safe to relabel, it invokes the sam-nrecycler.sh script. The script can relabel the cartridge using either the original VSN or a new VSN. It can then export the cartridge from the library, or it can perform another user-defined action.
When sam-nrecycler detects that a disk archive volume contains only free or expired space, it unlinks the unused disk archive tar file.
For more information about sam-nrecycler(1M), see the sam-nrecycler(1M) man page.
Copyright © 2007, Sun Microsystems, Inc. All Rights Reserved.