What it does
pvmove PV moves all used extents from that PV to free space on the other PVs of the VG. Then you can remove the PV with vgreduce — the way to replace a disk without downtime. With a target PV (pvmove OLD NEW) the data goes there. A move can be stopped and continued.
How to write it
pvmove [OPTION]... SOURCE_PV[:PE...] [DEST_PV...]
pvmove --abortOptions 20
Most used
Common LVM options
Nothing matches this filter.
Examples 10
$ run as a normal user# run as root (or with sudo)
1Empty a PV
pvmove /dev/vdc /dev/vdc: Moved: 23.53% /dev/vdc: Moved: 100.00%The VG needs enough free space on other PVs.
2Move to a chosen PV
pvmove /dev/vdc /dev/vdeNew disk first added with vgextend.
3Then remove the PV
The disk can now be removed.
4Move only one LV
pvmove -n lvdata /dev/vdc /dev/nvme0n1p3Put a busy LV on a faster disk.
5In the background
pvmove -b /dev/vdc lvs -a -o name,copy_percentWatch the progress with lvs.
6Continue after an interruption
pvmoveWithout arguments it continues unfinished moves.
7Stop a move
pvmove --abortThe data stays where it was safe.
8Check that the PV is empty
pvs -o pv_name,pv_used /dev/vdcpv_used 0 = empty.
9Full disk replacement in one go
Old storage array to new one.
10Move a range of extents
pvmove /dev/vdc:0-999 /dev/vdeFine control (rarely needed).
Nothing matches this filter.
Exit codes
0 | Done. |
5 | Error. |