HP-UX System Administrator's Guide: Logical Volume Management (5900-3028, March 2013)

3. Extend the logical volume. For example:
# lvextend -L 332 /dev/vg00/lvol7
This increases the size of this volume to 332 MB.
NOTE: On the HP-UX 11i v3 March 2010 Update, the size of a logical volume cannot be
extended if it has snapshots associated with it. With the HP–UX 11i v3 September 2010 Update,
this limitation is removed; and logical volumes with snapshots can be extended.. For information
about snapshot logical volumes, see “Creating and Administering Snapshot Logical Volumes
(page 104).
Extending a Logical Volume to a Specific Disk
For performance reasons, you can force a logical volume to span disks. For example, if you want
to create a 30 GB logical volume and put 10 GB on the first disk, another 10 GB on the second
disk, and 10 GB on the third disk, then assuming that the extent size is 4 MB, the logical volume
requires a total of 7680 extents. To extend the logical volume, follow these steps:
1. After making the disks physical volumes and creating your volume group, create a logical
volume named lvol1 of size 0. For example:
# lvcreate -n lvol1 /dev/vg01
2. Allocate a third of the extents to the logical volume on the first physical volume. For example:
# lvextend -l 2560 /dev/vg01/lvol1 /dev/disk/disk7
3. Increase the total number of physical extents allocated to the logical volume for the remaining
physical volumes by 2560. In each case, the additional 2560 extents are allocated to the
disk specified. For example:
# lvextend -l 5120 /dev/vg01/lvol1 /dev/disk/disk8
# lvextend -l 7680 /dev/vg01/lvol1 /dev/disk/disk9
When you use the -l option with lvextend, you specify space in logical extents.
For another example, you have two disks in a volume group, both identical models. You currently
have a 24 GB logical volume that resides on only one of the disks. You want to extend the logical
volume size to 40 GB and ensure that the 16 GB increase is allocated to the other disk.
Extend the logical volume to a specific disk as follows:
# lvextend -L 40960 /dev/vg01/lvol2 /dev/disk/disk3
Here, when you use the -L option (uppercase), you specify space in megabytes, not logical extents.
For complete information on command options, see lvextend(1M).
Reducing a Logical Volume
CAUTION: Before you reduce a logical volume, you must notify the users of that logical volume.
For example, before reducing a logical volume that contains a file system, back up the file system.
Even if the file system currently occupies less space than the new (reduced) size of the logical
volume, you will almost certainly lose data when you reduce the logical volume. See Administering
File System Logical Volumes” (page 96) and ??? for the appropriate procedures for file systems
and swap devices.
To reduce a logical volume, follow these steps:
1. To find out what applications are using the logical volume, use the fuser command. For
example:
# fuser -cu /dev/vg01/lvol5
If the logical volume is in use, ensure the underlying applications can handle the size reduction.
You might have to stop the applications.
54 Administering LVM