HP-UX HB v13.00 Ch-13 - LVM
HP-UX Handbook – Rev 13.00 Page 31 (of 110)
Chapter 13 LVM
October 29, 2013
# umount /dev/vg01/lvol1
# umount /dev/vg01/lvol2
...
# vgchange -a n vg01
# vgexport vg01
NOTE: vgremove is not recommended because you need to remove all LVs and PVs
from the VG before you could use vgremove. This is not necessary with vgexport.
Additionally vgexport leaves the LVM structures on the disks untouched which could
be an advantage if you like to re-import the VG later.
Moving physical extents
It is only possible to move PEs within a VG. In order to move data across VGs you need
to use commands like dd, cp, mv, tar, cpio, ...
There is a command available that allows you to move LVs or certain extents of a LV
from one PV to another - pvmove(1M). It is usually used to “free” a PV, i.e. to move all
LVs from that PV in order to remove it from the VG. There are several forms of usage:
In order to move all PEs from c0t1d0 to the PVs c0t2d0 and c0t3d0:
# pvmove /dev/dsk/c0t1d0 /dev/dsk/c0t2d0 /dev/dsk/c0t3d0
In order to move all PEs of lvol4 that are located on PV c0t1d0 to PV c1t2d0:
# pvmove -n /dev/vg01/lvol4 /dev/dsk/c0t1d0 /dev/dsk/c0t2d0
ATTENTION: pvmove is not an atomic operation. Furthermore the command moves
data extent by extent and is easily interruptable. If this happens, then the
configuration is left in some weird inconsistent state showing an additional pseudo
mirror copy for the extents in question. This can be cleaned up only using the
lvreduce command (Use lvreduce -m 0 LV if the LVs were unmirrored and lvreduce -
m 1 LV if they were mirrored before starting the pvmove; there’s no need to specify a
PV here).
If MirrorDisk/UX is installed it is usually saver and faster to use mirroring as an
alternative to pvmove. In order to move lvol4 from PV c0t1d0 to c0t2d0 just mirror it to
c0t2d0 and remove the mirror from c0t1d0 afterwards:
# lvextend -m 1 /dev/vg01/lvol4 /dev/dsk/c0t2d0
# lvreduce -m 0 /dev/vg01/lvol4 /dev/dsk/c0t1d0