Document revision date: 30 March 2001

## OpenVMS User's Manual

Previous | Contents | Index

## Chapter 12
Devices: Using Private Tapes and Disks

This chapter describes how to allocate, initialize, and mount a device for private use. It includes information about:

- Device management
- Displaying device information
- Allocating devices
- Initializing volumes
- Mounting volumes
- Accessing files on private devices
- Dismounting volumes

For additional information, refer to:

- The OpenVMS DCL Dictionary or online help, for information about the commands discussed in this chapter
- The OpenVMS System Management Utilities Reference Manual, for information about the MOUNT command
- The OpenVMS Cluster Systems, for information about devices in OpenVMS Cluster environments

## 12.1 Device Management

If all the files you create and use are located on devices managed by a system manager, you might not need to learn how to access a tape or disk drive. The system manager can set up logical names to refer to the devices you need to use. You can then read, write, and copy files to and from the device by using the logical name. In most cases, the system manager sets up and maintains devices that are shared by a group of users.

If you have a tape or disk drive available for your private use (for example, if your workstation includes an integral tape or diskette drive), you should be familiar with a few commands for accessing those devices. Diskettes and diskette drives are one type of disk device. For simplicity, this chapter uses the generic term disks to refer to all types of disks.

Note Although a disk or tape is for your exclusive use, anyone with physical access to it can read its contents on some system. It is good practice to keep disks and tapes in a safe place and to erase sensitive data before recycling them so the next user cannot read their contents.

In this chapter, storage media are sometimes referred to as volumes. While the storage media itself is a piece of hardware, you can think of it in terms of its stored data; a volume is a disk or tape that has an organized collection of data.

To perform your work on a device that cannot be accessed by other users, you can create a private volume and mount it on a device allocated exclusively for you. The steps for setting up a private volume are as follows:

Step | Task
--- | ---
1 | Use the DCL command ALLOCATE to assign the device (disk or tape) drive to your process.
2 | Use the DCL command INITIALIZE to format the disk or tape volume and write an identifying label on the volume.
3 | Use the DCL command MOUNT to make a volume and the files or data it contains accessible to your process.

Although you can print a file from a privately owned volume, the volume containing the file to be printed must remain mounted until after the file has completed printing. If you want to dismount the volume before the file is done printing, copy the file directly to the printer. For example:

    $ COPY MYPHILE.DAT LPA0:

## 12.2 Displaying Device Information

To display information about volumes that are on your system, enter the SHOW DEVICES command. To obtain additional information or information about a specific device, enter the SHOW DEVICES command in one of the following ways:

- To check the densities, volume labels, UICs, and relative volume numbers of mounted volumes, enter the SHOW DEVICES/FULL command.
- To display information for all the drives of a particular type configured in the system, specify a generic device code for magnetic tape drives (such as MT).
- To display information for a volume mounted on a specific drive, specify the physical device name (for example, MTA1:).

In the following example, the SHOW DEVICES command displays the available devices DMA1: and MTA1:

    $ SHOW DEVICES
    Device           Device         Error    Volume         Free  Trans Mnt
     Name            Status         Count     Label        Blocks Count Cnt
    DMA2:           Mounted            0     BACKUP_FILE    4442     7   1
    MTA1:           Online             0
       .
       .
       .

## 12.3 Allocating Devices

When you allocate a device, you reserve the device for exclusive use by your process. The device remains allocated to your process until you explicitly deallocate it (with the DCL command DEALLOCATE) or until you log out.

Before you can use files or data on a private volume, you must allocate (locally assign) a disk or tape drive to your process with the DCL command ALLOCATE. The format for the ALLOCATE command is as follows:

`ALLOCATE device-name[:] [logical-name]`

The elements are as follows:

device-name | Specifies the drive on which the volume is loaded. The name can be a physical name, a generic name, or a logical name.
logical-name | Specifies an optional logical name to be associated with the device.

Table 12-1 summarizes the ways in which you can allocate a device.

Table 12-1 Allocating a Device
Example | Explanation
--- | ---
To allocate a specific physical device:
    $ ALLOCATE DMB2:

    %DCL-I-ALLOC, _MARS$DMB2: allocated
| Uses a physical device name (DMB2) to request the allocation of a specific RK06 or RK07 disk drive (unit 2 on controller B).
To allocate the first available device:
    $ ALLOCATE DM: DISK

    %DCL-I-ALLOC, _MARS$DMB1: allocated
| Uses the generic device code DM to allocate the first available RK06 or RK07 disk device. In addition, creates the logical name DISK in the process logical name table and assigns it to the name of the allocated device.
To allocate a device by logical name:
    $ ALLOCATE DRIVE1: D1

    %DCL-I-ALLOC, _MARS$DBA3: allocated
| Allocates DRIVE1 (a logical name that translates to the physical device DBA3) and assigns a new logical name D1 to the allocated device.
To select a particular device type:
    $ ALLOCATE/GENERIC RK07 MYDISK
| Uses the /GENERIC qualifier to allocate a particular type of device (an RK07 disk).
To specify a list of generic devices:
    $ ALLOCATE MF,MT,MS DRIVE

    %DCL-I-ALLOC, _MARS$MTA0: allocated
| Specifies a list of generic device names; the first available device (MTA0) is the only one to be allocated. In addition, assigns the logical name DRIVE to MTA0. The ALLOCATE command allocates only one device to a process. Therefore, although each element in the list represents a unique, generic device type, only one of the specified generic devices is allocated.

## 12.4 Initializing Volumes

Initializing a disk or tape volume allows you to write files to that disk or tape. To initialize a volume, use the DCL command INITIALIZE, which does the following:

- Creates a new file structure on the volume. Any data stored on the disk at the time of initialization is deleted during the intialization process.
- Writes a label on the volume to identify it
- Defines the owner UIC and the protection for the volume

Note The INITIALIZE command does not prevent you from initializing another user's volume; to be sure the volume you initialize is your own, allocate the device before you initialize the volume.

If you give a volume to another user for initialization (for example, if you lack sufficient privileges to initialize a particular volume), you should provide the volume label, the owner UIC, and the protection code for the volume.

The format for the INITIALIZE command is as follows:

`INITIALIZE device-name[:] volume-label`

The fields are as follows:

device-name | Specifies the name of the device on which the volume is physically mounted.
volume-label | Identifies the volume. You can specify up to 12 alphanumeric characters for a disk volume or up to 6 alphanumeric characters for a magnetic tape volume.

### 12.4.1 Initializing Disk Volumes

By default, the INITIALIZE command builds a Files--11 structure on your new volume. The default format for disk volumes initialized for or by the OpenVMS operating system is called the Files--11 On-Disk Structure Level 2. The INITIALIZE command can also initialize disk volumes in Files--11 On-Disk Structure Level 1.

You do not need special privileges to override logical protection on a blank disk volume (that is, a volume that has never been written to) or on a disk volume that is owned by your current UIC or by UIC [0,0]. In all other cases, you must have user privilege VOLPRO to initialize a disk volume.

The following example initializes the volume on DMA1 and labels the volume ACCOUNTS:

    $ INITIALIZE DMA1: ACCOUNTS

### 12.4.2 Initializing Magnetic Tape Volumes

The default format for magnetic tape volumes produced by the INITIALIZE command is based on Level 3 of the American National Standards Institute (ANSI) X3.27-87 and International Standards Organization (ISO) standards for magnetic tape labels and file structure for informational interchange.

If you use ANSI "a" characters (which are not alphanumeric) on the volume label on magnetic tape, you must enclose the volume name in quotation marks.

The following example initializes the volume on MTB1 and labels the volume SOURCE:

    $ INITIALIZE MTB1: SOURCE

## 12.5 Mounting Volumes

Before you attempt to use files or data on an allocated disk or tape volume, make sure the volume is mounted. The DCL command MOUNT makes a volume and the files or data it contains accessible to your process.

When you enter the MOUNT command, the system verifies that the following conditions have been met:

- The device has not been allocated by another user.
- The device protection allows you to allocate the device.
- A volume is physically loaded on the specified device.
- The label on the volume matches the label you specified.

You can mount a single volume or a volume set. Binding volumes into a volume set allows you to extend the space available for your files by adding volumes to the same set, rather than by defining multiple, new volumes. The procedures for creating and mounting volume sets (as opposed to single volumes) are described in the OpenVMS System Manager's Manual.

The MOUNT command format is as follows:

`MOUNT device-name[:][,...] [volume-label[,...]] [logical-name[:]]`

The elements are as follows:

device-name | Specifies the physical device name or logical name of the device on which the volume is to be mounted.
volume-label | Specifies the label with which the volume was initialized. You do not need to specify the volume label if you use one of the following MOUNT qualifiers: /FOREIGN, /NOLABEL, or /OVERRIDE=IDENTIFICATION.
logical-name | Defines a name to be associated with the device. If you omit the logical name, the MOUNT command assigns the default logical names DISK$volume-label and TAPE$volume-label to disk and tape drives, respectively.

### 12.5.1 Requesting Operator Assistance

Operators can perform the physical mounting (and dismounting) of both system and private volumes. If no operator is available (operator is not enabled) to receive and respond to a MOUNT request, a message is displayed to inform you of the situation. A volume placed in the requested drive needs no additional operator assistance. Note that you can specify the /NOASSIST qualifier to avoid operator assistance.

MOUNT messages are sent to all operators enabled to receive TAPE and DISK messages. Thus, if operator assistance is needed for mounting a disk device, a message is sent to disk operators.

The MOUNT command shown here notifies the operator of your mount request and displays a message at your terminal:

    $ MOUNT DMA1: DISK VOL1
    %MOUNT-I-OPRQST, PLEASE MOUNT DEVICE _MARS$DMA1:

After the device has been successfully mounted, you are notified with the following message:

    %MOUNT-I-MOUNTED, DISK mounted on _DMA1:

The following example shows how to allocate, initialize, and mount a disk volume:

    $ ALLOCATE DMA2:  TEMP
    %DCL-I-ALLOC, _MARS$DMA2: allocated
    $ INITIALIZE  TEMP:  BACKUP_FILE
    $ MOUNT  TEMP:  BACKUP_FILE
    %MOUNT-I-MOUNTED, BACKUP_FILE mounted on _DMA2:
    $ CREATE/DIRECTORY  TEMP:[ARCHIE]

Before you can place any files on the volume, you must create a directory, as shown by the CREATE/DIRECTORY command.

### 12.5.2 Mounting a Foreign Disk Volume

To mount a foreign disk volume (that is, one having a file structure other than Files--11), use the /FOREIGN qualifier. For example:

    $ MOUNT/FOREIGN DISK
    %MOUNT-I-MOUNTED, BACKUP_FILE      mounted on DISK$DMA2:

The MOUNT/FOREIGN command makes the contents of your volume available to the system but makes no assumptions concerning its file structure. In the preceding example, MOUNT reports a volume label, indicating that the disk has a Files--11 structure, even though it was mounted as a foreign device. If a disk does not have a recognized file structure, MOUNT does not display a label.

Note that you need the user privilege VOLPRO to mount a Files--11 structured disk with the /FOREIGN qualifier, unless its owner UIC matches your own.

### 12.5.3 Mounting Magnetic Tape Volumes

When you use the MOUNT command to mount a magnetic tape volume, the system checks to see whether the volume has an ANSI-labeled format. If the format is ANSI-labeled, MOUNT checks the following:

- The volume identifier field
- The protection on the ANSI-labeled volume

The command shown in the following example mounts an ANSI-labeled volume and assigns a logical name to it:

    $ MOUNT  MT:  SYSTPV ET
    %MOUNT-I-OPRQST, please mount volume SYSTPV in device $MTA1:
    %MOUNT-I-MOUNTED, SYSTPV mounted on MTA1:
    %MOUNT-I-RQSTDON, operator request canceled -- mount completed successfully

MOUNT finds an available MT drive, MTA1, and requests operator assistance. The message displayed indicates which drive has been selected. At this point, you (or the operator) load the magnetic tape on the drive and the mount operation completes. No operator response is necessary. The display informs you that the volume named SYSTPV is mounted on the drive MTA1. Although MOUNT does not require a logical name, this example assigns the logical name ET to the volume SYSTPV.

## 12.6 Accessing Files on Private Devices

To access a file that is on a private device, you must either specify the device name or use the SET DEFAULT command to set default to the device. For files on disks, you must also specify the directory name.

You can use physical, logical, or generic names described in the following sections to refer to devices. In addition, if your system is part of an OpenVMS Cluster system, certain devices are accessible to all members of an OpenVMS Cluster system. Section 12.6.4 describes the syntax for OpenVMS Cluster device names.

### 12.6.1 Using Physical Device Names

Each physical device known to the system is uniquely identified by a physical device name. The physical device name identifies the kind of device; for example, a storage disk or a terminal.

Most physical device names consist of:

- A device code, which represents the hardware device type
- A controller designator, which identifies the hardware controller to which the device is attached
- A unit number, which identifies a device on a particular controller.

For information on specific device-naming formats, see the OpenVMS System Manager's Manual.

When a disk or tape is mounted on a device, the system recognizes it as a volume. The system also recognizes volume sets. A volume set consists of two or more related volumes. To access a file on a tape volume set, specify any device that has been allocated to it.

To access a file on a disk volume set, you have the following options:

- Specify the name of the device on which the first volume in the set is mounted.
- Specify the logical name that was assigned to the volume set when it was mounted.

If you do not specify a device name, the system supplies the current default device name. For more information on volumes and volume sets, see the OpenVMS System Manager's Manual.

Some commands accept output file specifications. You can replace an output file specification with the name of a record-oriented device such as a printer or a terminal. For example:

    $ COPY DISFILE.DAT TTB4:

The COPY command sends the file DISFILE.DAT to the terminal named TTB4. The terminal accepts and displays the file one record at a time. When you use a device name as a file specification, follow the device name with a colon (:).

### 12.6.2 Using Logical Device Names

Your system manager can set up logical device names to represent the devices on your system. Logical device names equate a somewhat cryptic device name to a short, meaningful name. You can use these logical device names, rather than the physical device names, to refer to devices.

When you use a logical device name in a file specification, follow it with a colon.

Chapter 13 describes in more detail how to use logical names.

In the following example, COD1 is a logical device name for the device that contains the disk volume with the file [NOAH]ANIMALS.LIS:

    $ TYPE COD1:[NOAH]ANIMALS.LIS

As long as the system manager defines the logical name COD1 correctly, the system can access the file, regardless of where the volume is mounted.

### 12.6.3 Using Generic Device Names

A generic device name consists of the device code and omits the specific controller or unit number. When you use a generic device name with the MOUNT or ALLOCATE commands, the system locates the first available controller or device unit whose physical name satisfies the portions of the generic device name you specified.

If you specify a generic device name for any other command, the following defaults apply:

- If you omit the controller designation, it is assumed to be A.
- If you omit the unit number, it is assumed to be 0.

Previous | Next | Contents | Index

| privacy and legal statement |
6489PRO_029.HTML