(edited 9-Jul-91) (Using the Logical Disk (LD) Utility\int_LD_CHAP)

This chapter describes using the logical disk subsetting utility (LD) that is distributed with RT--11. You can use LD to divide a portion of a large disk into smaller logical disks. Each logical disk is a file; a logical disk file. Once a logical disk file is mounted and given a file structure, it becomes a logical disk unit and can be treated like any data device. As LD is distributed, you can access up to eight logical disk units at one time. You can also perform a system generation (SYSGEN) and request extended device-unit support, letting you access up to 32(10) logical disk units at the same time.

This chapter provides the following information: (unnumbered) Reasons for using LD Creating logical disk files Mounting and initializing logical disk units Nesting logical disk units Using logical disk units (an exercise) Enlarging logical disks

Use the on-line index utility, INDEX, and the on-line help utility, HELP, to find more information on topics described in this chapter. (Should You Use Logical Disks?)

You might create logical disks on your computer system for any of the following reasons: (UNNUMBERED) You are working with files that can be logically divided into groups and you want to keep those groups separate.

You can use logical disks to store sets of files and assign a logical disk as your default data device. Storing all files of a group on one or more logical disks can help you keep track of those files.

You can nest logical disks within another logical disk. Thus, you can organize sets of files, each set in its own logical disk, within a larger group of files on a logical disk. You want to create logical disks of the same size as another type of device.

If your computer system is made up of a large fixed disk drive and a smaller removable diskette drive, you can divide a portion of the large disk into a series of logical disks of the smaller drive size. Copy and backup operations between the fixed and removable disks can then be done as device-to-device rather than file-to-file operations. You have exceeded the number of directory entries supported by your physical disk.

Each type of physical disk, by default, supports a certain number of directory segments and therefore directory entries. With a large number of small files, you can exceed that number of directory entries while still having free space on the disk. Because each logical disk has its own directory, dividing a physical disk into logical disks creates more directory entry space on the physical disk. (Distributed or Extended Device-Unit Support?)

As distributed, RT--11 supports access of up to eight logical disk units at one time. If you perform a system generation (SYSGEN) and request extended device-unit support, you can access up to 32(10) logical disk units at one time. Information on generating support for extended device units can be found in the (Mas_book).

This chapter illustrates using LD with the distributed support. However, the procedures for creating and using logical disks are the same for the distributed support and extended device-unit support. You can use the information and exercises in this chapter with either support. (Creating Logical Disk Files)

You can create any number of logical disk files on a device. As LD is distributed, however, you can access only eight of them at one time.

The following information pertains to creating logical disk files: (UNNUMBERED) You use the CREATE command to create a logical disk file on a device. The handler for the device on which you create a logical disk file does not need to be loaded. You use the /ALLOCATE:size option with the CREATE command to set the number of decimal blocks you want for the logical disk file.

The usable size of the logical disk file will be smaller than the size you allocate, because the logical disk must also contain the file directory. The number of blocks used for the file directory structure is determined by the size of the file. For example, a 100-block logical disk file uses an 8-block file directory structure; a 6000-block file uses a 38-block file directory structure. Although not a requirement, all logical disk files should be created with the file type .DSK. RT--11 assumes the file type .DSK if it is not specified in a command. Also, using the .DSK file type lets you easily find all the logical disks files on a physical disk. You should assign a mnemonic file name to the logical disk that reminds you what that logical disk file contains.

The following command syntax creates a logical disk file. In the command, (ddn) represents the device and unit number on which you are creating the logical disk file, (file) is the name, and (nnnnnn) is the file size in decimal blocks. .CREATE ddn:file.DSK/ALLOCATE:nnnnnn (RET) (Associating the Logical Disk File with a Logical Disk Unit)

The logical disk utilities (LD.SYS or LDX.SYS) each contain a set of tables that associate logical disk files with up to eight logical device unit numbers, LD0 through LD7. You can also optionally assign a logical device name of 1--3 characters to a logical disk unit. That name must begin with an alphabetic character. The association (but not any name assignment) is maintained until you change it; the tables are not destroyed even when you shut off your computer.

The MOUNT command associates a logical disk file with one of the eight logical disk units. The file is protected from deletion once you associate it with a unit. The handler for the device containing the file must be loaded. If the handler is not loaded, the MOUNT command loads the handler. However, if you explicitly unload that device handler or reboot your processor and do not again load that handler, the association is lost. You can regain that association by again loading that device handler.

The following command syntax associates a logical disk file with a logical disk unit. In the command, (LDn) represents a logical disk unit between LD0 and LD7, (ddn) represents the device containing the logical disk file, and (nam) represents a logical device name you can optionally assign to that logical disk unit. .MOUNT LDn: ddn:file.DSK [nam] (RET)

You can make a read-only logical disk unit, using the MOUNT command /READONLY option. If you make a logical disk unit read only and later decide to allow writing to it, you can issue the SET command WRITE condition for that unit (SET LDn WRITE) or mount it again and include the /WRITE option.

Once you have associated a logical disk file with a logical disk unit, you direct all commands and operations to that unit. If you have assigned a logical device name to that unit, you can direct commands and operations to that name. (Making the Logical Disk Usable)

The first association of a logical disk file with a unit does not make that logical disk usable. You must create a file directory structure on that logical disk before you can use it. You use the INITIALIZE command to create a file directory structure on a logical disk, just as you do on a physical disk. As a safety measure, you should always perform a directory operation on a logical disk before initializing it to be sure it does not already contain a directory structure and files. Performing a directory operation on an uninitialized logical disk returns the error message, ?DIR-F-Invalid directory.

The following command syntax initializes a logical disk. In the command syntax, (LDn) represents the logical disk unit you associated with a logical disk file. You can optionally use the INITIALIZE command /NOQUERY option to suppress the RT--11 (Foreground loaded; Are you sure?) prompt. .INITIALIZE/NOQUERY LDn: (RET)

Once you create a file directory structure on the logical disk file associated with unit LDn, you can use it as though it were a physical disk. If you break the association between that logical disk file and unit LDn (perhaps to associate a different logical disk file with unit LDn), you can use that logical disk file again by associating it with unit LDn or a different unit. (Changing and Displaying the Logical Disk Association)

As distributed, RT--11 allows you eight logical disk associations at one time, though you can have far more than eight logical disks on your system. Therefore, as you work with your logical disks, you can periodically change the logical disks you have associated with your available eight logical disk units. If you find you must repeatedly change logical disk associations, you should investigate generating support for extended device units for LD.

Use the following command to determine the status of your logical disk unit associations: (.)(SHOW SUBSET (RET))

Just as you use the MOUNT command to associate a logical disk with a logical disk unit, you can use the DISMOUNT command to break the association between a logical disk and a logical disk unit. Use the following command syntax, where LDn represents that logical disk unit: .DISMOUNT LDn: (RET) (Nesting Logical Disks)

You can include (nest) one or more logical disks within a larger logical disk. You may, for example, have one or more subclasses of files that can be logically grouped within a larger class of files. You can create a primary logical disk for the entire class of files and nest a logical disk for each of the subclasses of files.

Think of a logical disk as a box that can contain up to 65K blocks. That box can contain files and other nested logical disks. Those nested logical disks are also boxes that can contain files and other nested logical disks, and so on. The total size of all files and nested logical disks in the primary logical disk cannot exceed 65K blocks.

You must associate a higher unit number with a nested logical disk than that associated with the primary logical disk. For example, assume you intend to mount a primary logical disk file and three logical disk files that are nested within it. Assume also that you have already mounted two logical disk files and associated them with unit numbers LD0 and LD1. You would probably want to associate the primary logical disk file with unit number LD2 and the three nested logical disk files with unit numbers LD3, LD4, and LD5.

A method for nesting logical disk files follows. The commands used are explained in the previous sections. (NUMBERED) Create a primary logical disk file large enough to hold the files and nested logical disks you foresee it containing. Use the CREATE command with the /ALLOCATE option. Use the MOUNT command to associate that logical disk file with a logical disk unit. Assume you are associating that file with unit LD0. Use the INITIALIZE command to initialize that logical disk unit. The two ways to nest logical disks are: (UNNUMBERED) You can nest logical disks that already exist. Use the COPY command to copy those logical disk files you want to nest to the primary logical disk unit. Then, do a directory operation on the primary logical disk unit to verify the presence of the nested logical disk files and that the number of free blocks is as you expect. You can also use the CREATE command and the /ALLOCATE option to create nested logical disk files in the primary logical disk unit.

Assume you are creating three logical disk files to nest in the primary logical disk unit. You can create and nest any number of logical disk files, limited only by the device size of the primary logical disk.

Recall that the primary logical disk file was mounted as LD0. The following series of commands creates three nested logical disk files, FIRST.DSK, SECND.DSK, and THIRD.DSK, on the primary logical disk you associated with LD0. The size you allocate to each file is represented by (nnnnnn): (.)(CREATE LD0:FIRST.DSK/ALL:nnnnnn (RET)) (.)(CREATE LD0:SECND.DSK/ALL:nnnnnn (RET)) (.)(CREATE LD0:THIRD.DSK/ALL:nnnnnn (RET)) Associate each of the nested logical disk files in the primary logical disk unit with a different unit number. Each nested logical disk unit number must be higher than the primary logical disk unit number. Recall that the nested logical disk files were created as FIRST.DSK, SECND.DSK, and THIRD.DSK, and that the primary logical disk file was mounted as unit LD0. Given that, the series of commands to mount the nested logical disk files could be: (.)(MOUNT LD1: LD0:FIRST.DSK (RET)) (.)(MOUNT LD2: LD0:SECND.DSK (RET)) (.)(MOUNT LD3: LD0:THIRD.DSK (RET))

The first association of each logical disk file protects it from deletion. Therefore, FIRST.DSK, SECND.DSK, and THIRD.DSK are now protected from deletion. Initialize logical disks LD1, LD2, and LD3: (.)(INITIALIZE/NOQUERY LD1: (RET)) (.)(INITIALIZE/NOQUERY LD2: (RET)) (.)(INITIALIZE/NOQUERY LD3: (RET)) Issue the following command to verify the status of the logical disks: (.)(SHOW SUBSET (RET)) Do a directory operation on the physical device containing logical disk LD0. Note that only the primary logical disk file is displayed. You need to mount that logical disk file and do a directory operation to display the nested logical disk files. Therefore, you cannot access a mounted nested logical disk unless the primary logical disk is also mounted. If you dismount (break the association between) the primary logical disk file and its unit without first dismounting nested logical disk unitss, you should issue the following command to free the nested logical disk units: (.)(SET LD CLEAN (RET)) (Using the Logical Disk)

Once you create a logical disk file, associate that file with a logical disk unit, and initialize it, you can use resulting logical disk like a physical disk. You can write to it, read from it, and use it as your default data (DK) device.

In the following exercises, you create a logical disk file and associate it with a logical disk unit. You initialize that logical disk, examine its directory size, and perform directory operations to it. You create a nested logical disk within the primary logical disk and examine their relationship. Finally, you dismount and delete both logical disks. This exercise uses your default data (DK) device; you can create and use logical disks with any disk on your system. (NUMBERED) Ensure that LD is installed on your system. Determine the decimal number of free blocks on your current default data (DK) device by issuing the following command: (.)(DIR/FREE (RET)) The following command creates a 100-block logical disk file on your DK device. If the previous command did not display any free block region of at least 100 blocks, use the largest displayed free block region rather than (100) in the following command: (.)(CREATE INTRO.DSK/ALLOCATE:100 (RET))

RT--11 creates the logical disk file INTRO.DSK. Display all file entries in your DK device of type .DSK: (.)(DIRECTORY *.DSK (RET))

That command should display the file entry INTRO.DSK. Associate the logical disk file INTRO.DSK with logical disk unit LD0: (.)(MOUNT LD0: DK:INTRO.DSK (RET))

The first association of any logical disk file with a logical disk unit causes RT--11 to protect that disk from deletion. Also, if not already loaded, the MOUNT command causes RT--11 to load the handler for the device containing the logical disk. (For the logical disk to associate with the logical disk unit, the handler for the device containing the logical disk must be loaded.) Once you have associated a logical disk file with a logical disk unit, you direct all commands and operations to the logical disk unit. Initialize logical disk unit LD0: (.)(INITIALIZE/NOQUERY LD0: (RET)) Examine the directory of logical disk unit LD0: (.)(DIRECTORY LD0: (RET))

Note that although you allocated 100 blocks for LD0, the directory command displays a 92-block device. The 8-block difference is the file directory structure for the logical disk file mounted on unit LD0. Examine the status of your logical disk units: (.)(SHOW SUBSET (RET)) Create a 30-block nested logical disk file, NEST.DSK, in the logical disk mounted on LD0. Mount NEST.DSK on logical disk unit LD1 and initialize it. (.)(CREATE LD0:NEST.DSK/ALLOCATE:30 (RET)) (.)(MOUNT LD1: LD0:NEST.DSK (RET)) (.)(INITIALIZE/NOQUERY LD1: (RET))

Do a directory operation on your DK device for files of the type .DSK and note that NEST.DSK does not appear. Do a directory operation on LD0 to display NEST.DSK. Do a directory operation on LD1 and note its size. (.)(DIRECTORY *.DSK (RET)) (.)(DIRECTORY LD0: (RET)) (.)(DIRECTORY LD1: (RET))

Issue the following command to display the relationship between the nested and primary logical disk units: (.)(SHOW SUBSET (RET)) Break the association between nested logical disk file NEST.DSK and logical disk unit LD1 and between INTRO.DSK and LD0: (.)(DISMOUNT LD1: (RET)) (.)(DISMOUNT LD0: (RET)) Unprotect logical disk file INTRO.DSK: (.)(UNPROTECT INTRO.DSK (RET)) Delete logical disk files NEST.DSK and INTRO.DSK. Since NEST.DSK is nested in INTRO.DSK, deleting INTRO.DSK also deletes NEST.DSK. (.)(DELETE INTRO.DSK (RET)) (Enlarging Logical Disks)

Do not worry that a primary logical disk may become too small to contain further files and nested logical disks (if you have not already allocated it the 65K-block limit). Assuming you have enough space on a physical disk, you can always make that primary logical disk larger. Take the following steps: (NUMBERED) Use the MOUNT command to associate the smaller logical disk file (the one you are enlarging) with a logical disk unit. Use the CREATE command to create a larger logical disk file, TEMP.DSK. Use the /ALLOCATE option to specify the new size. This larger logical disk file does not need to be on the same physical device as the smaller logical disk file. Use the MOUNT command to associate the larger logical disk file with a logical disk unit. Initialize that larger logical disk unit. Copy the files and nested logical disks from the smaller logical disk to the larger logical disk. If the smaller logical disk is mounted as LD0 and the larger is mounted as LD1, the command is: .COPY/SYSTEM/VERIFY LD0:*.* LD1:*.* (RET)

The /VERIFY option causes RT--11 to perform error checking during the copy operation. Depending on the size of the logical disks and the type of physical device involved, this operation can take some time. When the copy operation completes, you might back up the contents of the smaller logical disk file. You can then dismount it, unprotect it, and delete it.

You can then dismount TEMP.DSK from LD1, rename TEMP.DSK to the name you had assigned the smaller logical disk file, and perhaps finally mount the renamed file on whatever logical disk unit you previously associated with the smaller logical disk file.