Data Storage and Management |
Most of what Removable Storage does involves both moving media around within and between libraries, and controlling access to that media. While Removable Storage is handling them in these ways, the media in a Removable Storage system have states associated with them. These states determine which operations are permitted and which are prevented. While a medium is available, for example, any application can claim it for its own use, but a medium already in use by one application cannot be claimed by another.
There are two sets of media-related states that govern most of the handling and usage by Removable Storage and its applications: media states and side states.
The states associated with physical media reflect that the operations performed on them mostly involve movement.
Table 2.4 describes the Removable Storage media states.
Table 2.4 Physical Media States in Removable Storage
Physical Media State | Description |
---|---|
Idle | Medium is in a slot if in a library, or on a shelf if in the offline physical location. |
In Use | Removable Storage is in the process of moving the medium. |
Mounted | Medium is in a drive, but might not be accessible yet. |
Loaded | Medium is in a drive, and the contents of one of its sides are accessible. |
Unloaded | Medium is still in a drive, but the contents of the side that was loaded are no longer accessible. |
A side is accessible if an application can perform I/O on it. This distinction is most marked in the case of certain tape drives. Inserting a tape into one of these drives does not make its contents accessible. A portion of the tape must be pulled out of the cartridge and wrapped around the tape drive head, a process sometimes referred to as loading.
Since data is stored on a medium side, states associated with sides reflect usage rather than physical location. Table 2.5 lists and describes the Removable Storage media states.
Table 2.5 Side States in Removable Storage
Side State | Description |
---|---|
Allocated | A side that has been claimed for use by an application. The side is not available to any other application. |
Available | A side that is available to be claimed and used by any application. |
Completed | A side that is in use, but can no longer be used for write operations. The side is physically or logically full. |
Decommissioned | A side that can no longer be used because it has crossed a usage threshold. It has reached its allocation maximum (specified by the administrator or an application) and cannot be used again. |
Unrecognized | A side whose label types and label IDs are not recognized by Removable Storage. |
Imported | A side whose label type is recognized by Removable Storage, but whose label ID is not. It is a new side that Removable Storage has never seen before, but whose format it recognizes. |
Inaccessible | A side of a multi-sided cartridge that is in a drive, but not the accessible side. |
Incompatible | A side that is not compatible with the pool in which its medium was identified. The medium containing the side needs to be immediately ejected from the library. |
Reserved | The second side of a two-sided medium. It is unavailable for allocation to all but the application which already has the first side allocated. |
Unprepared | Side that is not claimed or used by any application, but which does not have a free label on it. Applications cannot allocate unprepared media. This is a temporary state. See the following discussion on the interplay between media states and pools. |
The state a physical medium or side is in determines what can happen to it next. The transitions for physical media are fairly straightforward. A medium starts off idle and goes to in use when it's being moved to a drive or IE port. Once in a drive, it goes from mounted to loaded. When it is dismounted it goes from unloaded, to in use, and then to idle when it is back in its slot.
More interesting and complex are the state transitions associated with sides.
When a medium is inserted into a library, Removable Storage tries to identify it by reading the labels on its sides. If Removable Storage recognizes an OMID (both the label type and ID) this medium is reentered into a library. Removable Storage notes the change in location, and its sides keep the same state they had when the medium was ejected from the library. If Removable Storage does not recognize the label type, it sets the side's state to unrecognized. If Removable Storage recognizes the label type but not the label ID, Removable Storage sets the side's state to imported.
If a medium is found to not be compatible with the current library, Removable Storage sets its states to incompatible. This might happen if a medium with a form factor (size and shape) identical to that supported by a library, but different in the way information is recorded, is inserted into that library. For example, there are several tape media types that use an 8mm form factor. Since all attempts to read the medium fail, it is incompatible with the library. Media in the incompatible state cannot be changed to another state, and needs to be ejected from the library.
Removable Storage initially sets the state of inserted CD-ROM media to imported.
Sides that are unrecognized can only be changed to available. Generally, unrecognized sides are either on media that have never been used before or were used in a way that is unrelated to any of the Removable Storage client applications and so the contents are not useful. Figure 2.4 describes the legal state transitions for a side.
Figure 2.4 Media States
Sides that are freely available for any applications to use are in the free pool in the available state. Removable Storage writes a special label (called a free label) on these media so that it can clearly identify these media as holding no useful data. While Removable Storage is in the process of writing a free label, it marks the side as unprepared. This is usually a transitory state, but can persist if, for example, the medium with the side being labeled is in the offline physical media location. Such a side stays in this state until inserted into a library. Any transition into the available state results in writing a free label and therefore passes through the unprepared state.
When an application needs to claim a side for its use it allocates an available side. This process changes the state of the side from available or imported to allocated. An application allocates a medium that is in the imported state when it recognizes that the new side has data that it needs. When it no longer needs any of the data stored on the side, the application deallocates the side, changing its state back to available.
When a medium is full in some sense — either the side can hold no more data or the application can write no more — an application can mark the medium as complete.
Removable Storage keeps track of the number of times a side is allocated. When this count crosses a threshold, the side is decommissioned. Sides in this state are past their useful life. This count is checked when a side is deallocated.
Since the sides of a two-sided medium are allocated separately, it is possible for an application to try to allocate both sides, or to have the second side claimed by a different application. Having two separate applications allocate the sides of a medium can be problematic, especially in circumstances where media are moved between systems. Removable Storage provides a mechanism that applications can use to eliminate this problem. When an application allocates the first side of a two-sided medium the second side is placed in the reserved state. Only the application that allocated the first side can allocate the reserved second side. If the application determines that it does not need the second side, it can change the state of the second side back to available.
When an application deallocates one side of a medium that contains reserved sides, Removable Storage changes the state of all reserved partitions to available.
There are relationships between the various system and application media pools and the states of the sides they contain.
The import pool can hold only media in the import state. Sides in the unrecognized pool can only be in the unrecognized state. In fact, these pools hold sides in these states until applications need them (for example, to move them to application pools). A side in the import state which is moved to an application pool remains in the import state until the application writes a new label on the side and informs Removable Storage.
Sides in the free pools are always in the available state (or the transitional unprepared state). Sides moved into one of the free pools automatically have free labels written on them. Application pools can hold media in any state, except reserved, decommissioned, and unrecognized.
Removable Storage provides a few shortcuts to move sides among pools while changing their state. Normally, an application allocates a side that is in its application pool. However, an application pool property allows Removable Storage to move a side into an application pool when an application tries to allocate a side. If the application tries to allocate a side in a pool in which there are no available sides, Removable Storage moves a side from the appropriate free pool into the application pool and puts it into the allocated state. Conversely, another application pool property indicates that when allocated sides in the pool are deallocated they need to be returned to the appropriate free pool along with the change to the available state.