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 97)
and
“Administering Swap Logical Volumes” (page 101)
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.
2.
Decide on the new size of the logical volume.
For example, if the logical volume is mounted to a file system, the new size must be greater
than the space the data in the file system currently occupies. The
bdf
command shows the
size of all mounted volumes. The first column shows the space allocated to the volume; the
second shows how much is actually being used. The new size of the logical volume must be
larger than the size shown in the second column of the
bdf
output.
3.
Reduce the size of the logical volume as follows:
# lvreduce -L 500 /dev/vg01/lvol5
This command reduces the logical volume
/dev/vg01/lvol5
to 500 MB.
NOTE:
On the HP-UX 11i v3 March 2010 Update, the size of a logical volume cannot be reduced
if it has any type of snapshots associated with it. With the HP-UX 11i v3 September 2010 Update,
only logical volumes with associated space efficient snapshots cannot be reduced. For information
about snapshots, see
“Creating and Administering Snapshot Logical Volumes” (page 103)
.
Adding a Mirror to a Logical Volume
NOTE:
Mirroring requires the optional product HP MirrorDisk/UX.
TIP:
This task is easier to perform with HP SMH. HP SMH confirms that enough disk space is
available for the mirror copy and that the available space meets any allocation policy.
To add a mirror to a logical volume, follow these steps:
1.
Decide how many mirror copies to create.
For this example, you will create one mirror; that is, you will keep two copies of the data
online, the original and one mirror copy.
2.
Make sure that there is enough free space in the volume group that contains the logical volume
you want to mirror.
The volume group needs at least as much free space as the logical volume you want to mirror
currently has allocated to it—that is, you will double the amount of physical space this volume
requires.
To use strict mirroring (which HP recommends because it keeps the mirror copy on a separate
disk) this free space must be on a disk or disks not currently used by the volume you want to
mirror.
Common LVM Tasks
55