次の方法で共有


Rsm

Manages media resources using Removable Storage. Using the rsm command, you can run batch scripts for applications that do not currently support the Removable Storage API.

To allocate media from a media pool

Syntax

rsm allocate /m media_pool_name /o{errunavail|new|next} {/l{g|f}logical_media_id | /p{g|f}partition_id} [/lnlogical_media_name] [/ldlogical_media_description] [/pnpartition_name] [/pdpartition_description] [/ttimeout] [/b]

Parameters

/m media_pool_name   : Media are allocated from the specified media pool. This means that you will have allocated media in that pool.

/o   : Permits the use of one of the parameters listed in the following table.

Value

Description

errunavail

Prevents the submission of an operator request for new media if none can be allocated with the specified constraints.

new

Allocates a partition that cannot be shared with another application. This can be used to reserve the second side of two-sided media.

next 

Allocates the next side of media that was previously allocated using the new parameter.

/l { g | f } logical_media_id   : Specifies the media to be allocated, using the logical media ID. You can use the GUID (with the lg command-line option), or the friendly name (with the lf command-line option). Logical_media_id specifies the next side of multi-sided media to allocate. This parameter is optional and must be used with the /o command-line option and the next parameter. After deallocating this media, the logical media ID is invalid.

/p { g | f } partition_id   : Specifies the partition to be allocated, using the partition ID. You can use the GUID (with the pg command-line option), or the friendly name (with the pf command-line option). This parameter is optional and remains persistent even after the media is deallocated.

/ln logical_media_name   : Specifies the media to be allocated, using the logical media name.

/ld logical_media_description   : Specifies the media to be allocated, using the logical media description.

/pn partition_name   : Specifies the partition to be allocated, using the partition name.

/pd partition_description   : Specifies the media partition to be allocated, using the partition description.

/t timeout   : Specifies the command timeout, in milliseconds. The default timeout value is infinite.

/b   : Only the GUID for the allocate operation is displayed. This aids in scripting where you want to pass the output of one command to the next with minimal parsing.

/? : Displays help at the command prompt.

Remarks

  • You can use logical media names and side names can be used in other commands to specify media as the parameter to the /lf or /pf switch, respectively. If logical media names (which are friendly names) are not used with the allocate command, you can use only GUIDs in subsequent commands to specify logical media.

To create a media pool

Syntax

rsm createpool /m media_pool_name /a{existing|always|new} [/t{g|f}media_pool_type_id] [/d] [/r]

Parameters

/m media_pool_name   : Specifies the name of the media pool to be created.

/a   : Permits the use of one of the parameters listed in the following table.

Value

Description

existing

Opens the existing media pool or returns an error if the media pool specified does not exist.

always

Opens the existing media pool or creates a new media pool if not found.

new 

Creates a new media pool or returns an error if the media pool specified already exists.

/tg media_pool_type_id   : Specifies the type of media the media pool will contain, using the GUID. The default type is a media pool that contains other media pools.

/tf media_pool_type_id   : Specifies the type of media the media pool will contain, using the friendly name. The default type is a media pool that contains other media pools.

/d   : Permits the media pool to automatically draw media from the free media pool. If the /d switch is not included, the media pool will not be permitted to draw media from the free media pool.

/r   : Permits the media pool to automatically return media to the free media pool. If the /r switch is not included, the media pool will not be permitted to return media to the free media pool.

/? : Displays help at the command prompt.

To deallocate media

Syntax

rsm deallocate /l{g|f}logical_media_id | /p{g|f}partition_id

Parameters

/lg logical_media_id   : Specifies the logical media to deallocate, using the GUID.

/lf logical_media_id   : Specifies the logical media to deallocate, using the friendly name.

/pg partition_id   : Specifies the media side to deallocate, using the GUID.

/pf partition_id   : Specifies the media side to deallocate, using the friendly name.

/? : Displays help at the command prompt.

Remarks

  • You can use the logical media name or the partition name to specify the logical media to deallocate only if one of these names were specified with the allocate command using the /ln or /pn switch respectively. Otherwise, you must specify either the logical media ID (LMID) or the partition ID (PARTID) instead.

To delete a media pool

Syntax

rsm deletepool /m media_pool_name

Parameters

/m media_pool_name   : Specifies the name of the media pool to be deleted.

/? : Displays help at the command prompt.

To dismount media from a drive

Syntax

rsm dismount {/l{g|f}logical_media_id | /p{g|f}partition_id
rsm dismount [/o[deferred]]}

Parameters

/lg logical_media_id   : Specifies the logical media to dismount, using the GUID.

/lf logical_media_id   : Specifies the logical media to dismount, using the friendly name.

/pg partition_id   : Specifies the media side to dismount, using the GUID.

/pf partition_id   : Specifies the media side to dismount, using the friendly name.

/o   : When used with the optional deferred parameter, this optional switch marks the media as dismountable, but the media is kept in the drive. Subsequent mount commands can be completed normally. If not used, the media is dismounted from the drive immediately.

/? : Displays help at the command prompt.

Remarks

  • The logical media name or the partition name can be used to specify the logical media to dismount only if one of these names were specified with the allocate command using the /ln or /pn switch, respectively. Otherwise, you must specify either the logical media ID (LMID) or the partition ID (PARTID) instead.

To eject media from a library

The media to be ejected can be specified in one of three ways:

  • You can specify the physical media to eject using either the physical-media ID (PMID) or the physical media name.

  • You can eject the media in a specified slot within a specified library.

  • You can eject the media in a specified drive within a specified library.

Syntax

rsm eject {/p{g|f}physical_media_id | /s{g|f}slot_id /l{g|f}library_id | /d{g|f}drive_id /l{g|f}library_id 
rsm eject [/oeject_operation_id]
rsm eject [/a{start|stop|queue}]
rsm eject [/b]

Parameters

/pg physical_media_id   : Specifies the physical media to eject, using the GUID.

/pf physical_media_id   : Specifies the physical media to eject, using the friendly name.

/sg slot_id   : Specifies the slot holding the media to eject, using the GUID.

/sf slot_id   : Specifies the slot holding the media to eject, using the friendly name.

/lg library_id   : Specifies the library containing the slot or drive from which to eject the media, using the GUID.

/lf library_id   : Specifies the library containing the slot or drive from which to eject the media, using the friendly name.

/dg drive_id   : Specifies the drive holding the media to eject, using the GUID.

/df drive_id   : Specifies the drive holding the media to eject, using the friendly name.

/o eject_operation_id   : Used to specify the GUID for the particular eject operation. The optional /o switch can be used in conjunction with the /a switch and the stop parameter to terminate a particular eject operation. This can also be used in conjunction with the /a switch and the start parameter to display the GUID of the particular eject operation.

/a   : Permits the use of one of the parameters listed in the following table.

Value

Description

Start

The default, starts the eject operation immediately. The media is ejected until a timeout occurs, or unless another eject command is issued with the /a command-line option and the stop parameter. Such eject commands must also specify the eject operation GUID using the /o command-line option. The timeout parameter is specified in the library object (for all eject operations) for the library. To set this timeout parameter, you must use the Removable Storage API. Can also be used in conjunction with the /o switch to display the GUID of a particular eject operation.

Stop

Terminates the eject operation prior to a timeout expiring. The particular eject operation can be determined using the GUID displayed when the start parameter is used with the /a switch and the /o switch.

Queue

Queues the media for later ejection. This can be used for libraries with multi-slot inject/eject (IE) ports.

/b   : Displays only the eject operation GUID for scripting purposes.

/? : Displays help at the command prompt.

To eject media from an ATAPI changer

Syntax

rsm ejectatapi /n atapi_changer_number

Parameters

/n atapi_changer_number   : Specifies the changer number. Atapi_changer_number is the number found at the end of the string for the device name of the changer. For example, \\.\CdChanger0 has 0 as the ATAPI changer number.

/? : Displays help at the command prompt.

Remarks

  • Before you run this command, manually stop the ntmssvc service.

To inventory the media in a specified automated library

Syntax

rsm inventory /l{g|f}library_id /a{full|fast|default|none|stop}

Parameters

/lf library_id   : Specifies the library to inventory, using the friendly name.

/lg library_id   : Specifies the library to inventory, using the GUID.

/a   : Required. Specifies the type of inventory operation to perform. The following table lists valid inventory operations.

Value

Description

Full

Performs a full on-media inventory of the library. Removable Storage mounts each tape or disk in the library and reads the on-media identifier.

Fast

Performs a bar code inventory, if the specified library has a bar code reader installed. If the library has no bar code reader, Removable Storage checks the storage slots and reads the on-media identifier on media in slots that were previously empty.

Default

Performs an inventory using the default method specified in the library's Properties dialog box.

None

Performs no inventory.

Stop

Stops the current inventory for the specified library, if one is being performed.

/? : Displays help at the command prompt.

To mount media in the designated library

The logical media to be mounted can be specified using either the logical-media ID (LMID) or the logical media name.

Syntax

rsm mount {/l{g|f}logical_media_id | /p{g|f}partition_id | [/s{g|f}slot_id /c{g|f}changer_id}
rsm mount [/d{g|f}drive_id]
rsm mount /o{errunavail|drive|read|write|offline}
rsm mount [/r{normal|high|low|highest|lowest}]
rsm mount [/ttimeout]

Parameters

/lf logical_media_id   : Specifies the logical media to mount, using the friendly name.

/pf partition_id   : Specifies the media side to mount, using the friendly name.

/pg partition_id  

/lg logical_media_id   : Specifies the logical media to mount, using the GUID.

/cg changer_id   : Specifies the changer that contains the media to be mounted, using the GUID. This can only be used in conjunction with the /sg switch and the slot GUID.

/cf changer_id   : Specifies the changer that contains the media to be mounted, using the friendly name. This can be used only in conjunction with the /sg switch and the slot GUID.

/sg slot_id   : Specifies the media slot that contains the media to be mounted, using the GUID. This can only be used in conjunction with the /cg switch and the changer GUID.

/sf slot_id   : Specifies the media slot that contains the media to be mounted, using the friendly name. This can only be used in conjunction with the /cg switch and the changer GUID.

/dg drive_id   : Specifies the particular drive on which to mount the applicable media, using the GUID. This parameter is optional, and must be used in conjunction with the /o switch and the drive parameter.

/df drive_id   : Specifies the particular drive on which to mount the applicable media, using the friendly name. This parameter is optional, and must be used in conjunction with the /o switch and the drive parameter.

/o   : Permits the use of one of the parameters listed in the following table.

Value

Description

Errunavail

Generates an error if either the media or the drive is unavailable.

Drive

Specifies that a particular drive is to be mounted. This parameter is used in conjunction with the /d switch.

Read 

Mounts the media for read access.

Write

Mounts the media for write access. If this parameter is used, completed media will not be mounted.

Offline

Generates an error if the media is offline.

/r   : Optionally specifies the mount order, or priority. Mount priority may also be specified using one of the listed parameters, normal (the default), high, low, highest, or lowest.

/t   : Optionally specifies the command timeout, in milliseconds. The default timeout is infinite.

/? : Displays help at the command prompt.

Remarks

  • When using the mount command, you can specify the media to be mounted using either the /l switch, the /p switch, or a combination of the /s switch and the /c switch.

To refresh a library, physical media, or all devices of a particular media type

This command causes a single poll of the target devices so that the Removable Storage database contains the current state of the device. This command can be useful after media insert or eject operations.

Syntax

rsm refresh {/l{g|f]library_id | /p{g|f}physical_media_id | /tgmedia_type_id}

Parameters

/lg library_id   : Specifies the library to refresh, using the GUID.

/lf library_id   : Specifies the library to refresh, using the friendly name.

/pg physical_media_id   : Specifies the physical media to refresh, using the GUID.

/pf physical_media_id   : Specifies the physical media to refresh, using the friendly name.

/tg media_type_id   : Specifies the media type to be refreshed. Only the GUID can be specified. This parameter can be used to refresh all removable media devices by specifying the GUID for the removable media. This GUID can be determined using the view command as follows: rsm view /tmedia_type /guiddisplay. /?Displays help at the command prompt.

To display a list of media objects

Syntax

rsm view /t{drive|library|changer|storageslot|iedoor|ieport|physical_media| media_pool|partition|logical_media|media_type|drive_type|librequest}
rsm view [/cgcontainer_id]
rsm view [/guiddisplay]
rsm view [/b]

Parameters

/t { drive | library | changer | storageslot | iedoor | ieport | physical_media | media_pool | partition | logical_media | media_type | drive_type | librequest } : Displays a list of media objects of the specified type. When used without any parameter, the command displays a list of all media pools in the Removable Storage system (collection of libraries).

/cg container_id   : Specifies the GUID for the object container. The type of container depends on the object type (parameter) specified with the /t switch. If the container ID is not specified, all instances of the applicable object type are displayed.

/guiddisplay   : Displays both the GUID and the friendly name for objects.

/b   : Displays only the object GUID for scripting purposes. /?Displays help at the command prompt. 

Remarks

  • If the /guiddisplay switch and the /b switch are not used, only the friendly names for objects are displayed.

Remarks

  • If a command succeeds, then the code ERROR_SUCCESS is returned. All commands that fail return an error code, which can be used for scripting purposes. The error code is either a system-defined error code or one of the error codes listed in the following table.

    Error code

    Description

    536870913

    Invalid arguments were specified. Frequently, this is caused by a space after an argument switch, for example, /t 50 instead of /t50.

    536870914

    Duplicate argument switches were specified. For example, the allocate command used with two /m switches.

    536870915

    No GUID matches the friendly name that was specified. Check capitalization because friendly names are case-sensitive.

    536870916

    An insufficient number of argument switches were specified. Check to see if a required switch is missing.

    536870917

    An invalid GUID was specified. Use the view command to determine the correct GUID for an object.

    536870918

    This is returned only by the ejectatapi command. Verify that the ATAPI changer is functioning correctly.

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

Command-line reference A-Z

Removable Storage overview

Understanding Removable Storage

Using Removable Storage