getdev Command

Purpose

Lists devices that match the specified criteria.

Syntax

getdev [ -a ] [ -e ] [ Criteria] [ DeviceList ]

Description

Lists devices that match the given criteria. The criteria is given in the form of expressions. The getdev command can check all devices on the system or a specified list of devices.

Flags

Item Description
-a Specifies that a device must match all criteria to be included in the list generated by this command. The -a flag has no effect if no criteria are defined.
-e Specifies that the devices provided in the devicelist be excluded from the list generated by the getdev command. Without the -e flag only devices in the devicelist are generated. This flag is ignored if no devices are specified.

Parameters

Item Description
Criteria Defines criteria that a device must match before it can be included in the generated list. Criteria can be specified as an expression or a list of expressions which a device must meet for it to be included in the list generated by getdev. If no criteria are provided, all devices are included in the list.

Devices must satisfy at least one of the criteria in the list. However, the -a option can be used to specify that a "logical and" operation should be performed. Then, only those devices that match all of the criteria in a list will be included.

There are four possible expression types which the criteria specified in the Criteria parameter may follow:
Attribute=Value
Fetches all devices with a member which hasAttribute defined and is equal to Value.
Attribute!=Value
Fetches all devices with a member which has Attribute defined and does not equal Value.
Attribute:*
Fetches all devices with a member which has Attribute defined.
Attribute!:*
Fetches all devices with a member which does not have Attribute defined.
The following are the valid device attributes:
alias
The name by which a device is known.
desc
A description of the device.
type
A token describing the type of the device. The valid set of values for the type attribute can be obtained by executing the following command. odmget PdDv | grep -w class | awk '{print $3}' | sed 's/"//g' | sort | uniq
status
The current state of the device.The list of possible values for status are: 1.Defined 2.Available 3.Stopped 4.Diagnose The values for status are not case sensitive.
DeviceList Specifies a space-separated list of devices to be checked for the Criteria.

Exit Status

0
The command completed successfully
> 1
Failure has occurred.

Examples

  1. To display all devices, enter:
    getdev
  2. To list devices which are of type "logical_volume", enter:
    getdev type=logical_volume
  3. To list devices which are not of type "logical_volume", enter:
    getdev type!=logical_volume
  4. To list devices which are of type "logical_volume" or whose device alias is "sys0", enter:
    getdev type=logical_volume alias=sys0
    The output will look similar to the following:
    hd1  
    hd2  
    hd3  
    hd4  
    ...  
    sys0
  5. To list devices which are of type "logical_volume" and whose device alias is "lv01", enter:
    getdev -a type=logical_volume alias=lv01
  6. To display devices for which the status attribute is defined , enter:
    getdev status:*
  7. To display devices for which the desc attribute is not defined , enter:
    getdev desc!:* 

Files

Item Description
/usr/sbin/getdev Contains the getdev command