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

2. After the disk no longer holds any physical extents, use the vgreduce command to remove
it from the volume group. For example:
# vgreduce /dev/vgnn /dev/disk/disk3
IMPORTANT: If you are using LVM pvlinks, as described in “Increasing Hardware Path
Redundancy Through Multipathing” (page 27), you must run the vgreduce command for
each link to the disk.
Creating a Logical Volume
To create a logical volume, follow these steps:
1. Decide how much disk space the logical volume needs.
For example, you can add 200 MB of device swap space, or you might have a new project
that you expect to grow to 10 GB.
2. Find a volume group that has adequate free space.
To determine if there is sufficient disk space available for the logical volume within a volume
group, use the vgdisplay command to calculate this information. vgdisplay outputs data
on one or more volume groups, including the physical extent size (under PE Size (MBytes))
and the number of available physical extents (under Free PE). By multiplying these two
figures, you get the number of megabytes available within the volume group. For more
information, see vgdisplay(1M).
3. Create the logical volume using lvcreate. For example:
# lvcreate -L size_in_MB /dev/vgnn
This command creates the logical volume /dev/vgnn/lvoln with LVM automatically assigning
the n in lvoln.
When LVM creates the logical volume, it creates block and character device files for that logical
volume and places them in the /dev/vgnn directory.
Creating a Striped Logical Volume
To create a striped logical volume, use lvcreate with the -i and the -I options to specify the
number of disks and stripe width, respectively. For example, suppose you want to stripe across
three disks with a stripe size of 32K. Your logical volume size is 240 MB. To create the striped
logical volume, enter the following command:
# lvcreate -i 3 -I 32 -l 240 -n lvol1 /dev/vg01
The lvcreate command automatically rounds up the size of the logical volume to a multiple of
the number of disks times the extent size. For example, if you have three disks you want to stripe
across and the extent size is 4 MB, even though you indicate a logical volume size of 200 MB
(-L 200), lvcreate creates a 204 MB logical volume because 200 is not a multiple of 12.
NOTE: When you stripe across multiple disks, the striped volume size cannot exceed the capacity
of the smallest disk multiplied by the number of disks used in the striping.
Creating a Mirrored Logical Volume
To create a mirrored logical volume, use lvcreate with the -m option to select the number of
mirror copies. To control how the mirror copies are managed, choose from the following options:
Strict, Nonstrict, or PVG-strict Extent Allocation
-s y Strict allocation (default)
-s n Nonstrict allocation
-s g PVG-strict allocation
Contiguous or Noncontiguous Extent Allocation
52 Administering LVM