Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX System Administration Tasks: HP 9000 > Chapter 3 Managing Disks Using the Logical Volume Manager (LVM)

Managing Logical Volumes Using HP-UX Commands

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

As stated above, all disk management tasks performed by SAM can also be done using HP-UX commands.

The following tables give you general information on the commands you will need to use to perform a given task. Refer to the HP-UX Reference for detailed information.

Table 3-2  Commands Needed for Physical Volume Management Tasks

Task

Commands Needed

Changing the characteristics of a physical volume in a volume group.

pvchange(1M)

Creating a physical volume for use in a volume group.

pvcreate(1M)

Displaying information about physical volumes in a volume group.

pvdisplay(1M)

Moving data from one physical volume to another.

pvmove(1M)

 

Table 3-3 Commands Needed for Volume Group Management Tasks

Task

Commands Needed

Creating a volume group.

vgcreate(1M) [1] [2]

Removing volume group.

vgremove(1M) [3]

Activating, deactivating, or changing the characteristics of a volume group.

vgchange(1M)

Backing up volume group configuration information.

vgcfgbackup (1M) [4]

Restoring volume group configuration from a configuration file.

vgcfgrestore(1M)

Displaying information about volume group.

vgdisplay(1M)

Exporting a volume group and its associated logical volumes.

vgexport(1M)

Importing a volume group onto the system; also adds an existing volume group back into /etc/lvmtab.

vgimport(1M) [5]

Scan all physical volumes looking for logical volumes and volume groups; allows for recovery of the LVM configuration file, /etc/lvmtab.

vgscan(1M)

Adding disk to volume group.

vgextend(1M) [6]

Removing disk from volume group.

vgreduce(1M)

[1] Before executing command, one or more physical volumes must have been created with pvcreate(1M).

[2] You also need to create a directory for the volume group and a group device file in the directory. See "Example: Creating a Logical Volume Using HP-UX Commands" which follows Table 3-4, or lvm(7) for more information.

[3] If logical volumes exist within the volume group, they must first be removed using lvremove(1M). Also, the volume group must not contain more than one physical volume. If it does, use vgreduce(1M) first.

[4] Invoked automatically whenever a configuration change is made.

[5] You also need to create a directory for the volume group and a group device file in the directory. See "Example: Creating a Logical Volume Using HP-UX Commands" which follows Table 3-4, or lvm(7) for more information.

[6] Before executing command, one or more physical volumes must have been created with pvcreate(1M).

 

Table 3-4 Commands Needed for Logical Volume Management Tasks

Task

Commands Needed

Creating a logical volume.

lvcreate(1M)

Modifying a logical volume.

lvchange(1M)

Displaying information about logical volumes.

lvdisplay(1M)

Increasing the size of logical volume by allocating disk space.

lvextend(1M)

Decreasing the size of a logical volume.

lvreduce(1M) [1]

Removing the allocation of disk space for one or more logical volumes within a volume group.

lvremove(1M)

Preparing a logical volume to be a root, primary swap, or dump volume.

lvlnboot(1M) [2]

Removing link that makes a logical volume a root, primary swap, or dump volume.

lvrmboot(1M)

Increasing the size of a file system up to the capacity of logical volume.

extendfs(1M) [3]

Splitting a mirrored logical volume into two logical volumes.

lvsplit(1M) [4]

Merging two logical volumes into one logical volume.

lvmerge(1M)[5]

[1] To prevent data loss and possible file system corruption, back up contents first.

[2] Invoked automatically whenever the configuration of the root volume group is affected by one of the following commands: lvextend, lvmerge, lvreduce, lvsplit, pvmove, lvremove, vgextend, or vgreduce

[3] If you are using HFS, you will need to first a) increase the size of the logical volume that contains the file system using lvextend(1M) and b) unmount the file system. If you are using VxFS and have the OnlineJFS product, you can do online resizing with fsadm(1M). (See Chapter 4 for additional information.)

[4] Requires optional HP MirrorDisk/UX software.

[5] Requires optional HP MirrorDisk/UX software.

 

Example: Creating a Logical Volume Using HP-UX Commands

To create a logical volume:

  1. Select one or more disks. ioscan(1M) shows the disks attached to the system and their device file names.

  2. Initialize each disk as an LVM disk by using the pvcreate command. For example, enter

    pvcreate /dev/rdsk/c0t0d0

    Note that using pvcreate will result in the loss of any existing data currently on the physical volume.

    You use the character device file for the disk.

    Once a disk is initialized, it is called a physical volume.

  3. Pool the physical volumes into a volume group. To complete this step:

    1. Create a directory for the volume group. For example:

      mkdir /dev/vgnn
    2. Create a device file named group in the above directory with the mknod command.

      mknod /dev/vgnn/group c 64 0xNN0000

      The c following the device file name specifies that group is a character device file.

      The 64 is the major number for the group device file; it will always be 64.

      The 0xNN0000 is the minor number for the group file in hexadecimal. Note that each particular NN must be a unique number across all volume groups.

      For more information on mknod, see mknod(1M); for more information on major numbers and minor numbers, see Configuring HP-UX for Peripherals.

    3. Create the volume group specifying each physical volume to be included using vgcreate. For example:

      vgcreate /dev/vgnn /dev/dsk/c0t0d0

      Use the block device file to include each disk in your volume group. You can assign all the physical volumes to the volume group with one command. No physical volume can already be part of an existing volume group.

  4. Once you have created a volume group, you can now create a logical volume using lvcreate. For example:

    lvcreate /dev/vgnn

Using the above command creates the logical volume /dev/vgnn/lvoln with LVM automatically assigning the n in lvoln.

When LVM creates the logical volume, it creates the block and character device files and places them in the directory /dev/vgnn.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.