Chapter 4. XLV Logical Volumes

This chapter provides an overview of the XLV Volume Manager and explains how to create and administer XLV logical volumes. The use of logical volumes enables the creation of filesystems or raw devices that span more than one disk partition. Logical volumes behave like regular disk partitions. Filesystems can be created, mounted, and used in the normal way, or they can be used as raw devices.

This chapter contains these main sections:


Note: One feature of the XLV Volume Manager described in this chapter, plexing (mirroring), is available only when you purchase the Disk Plexing Option software option. See the plexing Release Notes for information on purchasing this software option and obtaining the required NetLS license.


XLV Overview

Traditionally, UNIX systems represent disk partitions as block and character devices. These “devices” are actually kernel-based interfaces that allow applications to access the partitions on either a character or block basis. The actual disk interactions are performed by disk device drivers.

Some applications, such as high-performance databases, access these partition devices directly for maximum performance. However, most applications simplify their disk access by interfacing with filesystems. Filesystems isolate applications from the concerns of disk management by providing the familiar file and directory model for disk access.

XLV interposes another layer into this model by building logical volumes (also known as volumes) on top of the partition devices. Volumes appear as block and character devices in the /dev directory. Filesystems, databases, and other applications access the volumes rather than the partitions. Logical volumes provide services such as disk plexing (also known as mirroring) and striping transparently to the applications that access the volumes. A logical volume might include partitions from several physical disk drives and, thus, be larger than any of the physical disks. EFS or XFS filesystems can be made on XLV logical volumes.

Composition of Logical Volumes

Logical volumes are composed of a hierarchy of logical storage objects: volumes are composed of subvolumes, subvolumes are composed of plexes, and plexes are composed of volume elements. Volume elements are composed of disk partitions. This hierarchy of storage units is shown in Figure 4-1, an example of a relatively complex logical volume.

Figure 4-1. Logical Volume Example


Figure 4-1 illustrates the relationships between volumes, subvolumes, plexes, and volume elements. In this example, six physical disk drives contain eight disk partitions. The logical volume has a log subvolume, a data subvolume, and a real-time subvolume. The log subvolume has two plexes (copies of the data) for higher reliability and the data and real-time subvolumes are not plexed (meaning that they each consist of a single plex). The log plexes each consist of a volume element which is a disk partition on disk 1. The plex of the data subvolume consists of two volume elements, a partition that is the remainder of disk 1 and a partition that is all of disk 2. The plex used for the real-time subvolume is striped for increased performance. The striped volume element is constructed from four disk partitions, each of which is an entire disk.

The subsections below describe these logical storage objects in more detail.

Volumes

Volumes are composed of subvolumes. For EFS filesystems, a volume consists of just one subvolume. For XFS filesystems, a volume consists of a data subvolume, an optional log subvolume, and an optional real-time subvolume. The breakdown of a volume into subvolumes is shown in Figure 4-2.

Figure 4-2. Volume Composition


Each volume can be used as a single filesystem or as a raw partition. Volume information used by the system during system startup is stored in disk labels on each disk used by the volume. At system startup, volumes won't come up if any of their subvolumes cannot be brought online. You can create volumes, delete them, and move them to another system.

Subvolumes

As explained in the section“Volumes,” each logical volume is composed of one to three subvolumes, as shown in Figure 4-3. A subvolume is made up of one to four plexes.

Figure 4-3. Subvolume Composition


Each subvolume is a distinct address space and a distinct type. The types of subvolumes are:

Data subvolume 


The data subvolume is required in all logical volumes. It is the only subvolume present in EFS filesystems.

Log subvolume 

The log subvolume contains XFS journaling information. It is a log of filesystem transactions and is used to expedite system recovery after a crash. Log information is sometimes put in the data subvolume rather than in a log subvolume (see the section “Choosing the Log Type and Size” in Chapter 2 and the mkfs_xfs(1M) reference page and its discussion of the –l option for more information).

Real-time subvolume 


Real-time subvolumes are generally used for data applications such as video, where guaranteed response time is more important than data integrity. The section “Using the Real-Time Subvolume” in this chapter and Chapter 5, “Guaranteed-Rate I/O,” explain how applications access data on real-time subvolumes.

Subvolumes enforce separation among data types. For example, user data cannot overwrite filesystem log data. Subvolumes also enable filesystem data and user data to be configured to meet goals for performance and reliability. For example, performance can be improved by putting subvolumes on different disk drives.

Each subvolume can be organized independently. For example, the log subvolume can be plexed for fault tolerance and the real-time subvolume can be striped across a large number of disks to give maximum throughput for video playback.

Volume elements that are part of a real-time subvolume should not be on the same disk as volume elements used for data or log subvolumes. This is a recommendation for all files on real-time subvolumes and required for files used for guaranteed-rate I/O with hard guarantees. (See “Hardware Configuration Requirements for GRIO” in Chapter 5 for more information.)

You can create subvolumes, but you cannot detach them from their volumes or delete them. A subvolume is automatically deleted when the volume is deleted.

Plexes

A subvolume can contain from one to four plexes (sometimes called mirrors). Each plex contains a portion or all of the subvolume's data. By creating a volume with multiple plexes, system reliability is increased.

If there is just one plex in a subvolume, that plex spans the entire address space of the subvolume. However, when there are multiple plexes, individual plexes can have holes in their address spaces as long as the union of all plexes spans the entire address space.

Normally, data is written to all plexes. However, when necessary (for example when an additional plex is added to a subvolume), a full plex copy, called a plex revive, is done automatically by the system. See the xlv_assemble(1M) and xlv_plexd(1M) reference pages for more information.

A plex is composed of one or more volume elements, as shown in Figure 4-4, up to a maximum of 128 volume elements. Each volume element represents a range of addresses within the subvolume.

Figure 4-4. Plex Composition


When a plex is composed of two or more volume elements, it is said to have concatenated volume elements. With concatenation, data written sequentially to the plex is also written sequentially to the volume elements; the first volume element is filled, then the second, and so on. Concatenation is useful for creating a filesystem that is larger than the size of a single disk.

You can add plexes to subvolumes, detach them from subvolumes that have multiple plexes (and possibly attach them elsewhere), and delete them from subvolumes that have multiple plexes.


Note: To have multiple plexes, you must purchase the Disk Plexing Option software option and obtain and install a NetLS license.


Volume Elements

The simplest type of volume element is a single disk partition. The two other types of volume elements, striped volume elements and multipartition volume elements, are composed of several disk partitions. Figure 4-5 shows a single partition volume element.

Figure 4-5. Single Partition Volume Element Composition


Figure 4-6 shows a striped volume element. Striped volume elements consist of two or more disk partitions, organized so that an amount of data called the stripe unit is written to each disk partition before writing the next stripe unit-worth of data to the next partition.

Figure 4-6. Striped Volume Element Composition


Striping can be used to alternate sections of data among multiple disks. This provides a performance advantage by allowing parallel I/O activity.

Figure 4-7 shows a multipartition volume element in which the volume element is composed of more than one disk partition. In this configuration, the disk partitions are addressed sequentially.

Figure 4-7. Multipartition Volume Element Composition


Any mixture of the three types of volume elements (single partition, striped, and multipartition) can be concatenated in a plex.

Logical Volume Naming

Volumes appear as block and character devices in the /dev directory. The device names for logical volumes are /dev/dsk/xlv/<volume_name> and /dev/rdsk/xlv/<volume_name>, where <volume_name> is a volume name specified when the volume is created using xlv_make(1M).

When a volume is created on one system and moved (by moving the disks) to another system, the new volume name is the same as the original volume name with the hostname of the original system prepended. For example, if a volume called xlv0 is moved from a system called engrlab1 to a system called engrlab2, the device name of the volume on the new system is /dev/dsk/xlv/engrlab1.xlv0 (the old system name engrlab1 has been prepended to the volume name xlv0).

XLV Daemons

The XLV daemons are:

xlv_labd  

xlv_labd(1M) writes disk labels. It is started automatically at system startup if it is installed and there are active XLV logical volumes.

xlvd  

xlvd(1M) handles I/O to plexes and performs plex error recovery. It is created automatically during system startup if plexing software is installed and there are active XLV logical volumes.

xlv_plexd  

xlv_plexd(1M) is responsible for making all plexes within a subvolume have the same data. It is started automatically at system startup if there are active XLV logical volumes.

XLV does not require an explicit configuration file, nor is it turned on and off with chkconfig(1M). XLV is able to assemble logical volumes based solely upon information written in the disk labels. During initialization, the system performs a hardware inventory, reads all the disk labels, and automatically assembles the available disks into volumes.

If some disks are missing, XLV checks to see if there are enough volume elements among the available plexes to map the entire address space. If the whole address space is available, XLV brings the volume online even if some of the plexes are incomplete.

XLV Error Policy

For read failures on log and data subvolumes, XLV rereads from a different plex (when available) and attempts to fix the failed plex by rewriting the results. XLV does not retry on failures for real-time data.

For log and data subvolumes, XLV assumes that the write errors it receives are hard errors (the disk driver and controllers handle soft errors). If the volume element with a hard error is plexed, XLV marks the volume element bad and ignores it. If the volume element is not plexed, the volume element remains associated with the volume and an error is returned.

XLV doesn't handle write errors on real-time subvolumes. Incorrect data is returned without error messages.

Planning a Logical Volume

The following subsections discuss topics to consider when planning a logical volume.

Don't Use XLV When ...

There are some situations where logical volumes cannot be used or are not recommended:

  • Swap space cannot be a logical volume.

  • Logical volumes aren't recommended on systems with a single disk.

  • Striped or concatenated volumes cannot be used for the root filesystem.

Deciding Which Subvolumes to Use

The basic guidelines for choosing which subvolumes to use with EFS filesystems are:

  • Only data subvolumes can be used.

  • The maximum useful size of a data subvolume (and therefore the volume) on EFS is 8 GB.

The basic guidelines for choosing which subvolumes to use with XFS filesystems are:

  • Data subvolumes are required.

  • Log subvolumes are optional. If they are not used, log information is put into an internal log in the data subvolume (by giving the –l internal option to mkfs).

  • Real-time subvolumes are optional.

Choosing Subvolume Sizes

The basic guidelines for choosing subvolume sizes are:

  • The maximum size of a subvolume is one terabyte.

  • When real-time subvolumes are used, make a small log subvolume and a small data subvolume. Don't put much (if any) user data in the filesystem, just real-time data.

  • Choosing the size of the log (and therefore the size of the log subvolume) is discussed in the section “Choosing the Log Type and Size” in Chapter 2. Note that if you do not intend to repartition a disk to create an optimal-size log partition, your choice of an available disk partition may determine the size of the log.

Plexing

The basic guidelines for plexing are:

  • Use plexing when high reliability and high availability of data are required.

  • Plexes can have “holes” in them, portions of the address range not contained by a volume element, as long as at least one of the plexes in the subvolume has a volume element with the address range of the hole.

  • The volume elements in each plex of a subvolume must be identical in size with their counterparts in other plexes (volume elements with the same address range). The structure within a volume element (single partition, striped, or multipartition) does not have to match the structure within its counterparts.

  • To make volume elements identical in size, you may have to use dvhtool(1M). fx(1M) partitions in units of cylinders and rounds sizes to megabytes, which may not result in exactly the same number of bytes in two partitions of the “same size” on different types of disks. See the dvhtool(1M) reference page for more information.

Striping

The basic guidelines for striping are:

  • The root filesystem cannot be striped.

  • Striped volume elements must be made of disk partitions that are exactly the same size.

Concatenating Disk Partitions

The basic guidelines for the concatenation of disk partitions are:

  • The root filesystem cannot have concatenated disk partitions.

  • It is better to concatenate single-partition volume elements into a plex rather than create a single multipartition volume element. This is not for performance reasons, but for reliability. When one disk partition goes bad in a multipartition volume, all disks that contain partitions used in that volume element are taken offline.

Using xlv_make to Create Volume Objects

xlv_make(1M) is used to create volumes, subvolumes, plexes, and volume elements from unused disk partitions. It writes only the disk labels; data on the disk partitions is untouched.

After you create a volume, you must make a filesystem on it if necessary and mount the filesystem so that you can use the logical volume. See the section “Preparing a Logical Volume for Use” in this chapter for instructions.

xlv_make can be run interactively or it can take commands from an input file. The remainder of this section gives two examples of using xlv_make; the first one is interactive and the second is noninteractive.

Example 1: Simple Logical Volume

This example shows a simple logical volume composed of a data subvolume created from two entire option disks. The disks are on controller 0, units 2 and 3 (use the hinv(1M) command, for example hinv –c disk, to obtain this information). Partition 7 of each disk is normally the entire disk (use the prtvtoc(1M) command, for example prtvtoc /dev/rdsk/dks0d2vh and prtvtoc /dev/rdsk/dks0d3vh, to obtain this information).

  1. Unmount the disks that will be used in the volume if they are mounted. For example:

    # df
    Filesystem                 Type  blocks     use   avail %use  Mounted on
    /dev/root                   efs 1939714  430115 1509599  22%  /
    /dev/dsk/dks0d2s7           efs 2004550      22 2004528   0%  /d2
    /dev/dsk/dks0d3s7           efs 3826812      22 3826790   0%  /d3
    # umount /d2
    # umount /d3
    

  2. Start xlv_make:

    # xlv_make
    xlv_make>
    

  3. Start creating the volume by specifying its name, for example xlv_volume:

    xlv_make> vol xlv0
    xlv0
    

  4. Begin creating the data subvolume:

    xlv_make> data
    xlv0.data
    

    xlv_make echoes the name of each object (volume, subvolume, plex, or volume element) you create.

  5. Continue to move down through the hierarchy of the volume by specifying the plex:

    xlv_make> plex
    xlv0.data.0
    

  6. Specify the volume elements (disk partitions) to be included in the volume, for example /dev/dsk/dks0d2s7 and /dev/dsk/dks0d3s7:

    xlv_make> ve dks0d2s7
    xlv0.data.0.0
    xlv_make> ve dks0d3s7
    xlv0.data.0.1
    

    You can specify the last portion of the disk partition pathname (as shown) or the full pathname. xlv_make accepts disk partitions that are of types “xlv”, “xfs”, and “efs”. You can use other partition types, for example “lvol”, by giving the –force option, for example, ve –force dks0d2s7. xlv_make automatically changes the partition type to “xlv”.

  7. Tell xlv_make that you are finished specifying the objects:

    xlv_make> end
    Object specification completed
    

  8. Review the objects that you've specified:

    xlv_make> show
    
            Completed Objects
    (1)  vol xlv0
    ve xlv0.data.0.0 [empty]
            start=0, end=226799, (cat)grp_size=1
            /dev/dsk/dks0d2s2 (226800 blks)
    ve xlv0.data.0.1 [empty]
            start=226800, end=453599, (cat)grp_size=1
            /dev/dsk/dks0d2s3 (226800 blks)
    

  9. Write the volume information to the disk labels by exiting xlv_make:

    xlv_make> exit
    Newly created objects will be written to disk.
    Is this what you want?(yes)  yes
    Invoking xlv_assemble
    

Example 2: Striped, Plexed Logical Volume

This example shows the noninteractive creation of a logical volume from four equal-sized option disks (controller 0, units 2 through 5). Two plexes will be created with the data striped across the two disks in each plex. The stripe unit will be 128 KB.

  1. As in the previous example, unmount the disks to be used if necessary.

  2. Create a file, called xlv0.specs for example, that contains input for xlv_make. For this example and a volume named xlv0, the file contains:

    vol xlv0
    data
    plex
    ve -stripe -stripe_unit 256 dks0d2s7 dks0d3s7
    plex
    ve -stripe -stripe_unit 256 dks0d4s7 dks0d5s7
    end
    show
    exit
    

    This script specifies the volume hierarchically: volume, subvolume (data), first plex with a striped volume element, then second plex with a striped volume element. The ve commands have a stripe unit argument of 256. This argument is the number of 512-byte blocks (sectors), so 128K/512 = 256. The end command signifies that the specification is complete and the (optional) show command causes the specification to be displayed. The disk label is created by the exit command.

  3. Run xlv_make to create the volume. For example:

    xlv_make xlv0.specs 
    

Preparing a Logical Volume for Use

Once you create a logical volume with xlv_make, follow these steps to prepare it for use:

  1. If there is no filesystem on the logical volume (and you want one) or you want to switch from EFS to XFS, you must create a filesystem with mkfs(1M). See Chapter 2, “XFS Filesystem Administration.”

  2. Mount the logical volume, for example:

    mkdir /vol1 
    mount /dev/dsk/xlv/xlv0 /vol1 
    

  3. To have the logical volume mounted automatically at system startup, you must add an entry for the volume to /etc/fstab, for example:

    /dev/dsk/xlv/xlv0 /vol1 xfs rw,raw=/dev/rdsk/xlv/xlv0 0 0
    

    See the fstab(4) reference page for more information.

Converting lv Logical Volumes to XLV

This section explains the procedure for converting lv(7M) logical volumes to XLV logical volumes. The files on the logical volumes are not modified or dumped during the conversion. You must be superuser to perform this procedure.

  1. Choose new names for the logical volumes, if desired. XLV, unlike lv, only requires names to be valid filenames, so you can choose more meaningful names. For example, you can make the volume names the same as the mount points you use. If you mount logical volumes at /a, /b, and /c, you can name the XLV volumes a, b, and c.

  2. Unmount all lv logical volumes that you plan to convert to XLV logical volumes. For example:

    umount /a 
    

  3. Create an input script for xlv_make by using lv_to_xlv(1M):

    lv_to_xlv -o scriptfile 
    

    scriptfile is the name of a temporary file that lv_to_xlv creates, for example /usr/tmp/xlv.script. It contains a series of xlv_make commands that can be used to create XLV volumes that are equivalent to the lv logical volumes listed in /etc/lvtab.

  4. If you want to change the volume names, edit scriptfile and replace the names on the lines that begin with vol with the new names. For example, change:

    vol lv0 
    

    to:

    vol a 
    

    The volume name can be any name that is a valid filename.

  5. By default, all lv logical volumes on the system are converted to XLV. If you do not want all lv logical volumes converted to XLV, edit scriptfile and remove the xlv_make commands for the volumes that you do not want to change. See the section “Using xlv_make to Create Volume Objects” in this chapter and the xlv_make(1M) reference page for more information.

  6. Create the XLV volumes by running xlv_make with scriptfile as input:

    xlv_make scriptfile 
    

  7. If you converted all lv logical volumes to XLV, remove /etc/lvtab:

    rm /etc/lvtab 
    

  8. If you converted just some of the lv logical volumes to XLV, edit /etc/lvtab and remove the entries for the logical volumes you converted.

    vi /etc/lvtab 
    

  9. Edit /etc/fstab so that it automatically mounts the XLV logical volumes at startup. These changes to /etc/fstab are required for each XLV logical volume:

    • In the first field, insert the subdirectory xlv after /dev/dsk.

    • If you changed the name of the volume, for example from lv0 to a, make the change in the first field.

    • Insert the subdirectory xlv into the raw device name.

    • If you changed the name of the volume, for example from lv0 to a, make the change in the raw device.

    For example, if an original line is:

    /dev/dsk/lv0   /a efs rw,raw=/dev/rdsk/lv0 0 0
    

    The changed line, including the name change, is:

    /dev/dsk/xlv/a /a xfs rw,raw=/dev/rdsk/xlv/a 0 0
    

  10. Mount the XLV logical volume, for example:

    mount /a 
    

Using xlv_admin to Administer Logical Volumes

The xlv_admin(1M) command is used to modify logical volume objects and their disk labels after they have been created by xlv_make. xlv_admin is an interactive command with this menu:

**************** XLV Administration Menu **********
................ Add Existing Selections...........
1.      Add a ve to an existing plex. 
2.      Add a ve at the END of an existing plex. 
3.      Add a plex to an existing volume. 
................ Detach Selections................
11.     Detach a ve from an existing plex. 
12.     Detach a plex from an existing volume. 
................ Remove Selections................
21.     Remove a ve from an existing plex. 
22.     Remove a plex from an existing volume. 
................ Delete Selections................
31.     Delete an object. 
32.     Delete all XLV disk labels. 
................ Show Selections................
41.     Show object by name and type, only. 
42.     Show information for an object. 
................ Exit ................
99.     Exit 


Note: The full menu is shown above; if you do not have a valid license for the Disk Plexing Option software option, several of the plex-related menu selections do not appear.

The following subsections explain how to use xlv_admin to perform common operations.

Displaying Logical Volume Objects

To get a list of the highest-level volume objects on a system, use selection 41 of the xlv_admin menu, for example:

xlv_admin> 41

==================== Listing Objects =============
Volume Element:  'spare_ve'
Volume:          'xlv0'

In this example, there are two high-level volume objects, a volume element named spare_ve and a logical volume named xlv0. The volume element is a high-level volume object because it is not part of any plex or subvolume.

To display the complete hierarchy of a high-level volume object, use selection 42 of the xlv_admin menu, for example:

xlv_admin> 42
Please enter name of object to be operated on.
xlv_admin> xlv0

============= Displaying Requested Object ==========
vol xlv0
ve xlv0.data.0.0 [active]
        start=0, end=226799, (cat)grp_size=1
        /dev/dsk/dks0d2s7 (226800 blks)
ve xlv0.data.0.1 [active]
        start=226800, end=453599, (cat)grp_size=1
        /dev/dsk/dks0d3s7 (226800 blks)
ve xlv0.data.0.2 [active]
        start=453600, end=680399, (cat)grp_size=1
        /dev/dsk/dks0d4s7 (226800 blks)

This output shows that xlv0 contains only a data subvolume. The data subvolume has one plex that has three volume elements.

Growing a Logical Volume

Growing a logical volume (increasing its size) can be done in two ways by adding one or more volume elements to the end of one or more of its plexes.

  1. If any of the volume elements you plan to add to the volume don't exist yet, create them with xlv_make. For example, follow this procedure to create a volume element out of a new disk, /dev/dsk/dks0d4s7:

    xlv_make 
    xlv_make> ve new_ve dks0d4s7
    new_ve
    xlv_make> end
    Object specification completed
    xlv_make> exit
    Newly created objects will be written to disk.
    Is this what you want?(yes)  yes
    Invoking xlv_assemble
    

    The ve command includes a volume element name, new_ve. This is required because the volume element is not part of a larger hierarchy; it is the root object in this case.

  2. Use selection 2 of the xlv_admin command to add each volume element. For example, to add the volume element from step 1 to plex 0 of the data subvolume of the volume xlv0, use this procedure:

    xlv_admin 
    xlv_admin> 2
    Please enter name of object to be operated on.
    xlv_admin> xlv0.data.0
     Please enter the object you wish to add to the target. 
    xlv_admin> new_ve
     Please select choice...
    xlv_admin> 99 
    

  3. If you are growing an XFS filesystem, mount the filesystem if it isn't already mounted:

    mount volume mountpoint 
    

    volume is the device name of the logical volume, for example /dev/dsk/xlv/xlv0, and mountpoint is the mount point directory for the logical volume.

  4. If you are growing an XFS filesystem, use xfs_growfs(1M) to grow the filesystem:

    xfs_growfs -d mountpoint
    

    mountpoint is the mount point directory for the logical volume.

  5. If you are growing an EFS filesystem, unmount the filesystem if it is mounted:

    umount mountpoint 
    

    mountpoint is the mount point directory for the filesystem.

  6. If you are growing an EFS filesystem, use growfs(1M) to grow the filesystem:

    growfs volume 
    

    volume is the device name of the logical volume, for example /dev/dsk/lv0.

Adding a Plex to a Logical Volume

If you have purchased the Disk Plexing Option software option and have installed a NetLS license for it, you can add a plex to an existing subvolume for improved reliability in case of disk failures. The procedure to add a plex to a subvolume is described below. To add more than one plex to a subvolume or to add a plex to each of the subvolumes in a volume, repeat the procedure as necessary.

  1. If the plex that you want to add to the subvolume doesn't exist yet, create it with xlv_make. For example, to create a plex called plex1 to add to the data subvolume of a volume called root_vol, give these commands:

    # xlv_make 
    xlv_make> show 
    
            Completed Objects
    (1)  vol root_vol
    ve root_vol.data.0.0 [active]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d1s0 (1992630 blks)
    
    xlv_make> plex plex1
    plex1
    xlv_make> ve /dev/dsk/dks0d2s0
    plex1.0
    xlv_make> end
    Object specification completed
    xlv_make> exit
    Newly created objects will be written to disk.
    Is this what you want?(yes)  yes
    Invoking xlv_assemble
    

  2. Use the xlv_admin command menu to add the plex to the volume. For example, to add the standalone plex plex1 to root_vol, use this procedure:

    # xlv_admin
    **************** XLV Administration Menu **********
    ...
    3.      Add a plex to an existing volume.
    ...
    42.     Show information for an object.
    ...
    99.     Exit
    ...
    xlv_admin> 42
    Please enter name of object to be operated on.
    xlv_admin> root_vol
    
    ============= Displaying Requested Object ==========
    vol root_vol
    ve root_vol.data.0.0 [active]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d1s0 (1992630 blks)
    
    
     Please select choice...
    xlv_admin> 42
    Please enter name of object to be operated on.
    xlv_admin> plex1
    
    ============= Displaying Requested Object ==========
    plex plex1
    ve plex1.0 [empty]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d2s0 (1992630 blks)
    
    
     Please select choice...
    xlv_admin> 3
    Please enter name of object to be operated on.
    xlv_admin> root_vol
     Please enter the object you wish to add to the target.
    xlv_admin> plex1
     Please select choice...
    

  3. You can confirm that root_vol now has two plexes by using selection 42 of the xlv_admin command menu:

    xlv_admin> 42
    Please enter name of object to be operated on.
    xlv_admin> root_vol
    
    ============= Displaying Requested Object ==========
    vol root_vol
    ve root_vol.data.0.0 [active]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d1s0 (1992630 blks)
    ve root_vol.data.1.0 [empty]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d2s0 (1992630 blks)
    
    
     Please select choice...
    

    The newly added plex, root_vol.data.1, is in the [empty] state. This is because it is newly created. When a plex is added, xlv_admin automatically initiates a plex revive operation to copy the contents of the original plex, root_vol.data.0, to the newly added plex.

  4. Exit xlv_admin:

    xlv_admin> 99
    #
    

The plex revive completes and the new plex switches to [active] state automatically, but if you want to check its progress and verify that the plex has become active, follow this procedure:

  1. List the XLV daemons running, for example:

    # ps -ef | grep xlv
        root    27     1  0 10:49:27 ?        0:00 /sbin/xlv_plexd -m 4
        root    35     1  0 10:49:28 ?        0:00 /sbin/xlv_labd
        root    31     1  0 10:49:27 ?        0:00 xlvd
        root   407    27  1 11:01:01 ?        0:00 xlv_plexd -v 2 -n root_vol.data
    -d 50331648 -b 128 -w 0 0 1992629
        root   410   397  2 11:01:11 pts/0    0:00 grep xlv
    

    One instance of xlv_plexd is currently reviving root_vol.data. This daemon exits when the plex has been fully revived.

  2. Later, check the XLV daemons again, for example:

    # ps -ef | grep xlv
    ps -ef | grep xlv
        root    27     1  0 10:49:27 ?        0:00 /sbin/xlv_plexd -m 4
        root    35     1  0 10:49:28 ?        0:00 /sbin/xlv_labd
        root    31     1  0 10:49:27 ?        0:03 xlvd
    

    The instance of xlv_plexd that was reviving root_vol.data is no longer running; it has completed the plex revive.

  3. Check the state of the plex using xlv_admin:

    # xlv_admin
    ...
    xlv_admin> 42
    Please enter name of object to be operated on.
    xlv_admin> root_vol
    
    ============= Displaying Requested Object ==========
    vol root_vol
    ve root_vol.data.0.0 [active]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d1s0 (1992630 blks)
    ve root_vol.data.1.0 [active]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d2s0 (1992630 blks)
    
    
     Please select choice...
    

    Both plexes are now in the [active] state.

  4. Exit xlv_admin:

    xlv_admin> 99
    #
    

Detaching a Plex from a Volume

Detaching a plex from a volume, perhaps because you want to swap disk drives, can be done while the volume is active. However, the entire address range of the subvolume must still covered by active volume elements in the remaining plex or plexes. xlv_admin does not allow you to remove the only active plex in a volume if the other plexes are not yet active. The procedure to detach a plex is:

  1. Start xlv_admin and display the volume that has the plex that you plan to detach, for example, root_vol:

    # xlv_admin
    ...
    1.      Add a ve to an existing plex.
    ...
    12.     Detach a plex from an existing volume.
    ...
    42.     Show information for an object.
    ................ Exit ................
    99.     Exit
     Please select choice...
    xlv_admin> 42
    Please enter name of object to be operated on.
    xlv_admin> root_vol
    
    ============= Displaying Requested Object ==========
    vol root_vol
    ve root_vol.data.0.0 [active]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d1s0 (1992630 blks)
    ve root_vol.data.1.0 [active]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d2s0 (1992630 blks)
    

  2. Detach plex 1 and give it the name plex1 by giving these commands:

    xlv_admin> 12
    Please enter name of object to be operated on.
    xlv_admin> root_vol
     Please select plex number (0-3).
    xlv_admin> 1
    Please enter name of new object.
    xlv_admin> plex1
     Please select choice...
    

  3. To examine the volume and the detached plex, give these commands:

    xlv_admin> 42
    Please enter name of object to be operated on.
    xlv_admin> plex1
    
    ============= Displaying Requested Object ==========
    plex plex1
    ve plex1.0 [empty]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d2s0 (1992630 blks)
    
    
     Please select choice...
    xlv_admin> 42
    Please enter name of object to be operated on.
    xlv_admin> root_vol
    
    ============= Displaying Requested Object ==========
    vol root_vol
    ve root_vol.data.0.0 [active]
            start=0, end=1992629, (cat)grp_size=1
            /dev/dsk/dks0d1s0 (1992630 blks)
    

  4. Exit xlv_admin:

    xlv_admin> 99
    #
    

Deleting an XLV Object

You can delete a volume or any other XLV object by using selection 31 of the xlv_admin command menu. The procedure is:

  1. If you are deleting a volume, you must unmount it first. For example:

    umount /vol1 
    

  2. Start xlv_admin and list the root of each object hierarchy on the system:

    # xlv_admin
    ...
    31.     Delete an object.
    ...
    41.     Show object by name and type, only.
    ...
    99.     Exit
     Please select choice...
    xlv_admin> 41
    
    ==================== Listing Objects =============
    Volume:          `root_vol'
    Plex:            `plex1'
    

  3. Delete the object, for example the plex plex1:

    xlv_admin> 31
    Please enter name of object to be operated on.
    xlv_admin> plex1
    

  4. Confirm that the object is gone:

    xlv_admin> 41
    
    ==================== Listing Objects =============
    Volume:          `root_vol'
    

  5. Exit xlv_admin:

    xlv_admin> 99
    #
    

Using the Real-Time Subvolume

Files created on the real-time subvolume of an XLV logical volume are known as real-time files. The next three sections describe the special characteristics of these files.

Files on the Real-Time Subvolume and Utilities

Real-time files have some special characteristics that cause standard IRIX utilities to operate in ways that you might not expect. In particular:

  • You cannot create real-time files using any standard utilities. Only specially-written programs can create real-time files. The next section, “Creating Files on the Real-time Subvolume,” explains how.

  • Real-time files are displayed by ls(1), just as any other file. However, there is no way to tell from the ls output whether a particular file is on a data subvolume or is a real-time file on a real-time subvolume. Only a specially-written program can determine the type of a file. The F_FSGETXATTR fcntl(2) system call is used to determine if a file is a real-time or a standard data file. If the file is a real-time file, the fsx_xflags field of the fsxattr structure has the XFS_XFLAG_REALTIME bit set.

  • The df(1) utility displays the disk space in the data subvolume by default. When the –r option is given, the real-time subvolume's disk space and usage is added. df can report that there is free disk space in the filesystem when the real-time subvolume is full, and df –r can report that there is free disk space when the data subvolume is full.

Creating Files on the Real-time Subvolume

To create a real-time file, use the F_FSSETXATTR fcntl(2) system call with the XFS_XFLAG_REALTIME bit set in the fsx_xflags field of the fsxattr structure. This must be done after the file has first been created/opened for writing, but before any data has been written to the file. Once data has been written to a file, it cannot be changed from a standard data file to a real-time file, nor can files created as real-time files be changed to standard data files.

Real-time files can only be read or written using direct I/O. Therefore, read(2) and write(2) operations to a real-time file must meet the requirements specified by the F_DIOINFO fcntl(2) call. See the open(2) reference page for a discussion of the O_DIRECT option to the open() system call.

Guaranteed-Rate I/O and the Real-Time Subvolume

The real-time subvolume is used by applications for files that require fixed I/O rates. This feature, called guaranteed-rate I/O, is described in Chapter 5, “Guaranteed-Rate I/O.”