2008-10-08 16:50:13 +04:00
.TH PVMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
2003-04-30 19:24:08 +04:00
.SH NAME
pvmove \- move physical extents
.SH SYNOPSIS
.B pvmove
2012-04-11 16:42:10 +04:00
.RB [ \- \- abort ]
.RB [ \- \- alloc
.IR AllocationPolicy ]
.RB [ \- b | \- \- background ]
.RB [ \- d | \- \- debug ]
.RB [ \- h | \- \- help ]
.RB [ \- i | \- \- interval
.IR Seconds ]
.RB [ \- \- noudevsync ]
.RB [ \- v | \- \- verbose ]
.RB [ \- n | \- \- name
.IR LogicalVolume ]
.RI [ SourcePhysicalVolume [ :PE [ -PE ]...]
.RI [ DestinationPhysicalVolume [ :PE [ -PE ]...]...]]
2003-04-30 19:24:08 +04:00
.SH DESCRIPTION
2012-04-11 16:42:10 +04:00
pvmove allows you to move the allocated physical extents (PEs) on
2003-04-30 19:24:08 +04:00
.I SourcePhysicalVolume
to one or more other physical volumes (PVs).
You can optionally specify a source
.I LogicalVolume
in which case only extents used by that LV will be moved to
free (or specified) extents on
.IR DestinationPhysicalVolume (s).
If no
.I DestinationPhysicalVolume
2011-04-28 20:22:47 +04:00
is specified, the normal allocation rules for the Volume Group are used.
2003-04-30 19:24:08 +04:00
2012-04-11 16:42:10 +04:00
If pvmove gets interrupted for any reason (e.g. the machine crashes)
then run pvmove again without any PhysicalVolume arguments to
2004-09-14 17:58:11 +04:00
restart any moves that were in progress from the last checkpoint.
Alternatively use \fB pvmove --abort\fP at any time to abort them
at the last checkpoint.
You can run more than one pvmove at once provided they are moving data
off different SourcePhysicalVolumes, but additional pvmoves will ignore
2011-04-28 20:22:47 +04:00
any Logical Volumes already in the process of being changed, so some
2004-09-14 17:58:11 +04:00
data might not get moved.
\fB pvmove\fP works as follows:
2011-04-28 20:22:47 +04:00
1. A temporary 'pvmove' Logical Volume is created to store
2004-09-14 17:58:11 +04:00
details of all the data movements required.
2011-04-28 20:22:47 +04:00
2. Every Logical Volume in the Volume Group is searched
2004-09-14 17:58:11 +04:00
for contiguous data that need moving
according to the command line arguments.
For each piece of data found, a new segment is added to the end of the
pvmove LV.
This segment takes the form of a temporary mirror to copy the data
from the original location to a newly-allocated location.
The original LV is updated to use the new temporary mirror segment
in the pvmove LV instead of accessing the data directly.
2011-04-28 20:22:47 +04:00
3. The Volume Group metadata is updated on disk.
2004-09-14 17:58:11 +04:00
2011-04-28 20:22:47 +04:00
4. The first segment of the pvmove Logical Volume is activated and starts
2004-09-14 17:58:11 +04:00
to mirror the first part of the data. Only one segment is mirrored at once
as this is usually more efficient.
5. A daemon repeatedly checks progress at the specified time interval.
When it detects that the first temporary mirror is in-sync,
it breaks that mirror so that only the new location for that data gets used
2011-04-28 20:22:47 +04:00
and writes a checkpoint into the Volume Group metadata on disk.
2004-09-14 17:58:11 +04:00
Then it activates the mirror for the next segment of the pvmove LV.
6. When there are no more segments left to be mirrored,
2011-04-28 20:22:47 +04:00
the temporary Logical Volume is removed and the Volume Group metadata
is updated so that the Logical Volumes reflect the new data locations.
2004-09-14 17:58:11 +04:00
Note that this new process cannot support the original LVM1
type of on-disk metadata. Metadata can be converted using \fB vgconvert\fP (8).
2003-04-30 19:24:08 +04:00
.SH OPTIONS
2012-04-11 16:42:10 +04:00
See \fB lvm\fP (8) for common options.
2003-04-30 19:24:08 +04:00
.TP
2012-04-11 16:42:10 +04:00
.B \- \- abort
2004-09-14 17:58:11 +04:00
Abort any moves in progress.
.TP
2012-04-11 16:42:10 +04:00
.B \- \- noudevsync
2009-08-04 12:09:52 +04:00
Disable udev synchronisation. The
process will not wait for notification from udev.
It will continue irrespective of any possible udev processing
in the background. You should only use this if udev is not running
or has rules that ignore the devices LVM2 creates.
.TP
2012-04-11 16:42:10 +04:00
.BR \- b ", " \- \- background
2004-09-14 17:58:11 +04:00
Run the daemon in the background.
2003-07-18 04:41:04 +04:00
.TP
2012-04-11 16:42:10 +04:00
.BR \- i ", " \- \- interval " " \fI Seconds
2003-04-30 19:24:08 +04:00
Report progress as a percentage at regular intervals.
.TP
2012-04-11 16:42:10 +04:00
.BR \- n ", " \- \- name " " \fI LogicalVolume
2003-04-30 19:24:08 +04:00
Move only the extents belonging to
.I LogicalVolume
from
.I SourcePhysicalVolume
instead of all allocated extents to the destination physical volume(s).
2012-04-11 16:42:10 +04:00
.SH Examples
2011-04-28 20:22:47 +04:00
To move all Physical Extents that are used by simple Logical Volumes on
2012-04-11 16:42:10 +04:00
/dev/sdb1 to free Physical Extents elsewhere in the Volume Group use:
2003-04-30 19:24:08 +04:00
.sp
2012-04-11 16:42:10 +04:00
.B pvmove /dev/sdb1
2011-02-10 01:24:55 +03:00
.P
2012-04-11 16:42:10 +04:00
Additionally, a specific destination device /dev/sdc1
2011-04-28 20:22:47 +04:00
can be specified like this:
2008-10-08 16:50:13 +04:00
.sp
2012-04-11 16:42:10 +04:00
.B pvmove /dev/sdb1 /dev/sdc1
2011-02-10 01:24:55 +03:00
.P
2011-04-28 20:22:47 +04:00
To perform the action only on extents belonging to the single Logical Volume
2012-04-11 16:42:10 +04:00
lvol1 do this:
2011-02-10 01:24:55 +03:00
.sp
2012-04-11 16:42:10 +04:00
.B pvmove -n lvol1 /dev/sdb1 /dev/sdc1
2011-02-10 01:24:55 +03:00
.P
Rather than moving the contents of the entire device, it is possible to
2012-04-11 16:42:10 +04:00
move a range of Physical Extents - for example numbers 1000 to 1999
inclusive on /dev/sdb1 - like this:
2011-02-10 01:24:55 +03:00
.sp
2012-04-11 16:42:10 +04:00
.B pvmove /dev/sdb1:1000-1999
2011-02-10 01:24:55 +03:00
.P
2013-09-23 22:50:34 +04:00
A range can also be specified as start+length, so
.sp
.B pvmove /dev/sdb1:1000+1000
.P
also refers to 1000 Physical Extents starting from Physical Extent number 1000.
(Counting starts from 0, so this refers to the 1001st to the 2000th inclusive.)
.P
2011-04-28 20:22:47 +04:00
To move a range of Physical Extents to a specific location (which must have
2013-12-17 22:26:10 +04:00
sufficient free extents) use the form:
2011-02-10 01:24:55 +03:00
.sp
2012-04-11 16:42:10 +04:00
.B pvmove /dev/sdb1:1000-1999 /dev/sdc1
2011-02-10 01:24:55 +03:00
.sp
2011-04-28 20:22:47 +04:00
or
.sp
2012-04-11 16:42:10 +04:00
.B pvmove /dev/sdb1:1000-1999 /dev/sdc1:0-999
2011-02-10 01:24:55 +03:00
.P
2011-04-28 20:22:47 +04:00
If the source and destination are on the same disk, the
.B anywhere
allocation policy would be needed, like this:
.sp
2012-04-11 16:42:10 +04:00
.B pvmove --alloc anywhere /dev/sdb1:1000-1999 /dev/sdb1:0-999
2011-04-28 20:22:47 +04:00
.P
The part of a specific Logical Volume present within in a range of Physical
Extents can also be picked out and moved, like this:
2011-02-10 01:24:55 +03:00
.sp
2012-04-11 16:42:10 +04:00
.B pvmove -n lvol1 /dev/sdb1:1000-1999 /dev/sdc1
2003-04-30 19:24:08 +04:00
.SH SEE ALSO
2008-10-08 16:50:13 +04:00
.BR lvm (8),
.BR vgconvert (8)
2011-04-28 20:22:47 +04:00
.BR pvs (8)