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

# lvremove /dev/vg01/lvol5
You can now use this space to extend an existing logical volume or build a new logical volume.
3. For volume group Version 2.2 and higher, a snapshot and all its predecessors can be removed
using a single lvremove command, with the new -F option. See lvremove(1M) for more
information.
NOTE: A logical volume with associated snapshots cannot be removed. First, all of its snapshots
have to be deleted, then the original logical volume can be deleted.
Exporting a Volume Group
Exporting a volume group removes all data concerning the volume group from the system, while
leaving the data on the disks intact. The disks of an exported volume can be physically moved or
connected to another system, and the volume group can be imported there.
Exporting a volume group removes information about the volume group and its associated physical
volumes from /etc/lvmtab and /etc/lvmtab_p, and removes the volume group's directory
with device files in the /dev directory.
1. Make sure that none of the logical volumes in the volume group are in use. You might need
to stop applications using any logical volumes in the volume group, and unmount file systems
contained in the volume group.
Use the fuser command on each logical volume. For example:
# fuser -cu /dev/vgnn/lvoln
2. Deactivate the volume group. For example:
# vgchange -a n vgnn
3. Use the vgexport command to export the volume group. For example:
# vgexport -v -m /tmp/vgnn.map vgnn
If you are planning to move the volume group to another system, use the -m option to
vgexport to create a mapfile. This ASCII file contains the logical volume names because
they are not stored on the disks. You must create a mapfile if you do not use the default names
/dev/vgnn/lvoln for the logical volumes in the volume group.
If there are several disks in the volume group, use the -s option with vgexport; this option
adds the volume group identifier (VGID) to the mapfile. When the volume group is imported,
you can avoid specifying all the disks by name. See “Importing a Volume Group” (page 57).
When vgexport completes, all information about the volume group has been removed from the
system. The disks can now be moved to a different system, and the volume group can be imported
there.
Importing a Volume Group
To import a volume group, follow these steps:
1. Connect the disks to the system.
2. If you are using an HP-UX release before March 2008, or if you want to specify the minor
number of the volume group device file, create it using the procedure in “Creating the Volume
Group Device File” (page 44).
3. Use the vgimport command to import the volume group:
# vgimport -v -N -m /tmp/vgnn.map /dev/vgnn list_of_disks
If there are several disks in the volume group and the VGID was saved in the mapfile (that is,
the vgexport command was run with the s and m options), you can avoid specifying all
of them in the vgimport command line by using the -s option. This causes vgimport to
scan all the disks on the system. Any physical volumes with a VGID matching the one in the
mapfile are included automatically into the volume group.
Common LVM Tasks 57