[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1

lvm_changelv Subroutine


Changes the attributes of a logical volume.


Logical Volume Manager Library (liblvm.a)


#include <lvm.h>
int lvm_changelv (ChangeLV)
struct changelv *ChangeLV;


Note: You must have root user authority to use this subroutine.

The lvm_changelv subroutine changes the attributes of an existing logical volume.

The changelv structure pointed to by the ChangeLV parameter is defined in the lvm.h file and contains the following fields:

struct changelv{
   struct lv_id lv_id;
   char *lvname;
   long maxsize;
   long permissions;
   long bb_relocation;
   long mirror_policy;
   long write_verify;
   long mirwrt_consist;
struct lv_id{
   struct unique_id vg_id;
   long    minor_num;}
Field Definition
lv_id Specifies the logical volume to be changed.
lvname Specifies either the full path name of the logical volume or a single file name that must reside in the /dev directory, for example rhd1. This field must be a null-terminated string that ranges from 1 to LVM_NAMESIZ bytes, including the null byte, and must be the name of a raw or character device. If a raw or character device is not specified for the lvname field, the Logical Volume Manager (LVM) adds an r to the file name to have a raw device name. If there is no raw device entry for this name, the LVM returns the LVM_NOTCHARDEV error code.
maxsize Specifies the new maximum size of the logical volume in number of logical partitions (1 - LVM_MAXLPS). A change in the maxsize field does not change the existing size of the logical volume.
permissions Specifies that the permission assigned to the logical volume is either read-only or read/write.
bb_relocation Specifies if bad block relocation is desired.
mirror_policy Specifies how the copies of the logical partition should be written. The values for this field can be either LVM_SEQUENTIAL or LVM_PARALLEL.
write_verify Specifies if writes to the logical volume should be checked for successful completion. The value for this field is either LVM_VERIFY or LVM_NOVERIFY. Any other fields in the parameter list that are not to be changed should either contain a 0 or be set to null if they are pointers.
mirwrt_consist Tells whether mirror-write consistency recovery will be performed for this logical volume. The LVM always insures data consistency among mirrored copies of a logical volume during normal I/O processing. For every write to a logical volume, the LVM generates a write request for every mirror copy. A problem arises if the system crashes in the middle of processing a mirrored write before all copies are written. If mirror-write consistency recovery is requested for a logical volume, the LVM keeps additional information to allow recovery of these inconsistent mirrors. Mirror-write consistency recovery should be performed for most mirrored logical volumes. Logical volumes, such as page space, that do not use the existing data when the volume group is re-varied on do not need this protection.

The logical volume must not be open when trying to change the permissions, bb_relocation, write_verify, mirror_policy, or mirwrt_consist fields. If the volume group that contains the logical volume to be changed is not on-line, an error will be returned.


ChangeLV Points to the changelv structure.

Return Values

Upon successful completion, a value of 0 is returned.

Error Codes

If the changelv subroutine does not complete successfully it returns one of the following values:

LVM_ALLOCERR A memory allocation error occurred.
LVM_DALVOPN The volume group reserved logical volume could not be opened.
LVM_FORCEOFF The volume group has been forcefully varied off due to a loss of quorum.
LVM_INVALID_MIN_NUM The minor number received was not valid.
LVM_INVALID_PARAM A field in the changelv structure is not valid, or the pointer to the changelv structure is not valid.
LVM_INVCONFIG An error occurred while attempting to configure this volume group into the kernel. This error will normally result if the module ID is invalid, if the major number given is already in use, or if the volume group device could not be opened.
LVM_INV_DEVENT The logical volume device entry is not valid and cannot be checked to determine if it is raw.
LVM_LVEXIST A logical volume already exists with the name passed into the routine.
LVM_LVOPEN The logical volume was open. It must be closed to change the permissions, bb_relocation, write_verify, mirror_policy, or mirwrt_consist field.
LVM_MAPFBSY The volume group is currently locked because system management on the volume group is being done by another process.
LVM_MAPFOPN The mapped file, which contains a copy of the volume group descriptor area used for making changes to the volume group, could not be opened.
LVM_MAPFRDWR An error occurred while trying to read or write the mapped file.
LVM_NOTCHARDEV The device is not a raw or character device.
LVM_OFFLINE A routine that requires a volume group to be online has encountered an offline volume group.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The lvm_querylv subroutine, lvm_varyonvg subroutine.

List of Logical Volume Subroutines and Logical Volume Programming Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

[ Previous | Next | Contents | Glossary | Home | Search ]