summaryrefslogtreecommitdiffstats
path: root/man/pvmove.8.in
blob: de20abb6c11e662e4d09ad9c74cc6be48fd89e3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
.TH PVMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvmove \- move physical extents
.SH SYNOPSIS
.B pvmove
.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 ]...]...]]
.SH DESCRIPTION
pvmove allows you to move the allocated physical extents (PEs) on
.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
is specified, the normal allocation rules for the Volume Group are used.

If pvmove gets interrupted for any reason (e.g. the machine crashes)
then run pvmove again without any PhysicalVolume arguments to
restart any moves that were in progress from the last checkpoint.
Alternatively use \fBpvmove --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
any Logical Volumes already in the process of being changed, so some
data might not get moved.

\fBpvmove\fP works as follows:

1. A temporary 'pvmove' Logical Volume is created to store
details of all the data movements required.

2. Every Logical Volume in the Volume Group is searched
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.

3. The Volume Group metadata is updated on disk.

4. The first segment of the pvmove Logical Volume is activated and starts
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 
and writes a checkpoint into the Volume Group metadata on disk.
Then it activates the mirror for the next segment of the pvmove LV.

6. When there are no more segments left to be mirrored, 
the temporary Logical Volume is removed and the Volume Group metadata 
is updated so that the Logical Volumes reflect the new data locations.

Note that this new process cannot support the original LVM1
type of on-disk metadata.  Metadata can be converted using \fBvgconvert\fP(8).

N.B. The moving of mirrors, snapshots and their origins is not yet supported.

.SH OPTIONS
See \fBlvm\fP(8) for common options.
.TP
.B \-\-abort
Abort any moves in progress.
.TP
.B \-\-noudevsync
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
.BR \-b ", " \-\-background
Run the daemon in the background.
.TP
.BR \-i ", " \-\-interval " " \fISeconds
Report progress as a percentage at regular intervals.
.TP
.BR \-n ", " \-\-name " " \fILogicalVolume
Move only the extents belonging to
.I LogicalVolume
from
.I SourcePhysicalVolume
instead of all allocated extents to the destination physical volume(s).

.SH Examples
To move all Physical Extents that are used by simple Logical Volumes on
/dev/sdb1 to free Physical Extents elsewhere in the Volume Group use:
.sp
.B pvmove /dev/sdb1
.P
Any mirrors, snapshots and their origins are left unchanged.
.P
Additionally, a specific destination device /dev/sdc1
can be specified like this:
.sp
.B pvmove /dev/sdb1 /dev/sdc1
.P
To perform the action only on extents belonging to the single Logical Volume 
lvol1 do this:
.sp
.B pvmove -n lvol1 /dev/sdb1 /dev/sdc1
.P
Rather than moving the contents of the entire device, it is possible to
move a range of Physical Extents - for example numbers 1000 to 1999
inclusive on /dev/sdb1 - like this:
.sp
.B pvmove /dev/sdb1:1000-1999
.P
To move a range of Physical Extents to a specific location (which must have
sufficent free extents) use the form:
.sp
.B pvmove /dev/sdb1:1000-1999 /dev/sdc1
.sp
or
.sp
.B pvmove /dev/sdb1:1000-1999 /dev/sdc1:0-999
.P
If the source and destination are on the same disk, the 
.B anywhere
allocation policy would be needed, like this:
.sp
.B pvmove --alloc anywhere /dev/sdb1:1000-1999 /dev/sdb1:0-999
.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:
.sp
.B pvmove -n lvol1 /dev/sdb1:1000-1999 /dev/sdc1
.SH SEE ALSO
.BR lvm (8),
.BR vgconvert (8)
.BR pvs (8)