Chapter 4. Overview of the xvm CLI

This chapter discusses the following:

Invoking the xvm CLI

This section discusses the following:

root Requirement

To configure XVM volumes, you must be logged in as root.

However, you can display configuration information even if you do not have root privileges.

Interactive Use

To use the xvm CLI interactively, enter the following:

# /sbin/xvm

If the required CXFS services (see “CXFS Service Requirements for Cluster Domain” in Chapter 2) have been started when you enter this command, you should see the following prompt:

xvm:cluster>

This prompt indicates that the current domain is the cluster domain, and any objects created in this domain can be administered by any node in the CXFS cluster.


Note: You must start the required services before you can see and access XVM cluster configuration objects.

However, if the services have not been enabled when you enter the xvm command, the prompt will appear as follows:

xvm:local>

To explicitly specify the XVM domain, use the -domain option:

# /sbin/xvm [-domain] domaintype

The domaintype variable can be local or cluster. You may find this option useful for changing the domain if you are writing a script in which you want to execute a single command in the local domain.


Note: When you are running XVM in the cluster domain, you can see and modify only the XVM physical volumes (physvols) that are also in the cluster domain, even if you are running from the node that is the owner of a local physvol.

To see and modify local disks, either change to the local domain with the set domain command or use the local: prefix when specifying a physvol name. Similarly, when you are running XVM in the local domain, you must change to the cluster domain or include the cluster: prefix when specifying a physvol that is owned by the cluster.

For example, if you are running in the cluster domain but wish to see the physvols in the local domain, enter the following:

xvm:cluster> show local:phys/*

Similarly, if you are running in the local domain but wish to see the XVM physvols in the cluster of which you are a member, enter the following:

xvm:local> show cluster:phys/*

For more information on XVM domains, see “Local Domain and Cluster Domain” in Chapter 2.

After the command prompt displays, you can enter commands to configure and manage volumes. These commands are executed interactively, as you supply them.

When you have finished executing xvm CLI commands, you return to your shell by entering the exit command. (You can also use bye or quit as an alias for the exit command.)

Shell Use

You can also enter an individual xvm CLI command directly from the shell by prefacing the command with xvm, as follows:

# /sbin/xvm [-domain local|cluster][xvmcommand ...]

For example, to display the brief syntax for the concat command:

# xvm help concat
concat -tempname [-pieces N] [-vename concatname] [ve ...]
concat -volname name [-pieces N] [-vename concatname] [ve ...]

For more information, see the xvm(8) man page.

Redirection

You can redirect a file of xvm CLI commands into the xvm CLI just as you would redirect input into any standard Linux tool. For example, to redirect the contents of the file myscript:

# xvm < myscript

Alternately, you can enter the following:

# cat myscript | xvm

For information on using shell substitution to feed the output of one command into another, see “Command Output and Redirection”.

Summary of xvm CLI Commands

Table 4-1 provides a summary of the xvm CLI commands according to function.

Table 4-1. Summary of xvm CLI Commands

Function

Command

Description

Physvol and unlabeled-disk management

change

Changes the attributes of a physvol

 

label

Labels a disk for XVM use

 

probe

Reads the disk label and determines if the disk is an XVM physvol that must be instantiated

 

reprobe

Reads the disk labels and removes previous configuration information from the kernel if it does not match the current disk information or if the disk is inaccessible

 

unlabel

Removes an XVM label from a physvol and restores the original disk partitions.

Volume-element creation

concat

Concatenates volume elements into a single address space

 

mirror

Creates a volume element that maintains identical data images on its children

 

slice

Create a slice from a specified block range of a physvol

 

stripe

Creates a stripe group from multiple volume elements

 

subvolume

Creates a subvolume

 

volume

Creates a volume and optionally attaches subvolumes

Volume-element manipulation

attach

Attaches a set of lower-level volume elements to a higher-level volume element in the XVM topology tree

 

change

Changes the attributes of a volume element

 

collapse

Removes a volume element from a topology tree without taking the subvolume offline

 

delete

Deletes a volume element

 

detach

Detaches a volume element from its parent

 

insert

Inserts a concat or mirror into a topology tree without taking the subvolume offline

 

remake

Remakes a volume element, collapsing holes and optionally reordering the children

Display

dump

Dumps out the xvm CLI commands required to reconstruct a volume element or physvol

 

show

Shows information about a volume element or physvol

Ownership

give

Transfers ownership of an XVM disk gracefully to another local host or cluster

 

steal

Transfers ownership of a foreign XVM disk forcibly to the local host or cluster


Caution: If another host or cluster has the physvol instantiated, configuration corruption can occur. You should use steal only when the ownership cannot be changed by using the give command.


Path failover

foconfig

Process the XVM failover configuration file

 

foswitch

Changes the path used to access a physical disk

General

bye

(also aliases exit

and quit)

Exits the xvm CLI

 

help

(also alias ?)

Displays the synopsis for a command or (with the -verbose option) the full help text for the command

 

set

Sets the domain (to either cluster or local) or enables/disables the autoprobe feature

 


Note: If the required services have not been started, you cannot set the domain to cluster. See “CXFS Service Requirements for Cluster Domain” in Chapter 2.



Online Help for xvm CLI Commands

The xvm CLI includes a help command, which you can use to display the syntax for any of the commands. You can use a question mark (?) as an alias for the help command. This section discusses the following:

Viewing a List of Supported Commands

To see a list of supported commands, enter the following:

xvm:cluster> help

Brief Synopsis

To see a brief synopsis of a command, enter the following:

xvm:cluster> help keyword

The keyword is any of the commands listed in Table 4-1 plus the general help topics described in Table 4-2.

For example, the following command displays the synopsis for the slice command:

xvm:cluster> help slice

Table 4-2. General Help Topics

Topic

Description

grouping-subvolumes

Displays information about creating a volume with multiple subvolumes

names

Displays information on XVM object names

regexp

Displays information on the regular expressions that you can use when specifying XVM object names


Full Help Text

To see the full help text for a command, include the -verbose option (which you can abbreviate to -v):

xvm:cluster> help -verbose keyword

For example, the following command displays the full help for the slice command:

xvm:cluster> help -v slice

xvm CLI Syntax

This section discusses the following:

Command Abbreviation

The xvm CLI commands may be abbreviated to any unique substring. Command options may be abbreviated to any substring that is unique among the options supported by that command. Commands and options are not case sensitive, but object names are case sensitive.

For example, are examples of full commands and their abbreviations:

xvm:local> volume -volname mainvol vol1/data vol2/log vol3/rt
xvm:local> vol -vol mainvol vol1/data vol2/log vol3/rt

xvm:local> show -verbose slice/freds0
xvm:local> sh -v slice/freds0

Syntax Rules

When you enter xvm CLI commands, the following syntax rules and features apply:

  • Blank lines and lines beginning with the pound sign ( #) are interpreted as comments

  • Strings between < > characters are interpreted as comments (even if the strings are xvm CLI commands)

  • A backslash (\) at the end of a line acts as a continuation character

  • An exclamation point (!) at the beginning of a command passes the command to the shell

Object Names in XVM

This section discusses the following:

Explicit and Temporary Names

You can explicitly name the following XVM objects:

  • Physvol

  • Volume

  • Concat

  • Mirror

  • Stripe


Note: Slice names are always generated by XVM.

If you do not supply a name when you create the object, XVM will generate a temporary name that refers to the object type and generation counter (starting from 0) within the XVM topology tree, such as the following:

  • vol0 for the first volume generated

  • concat2 for the third concat generated

The generated name may not persist across reboots. To have a permanent name, you must either specify the name at creation time or use the change command. See “Modifying Volume Elements with the change Command ” in Chapter 5.

Naming Rules

The following naming rules apply:

  • Names are limited to 32 characters in length

  • Names consist of alphanumeric characters and the period (.), underscore (_), and hyphen (-) characters

  • Names cannot begin with a digit

  • Names are case sensitive

  • The following keywords are reserved may not be used to name objects:

    concat
    mirror
    phys
    raid
    slice
    stripe
    subvol
    unlabeled
    vol

Specifying Objects by Name

With the exception of subvolumes, objects are specified using the object name, using one of the following forms:

[domain:][prefix/]name
[domain:][prefix/]path

where:

  • domain is either local or cluster. You must include domain when you specify an XVM object that is not in the current domain, as described in “Invoking the xvm CLI”.

  • prefix is the type of object, such as phys for a physvol. See Table 4-3.

  • name is the name of the object, such as fred.

  • path is the path to the volume element in the XVM topology tree, either the explicit path from the top of the tree or the relative path from one volume element to another.

    Specifying a path component of two dots (..) for a volume element indicates the parent of the volume element. For example, the following command displays the parent of slice foos0:

    xvm:cluster> show slice/foos0/.. 


Note: Subvolume objects must be specified by prefixing the subvolume name with its volume name followed by a slash (/). For example: fred/data. In this example, fred is the name of the volume and data is the name of the subvolume.

Because user-defined names are allowed, it is possible to have ambiguities in the XVM object namespace. For example, if there are two objects of different object types named fred, specifying fred alone is not sufficient to identify the object.

You can also use wildcards; see “Regular Expressions”.

To remove ambiguity in an object name, include the type prefix followed by a slash, such as concat/concat1. Specifying an object type can also make name resolution faster by providing information about the type of object.


Note: The following 3-tuple construction is always unambiguous:
subvol/volname/subvol_name


If you specify an ambiguous name to an xvm CLI command without a wildcard, the command will generally produce an error message.

Table 4-3 lists the object prefixes.

Table 4-3. Prefixes Specifying Object Type

Prefix

Object

concat

Concat

foreign

Foreign disk

mirror

Mirror

phys

Physvol

slice

Slice

stripe

Stripe

subvol

Subvolume

unlabeled

Unlabeled disk

vol

Volume

For example, phys/fred refers to the XVM physvol named fred. The path portion of the name is the name that was given to the physvol at the time it was labeled.

The path portion of an unlabeled disk is the filesystem path to the volume partition. For example:

  • Explicit path:

    unlabeled/hw/rdisk/diskname

  • Relative path:

    unlabeled/diskname

The format of the path portion of a foreign disk is the same as the path portion of an unlabeled disk.

For more information, see “XVM Objects” in Chapter 2.

Specifying Objects by Piece Number

XVM volume elements can also be specified using a combination of component names and piece numbers, which reflect position of a component in the XVM topology tree. For example, concat0/0 refers to the zero piece (child) of the volume element concat0. The piece number syntax is helpful when you want to target a volume element without knowing its name.

Figure 4-1 shows an XVM topology tree that uses system-generated names for the volume and all of its children, and their corresponding piece numbers.

Figure 4-1. XVM Volume with System-Generated Names and Piece Numbers

XVM Volume with System-Generated Names and Piece
Numbers

The first child of a given volume element is considered the leftmost child (piece 0), and the last child is considered the rightmost child.

Table 4-4 shows examples of how you can use piece syntax to specify individual volume elements illustrated in Figure 4-1.

Table 4-4. Specifying Volume Elements Using Example Piece Syntax

XVM Object

Example Object Specifications

concat/concat0

vol0/data/0

vol0/0/0

stripe/stripe0

vol0/data/0/0

vol0/0/0/0

stripe/stripe1

vol0/data/0/1

vol0/0/0/1

mirror/mirror0

vol0/data/concat0/stripe0/0

vol0/data/0/0/0

vol0/0/0/0/0

mirror/mirror2

vol0/data/concat0/stripe1/0

vol0/data/0/1/0

vol0/0/0/1/0

slice/dsk6s0

vol0/data/concat0/1/mirror3/0

vol0/0/0/1/1/0


Object Name Examples

The following examples show how a variety of XVM objects can be specified:

Example 

Description

vol0 

The object named vol0

unlabeled/sda 

The unlabeled disk named sda ( sda indicates the first SCSI disk discovered, sdb indicates the second, and so on)

mirror/mirror6 

The mirror volume element named mirror6

concat0/0 

The leftmost child of concat0

vol0/data/0 

The child of the data subvolume of volume vol0

stripe0/freds0 

The volume element named freds0 under the stripe stripe0

Regular Expressions

You can use regular expressions when specifying object names. The following characters are recognized and have their standard regular expression meanings as supported through the fnmatch(3) function:

*
?
[ ]

Regular expressions are limited to the rightmost component of an XVM object path. For example:

Example 

Description

* 

Matches all objects


Note: At the shell command line, you must protect the * character by enclosing it within quotation marks so that it is interpreted correctly by the shell. For example:
# xvm show '*'



The protection is not required when you are using the xvm CLI interactively.


vol/* 

Matches all volumes

slice/*s0 

Matches all slices ending in s0

concat0/* 

Matches all children of concat0

subvol/log* 

Matches all log subvolumes

fred* 

Matches all objects beginning with fred

unlabeled/* 

Matches all unlabeled disks

For example, to show all objects starting with I:

xvm:cluster> show I*
vol/I_Love_Lucy 0 online

Specifying a volume element path ending in / is equivalent to specifying a volume element path ending in the /* character sequence.

A volume element path that consists of an object type keyword is equivalent to specifying the keyword followed by the /* character sequence. For example, the following commands are equivalent:

xvm:cluster> show slice
xvm:cluster> show slice/*

Device Directories and Pathnames

Block devices for XVM volumes used for a host's local volume are contained in the /dev/lxvm directory.

For information on names of objects within XVM volumes, see “Object Names in XVM”.

Command Output and Redirection

In general, commands that create or manipulate objects will print out the name of the created or target object upon successful completion, as in the following example:

xvm:cluster> concat -tempname slice/wilmas0 slice/barneys0
</dev/cxvm/vol0> concat/concat0

You can use shell substitution to feed the output of one command into another. For example, under the Korn shell the following command would create a concat with a volume name of fred and the physvols phys1 and phys2 as the components:

# xvm concat -volname fred $(xvm slice -all phys1) $(xvm slice -all phys2)

Under csh or sh, the syntax for the command is as follows:

# xvm concat -volname fred `xvm slice -all phys1` `xvm slice -all phys2`

Commands that fail, or for which the manipulated object does not make sense (such as delete, for example), do not print out the target object name.

Commands that create or modify volume elements also display the subvolume block-special name that the target volume element belongs to inside of < > symbols. For example,

xvm:cluster> slice -all phys1
</dev/cxvm/phys1s0> slice/phys1s0

The above indicates that slice/phys1s0 is the name of the slice created and /dev/cxvm/phys1s0 is a path to the device that can be opened to gain access to the slice. Strings that appear inside of < > characters are treated as comments by the xvm CLI and will therefore be ignored if you feed the output of one xvm CLI command into another.

Safe Versus Unsafe Commands

The xvm CLI commands can be categorized as follows:

  • A safe command does not affect the address space of the subvolume, such as detaching or deleting all but the last child of a mirror (detaching or deleting the last child is unsafe).

    Safe commands can always be issued regardless of the open state of the subvolume. Mounted subvolumes are always open; however, a subvolume may also be open without being mounted, such as if an application is accessing the raw subvolume.

    Certain commands have a -safe option, which will enforce the safe checks even if the subvolume is not open.

  • An unsafe command is one that will affect the address space of the subvolume that the volume element is under, such as detaching or deleting a child of a concat.

    Unsafe commands can be issued only if the subvolume is not open.