Document revision date: 30 March 2001

## OpenVMS System Manager's Manual

Previous | Contents | Index

### 9.9.1 Dismounting a Single Volume

This section explains procedures to follow in dismounting a single volume and also describes some of the qualifiers you can use with the DISMOUNT command.

#### 9.9.1.1 Dismounting Before Unloading a Volume

Always explicitly dismount a volume or volume set with the DISMOUNT command, or with a command procedure containing that command, before physically unloading that volume. Always wait for the drive to unload before you remove the volume. (You can verify that the dismount is complete by entering the DCL command SHOW DEVICES.)

A private volume is dismounted and unloaded automatically if you log out of the job from which you mounted the volume. If the system fails, however, the drive is not automatically dismounted.

Note that data loss can occur if you do not explicitly dismount a volume and the system fails. For tape volumes, data loss can occur if you unload a volume that contains an open file for which file-trailer labels have not been written. When you remount the volume and attempt to access the file without file-trailer labels, you receive the following error message:

    %MTACP-magnetic tape position lost

You can access all the files that precede the file whose file-trailer labels have not been written. However, you cannot access the file that does not have file-trailer labels.

#### 9.9.1.2 Dismounting Allocated Devices

If the device you are dismounting was allocated with an ALLOCATE command, it remains allocated after you dismount it with the DISMOUNT command. If the device was implicitly allocated with the MOUNT command, the DISMOUNT command deallocates it.

#### 9.9.1.3 Using DISMOUNT Command Qualifiers

The following table explains the /UNIT and /NOUNLOAD qualifiers.

Qualifier | Description
--- | ---
/UNIT | Explicitly dismounts a single volume in the volume set without dismounting the entire set. (By default, the system dismounts all the volumes in the set when you explicitly dismount a single volume in a volume set.) Using this qualifier dismounts a volume but does not "unbind" the volume from the volume set; if you remount the volume, it becomes part of the volume set again.
/NOUNLOAD | Overrides the default automatic unloading of your volume from the drive. With this qualifier, your volume is logically dismounted from the drive; however, the volume remains physically loaded on the drive. If you use this qualifier to dismount a tape volume, the volume remains loaded on the tape drive and the tape reel is rewound to the BOT mark. Using this qualifier can save time and eliminate unnecessary handling of a volume if you plan to remount or reinitialize a volume you are dismounting.

Example

The following example shows how to use the DISMOUNT command. The example uses the /NOUNLOAD qualifier.

    $ DISMOUNT/NOUNLOAD MUA1:

In this example, the tape volume is logically dismounted and remains loaded on the MUA1: device. Also, the tape reel is rewound to the beginning-of-tape mark. The operating system returns you to DCL level.

### 9.9.2 Dismounting a Volume Set

Use the DISMOUNT command to dismount an entire volume set. If you explicitly dismount any volume in a disk or tape volume set, the entire volume set is dismounted. For example, if you have a volume set that consists of DUA3: and DUA4: and you enter the following command, the entire volume set is dismounted:

    $ DISMOUNT DUA3:

### 9.9.3 Dismounting Foreign Volumes

You also use the DISMOUNT command to dismount foreign volumes. The following command dismounts a volume that has been mounted with the /FOREIGN qualifier on the DUA0: device:

    $ DISMOUNT DUA0:

In this example, the volume that had been mounted with the /FOREIGN qualifier on DUA0: is dismounted and automatically unloaded. The system returns you to DCL level.

### 9.9.4 Dismounting a Volume in an OpenVMS Cluster System

You can use the DISMOUNT command to dismount a volume throughout an OpenVMS Cluster system by using the /CLUSTER qualifier. The following command, which requires SYSNAM privilege, dismounts a volume in an OpenVMS Cluster system:

    $ DISMOUNT/CLUSTER $10$DJA100:

The DISMOUNT/CLUSTER command first checks for conditions that prevent the volume from dismounting on the local node. If none is found, the command then checks for such conditions on all the other nodes. If a condition is found on any node, the command sends error messages identifying the device, the node on which the error occurred, and the error.

For more information about the DISMOUNT command, refer to the OpenVMS DCL Dictionary.

## 9.10 Using Command Procedures for Media Setup

Many of the operations that you perform on disk and tape media are routine. It is worthwhile to identify those routine tasks and design command procedures to assist you in performing them. To become familiar with the syntax used to design and execute command procedures, refer to the OpenVMS User's Manual.

You might, for example, want to design command procedures to set up private disk and tape volumes. The command procedure examples in this section, although general in nature, can serve as guiding strategies for you. You can tailor these command procedures to meet the needs of your own setup tasks.

### 9.10.1 Sample Command Procedure for Setting Up Disk Volumes

The command procedure in this section allocates, initializes, and mounts a disk volume. Follow these steps:

1. Use a text editor to create a file named SETUP.COM.
2. Enter the following command procedure, which, when executed, allocates and mounts a disk:

       $ ! Place a disk in the drive
       $ IF P1 .EQS. "" THEN INQUIRE P1 "enter device name"
       $ IF P2 .EQS. "" THEN INQUIRE P2 "enter volume label"
       $ IF P3 .EQS. "" THEN INQUIRE P3 "enter logical name"
       $ ALLOCATE 'P1'
       $ MOUNT 'P1' 'P2' 'P3'

   This command procedure, although very simple, accomplishes the task of allocating and mounting a disk each time you execute it. It prompts you for the device name, volume label, and logical name of the disk device that you want to allocate and mount. By assigning logical names to your disks, you can use this command procedure to allocate and mount devices repeatedly.
   You can take further advantage of the power of a command procedure by including a few additional tasks as well. For example, you might design the SETUP.COM command procedure to deallocate and dismount the disk. The command procedure example used to set up a magnetic tape (described in Section 9.10.2) takes advantage of some of these options.
3. To execute the SETUP.COM command procedure, enter the following command:

       $ @SETUP

### 9.10.2 Sample Command Procedure for Setting Up Tape Volumes

The command procedure shown in Example 9-1, which is more complex and detailed than the previous example, is designed to set up a magnetic tape for processing. The ALLOCATE and MOUNT/FOREIGN commands are included in this command procedure. Using a text editor, construct the command procedure as shown in the example.

Example 9-1 Command Procedure to Set Up Tape Volumes

    $ ! First mount the tape on the drive
    $ ON CONTROL_Y THEN GOTO EXIT
    $ ON ERROR THEN GOTO EXIT
    $ WRITE SYS$OUTPUT "Welcome to FETCH."
    $ WRITE SYS$OUTPUT " "
    $ L1:  INQUIRE/NOPUNC PHYS "Have you placed the volume in the drive? "
    $ IF .NOT. PHYS THEN GOTO L1
    $ INQUIRE/NOPUNC DRIVE "Which drive is the volume mounted on? "
    $ DRIVE = DRIVE - ":"
    $ ALLOCATE 'DRIVE'
    $ MOUNT/FOREIGN 'DRIVE'
    $ ON ERROR THEN GOTO COMMAND_LOOP
    $ !
    $ COMMAND_LOOP:  INQUIRE/NOPUNC OPTION "FETCH> "
    $ IF OPTION .EQS. "DIR" THEN GOTO DIR
    $ IF OPTION .EQS. "EXIT" THEN GOTO EXIT
    $ IF OPTION .EQS. "FETCH" THEN GOTO FETCH
    $ IF OPTION .EQS. "HELP" THEN GOTO HELP
    $ IF OPTION .EQS. "LIST" THEN GOTO LIST
    $ GOTO COMMAND_LOOP
    $ !
    $ DIR:  INQUIRE SPEC "Filespec"
    $ DIR 'SPEC'
    $ GOTO COMMAND_LOOP
    $ HELP:
    $ WRITE SYS$OUTPUT "Enter any of the following commands at the prompt:"
    $ WRITE SYS$OUTPUT " "
    $ WRITE SYS$OUTPUT " "
    $ WRITE SYS$OUTPUT "DIR         (To search for a file)"
    $ WRITE SYS$OUTPUT " "
    $ WRITE SYS$OUTPUT "EXIT        (To exit this program)"
    $ WRITE SYS$OUTPUT " "
    $ WRITE SYS$OUTPUT "FETCH       (To perform a BACKUP RESTORE operation)"
    $ WRITE SYS$OUTPUT " "
    $ WRITE SYS$OUTPUT "HELP        (To read this text)"
    $ WRITE SYS$OUTPUT " "
    $ WRITE SYS$OUTPUT "LIST        (To perform a BACKUP LIST operation)"
    $ GOTO COMMAND_LOOP
    $ !
    $ FETCH:  INQUIRE FILE "Filespec"
    $ INQUIRE SAVESET "Save set name"
    $ LINE := BACKUP/LOG 'DRIVE':'SAVESET'/SELECT='FILE'
    $ INQUIRE EXCLUDE "Enter any filespecs you want excluded"
    $ IF EXCLUDE .EQS. "" THEN GOTO L2
    $ LINE := 'LINE'/EXCLUDE=('EXCLUDE')
    $ !
    $ L2:  INQUIRE/NOPUNC TO "Where do you want the file(s)? ([RET] for current directory)"
    $ IF TO .EQS. "" THEN GOTO REPLACE
    $ LINE := 'LINE' 'TO'
    $ GOTO L3
    $ REPLACE:  LINE := 'LINE' []
    $ !
    $ L3:  INQUIRE/NOPUNC NEW "Create a new version if file already exists? "
    $ IF .NOT. NEW THEN GOTO NOT
    $ LINE := 'LINE'/NEW_VERSION
    $ !
    $ NOT:  LINE := 'LINE'/OWNER_UIC=ORIGINAL
    $ LINE
    $ GOTO COMMAND_LOOP
    $ !
    $ LIST:  INQUIRE SPEC "Filespec"
    $ INQUIRE SAVESET "Save set name"
    $ INQUIRE/NOPUNC OUTPUT "What do you want to call the list file? ([RET] for SYS$OUTPUT )"

    $ IF OUTPUT .EQS. "" THEN GOTO NOOUT
    $ LINE := BACKUP/LIST='OUTPUT' 'DRIVE':'SAVESET'/SELECT=('SPEC')
    $ GOTO L4
    $ NOOUT:  LINE := BACKUP/LIST 'DRIVE':'SAVESET'/SELECT=('SPEC')
    $ !
    $ L4:  INQUIRE EXCLUDE "Enter any filespecs you want excluded"
    $ IF EXCLUDE .EQS. "" THEN GOT L5
    $ LINE := 'LINE'/EXCLUDE=('EXCLUDE')
    $ !
    $ L5:  LINE
    $ GOTO COMMAND_LOOP
    $ !
    $ EXIT:
    $ DISMOUNT 'DRIVE'
    $ DEALLOCATE 'DRIVE'

Assuming this command procedure is in a file named FETCH.COM, execute the command procedure by entering the following command:

    $ @FETCH

In addition to allocating and mounting functions, as in the previous example, FETCH.COM prompts you for input. For example, it specifically asks you if the tape is on the drive. Also note that FETCH.COM does a BACKUP restore operation. It prompts you for specific options on the restore operation. Finally, FETCH.COM explicitly dismounts your magnetic tape volume and deallocates the drive after your task completes.

## 9.11 Managing Disk Space

Disk space available for files is finite. You share responsibility with your users for making the best use of disk space.

The following sections explain disk quotas and describe some methods you can use to conserve and monitor disk space:

Method | Section
--- | ---
Establish disk quotas | Section 9.11.2
Purge files | Section 9.11.3
Set version limits on files | Section 9.11.4
Set file expiration dates | Section 9.11.5
Analyze and repair error conditions | Section 9.12

### 9.11.1 Understanding Disk Quotas

A disk quota is a method for maintaining and enforcing limits on the amount of disk space available to users on a public volume. You limit the amount of space available to individual users on public volumes (or volume sets) by creating and maintaining a quota file on each volume. Individual users can similarly restrict usage on private volumes.

Quotas are maintained and enforced on a per-volume basis. Each volume or volume set has its own quota file. A volume on which quotas are not maintained has no quota file. On a volume set, volume 1 contains the quota file.

With OPER privilege, you (or the user maintaining the volume) supply identifiers and assign quotas and overdrafts with the System Management utility (SYSMAN). (During normal file activities, the system automatically maintains usage counts.)

If users run out of disk space during the creation of a file, they receive a system message. If they cannot obtain sufficient space by purging or deleting unnecessary files, they might contact you to increase their disk quota. If they attempt to write a file to a spooled printer, they must have write access and have sufficient quota on the disk associated with that printer.

Disk Quota File

A quota file records all users who are allowed to use the disk, and shows their current disk usage and their maximum disk allocation. A quota file, QUOTA.SYS, which is stored in directory [000000] with other system files, requires one block of disk storage for every 16 entries.

A quota file has the following format:

       UIC (1)
             Usage (2)
           Permanent Quota (3)
      Overdraft Limit (4)

    [0,0]             0               333333              3333
    [TTD,DAVIS]       15590           333333              3333
    [TTD,MORGAN]      1929            333333              3333
    [MKT,MORSE]       7650            333333              3333
    .
    .
    .

1. User identification code (UIC) of each user entitled to maintain files on the volume. UIC [0,0] appears in all quota files; use it as a template to set default values for quotas and overdrafts.
2. Number of disk blocks currently dedicated to a user's files. This number includes the blocks allocated (shown by the DCL command DIRECTORY /SIZE=ALL /BY_OWNER=uic), plus at least one block in the index file for every file owned by the user.
3. Maximum number of blocks on the volume that a user's files can occupy. When the maximum number is exceeded, the system issues an error message when a file is created.
4. Number of blocks by which a user can exceed the quota.

Each entry in a quota file includes the information shown in Table 9-17.

Table 9-17 Contents of a Quota File
Item | Description
--- | ---
General Identifier or UIC | Identification code of a user entitled to maintain files on the volume
Usage | Number of blocks on the volume taken up by the user's files
Quota | Maximum number of blocks on the volume that the user's files can take up before an error message is issued
Overdraft | Number of blocks over the quota that the user's files can take up

The maximum number of blocks permitted to a user on a volume is the sum of the quota and the overdraft.

A quota file is initialized with an entry for UIC [0,0]. The usage count for this UIC should not change from 0; in other words, UIC [0,0] should own no files. Its quota and overdraft, however, serve as defaults in certain situations; set them to values most likely to be assigned to other UICs as quotas and overdrafts.

How Quotas Are Maintained

During normal use of a volume with a quota file, the system automatically updates the usage counts as users create, delete, extend, and truncate files. Users without entries in the quota file are not allowed to create files or allocate space on the volume unless they have the EXQUOTA privilege.

To create new files, a user must have disk space usage below quota (not overdraft). If adding a new file or expanding a current file exceeds a user's quota, the system prohibits the operation and issues an error message.

A user with an overdraft might be able to extend an open file after exceeding the disk quota (for example, during an editing session). A user can extend an open file until usage exceeds the sum of the quota and the overdraft. At this point, the system prohibits further extensions to the file.

Quota restrictions are not enforced for users with the EXQUOTA privilege; however, their usage counts are maintained.

How the Rebuild Operation Ensures Quota File Accuracy

When you mount a volume that was not properly dismounted the last time it was used, the system performs an automatic REBUILD operation. If quotas are enforced on the volume, this action ensures that the quota file accurately reflects usage of the disk, under any of the following conditions:

- The system fails
- The volume is physically removed before being dismounted
- A user presses the WRITE PROTECT button

### 9.11.2 Establishing Disk Quotas

Disk quota operations are enabled by default. However, you can use SYSMAN DISKQUOTA commands to control disk usage. You can assign disk quotas to users and maintain an accurate record of disk use for ODS Level 2 or 5 disks. You create a quota file for each disk except the system disk. The quota file records the current usage and the maximum disk usage for all users.

SYSMAN allows you to access disks that are normally unavailable from your local node. With SYSMAN, you can obtain a display of all disks on the other nodes, including those that are mounted privately or used as system disks. You can run DISKQUOTA on any available disk without logging in to each node.

#### 9.11.2.1 Creating a Quota File

The first step in allocating disk space is to create a quota file for each volume or each volume set. The absolute maximum number of blocks permitted a user on a volume is the sum of the quota and the overdraft. Only users with the EXQUOTA privilege can bypass disk quota restrictions.

How to Perform This Task

Creating a quota file requires SYSPRV, BYPASS, or GRPPRV privilege. To create a quota file on a disk using SYSMAN commands:

1. Use the DISKQUOTA CREATE command and specify the target disk with the /DEVICE qualifier using the following format:

   `DISKQUOTA CREATE/DEVICE=device-spec`

   Note To use the DISKQUOTA ENABLE command on a disk that has been mounted on multiple nodes in a cluster, you must first specify the nodes in the SET ENVIRONMENT command.

2. Use the DISKQUOTA MODIFY command to adjust [0,0] to an appropriate value for the device using the following format:

   `DISKQUOTA MODIFY/DEVICE=device-spec/PERMQUOTA=value`

   Note If you create a quota file or enable disk quotas on a disk that has files on it, use the DISKQUOTA REBUILD command to update the disk quota entries with the current usage information.

3. Use the DISKQUOTA SHOW command to display the quota file using the following format:

   `DISKQUOTA SHOW owner/DEVICE=device-spec`

Examples

1.     $ MCR SYSMAN
       SYSMAN> SET ENVIRONMENT/CLUSTER
       SYSMAN> DISKQUOTA CREATE/DEVICE=DUA12:

   The first SYSMAN command in this example sets the environment for all nodes in the cluster. The second SYSMAN command sets up the quota file, QUOTA.SYS, in directory [000000] on the DUA12: device.
   The quota file has one entry, UIC [0,0], that stores default values for quotas and overdrafts.

2.     SYSMAN> DISKQUOTA MODIFY/DEVICE=DUA12: [0,0]/PERMQUOTA=3000

   The command in this example edits the entry for UIC [0,0] in the quota file on the DUA12: device, setting the default permanent quota to 3000 blocks.

3.     SYSMAN> DISKQUOTA SHOW [0,0]/DEVICE=DUA12:

   The command in this example shows quotas, overdrafts, and usage counts for UIC [0,0] on the DUA12: device.

Previous | Next | Contents | Index

| privacy and legal statement |
6017PRO_037.HTML