Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

pvmove

Move the data of a physical volume to other PVs in the same VG — while the LVs stay in use.

Level
Everyday Linux
Group
LVM
Needs root
Yes
Package
lvm2

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 --abort

Options 20

Most used

-n, --name LV
Move only the extents of this LV.
-b, --background
Run in the background.
-i, --interval SECONDS
How often to show progress.
--abort
Stop all running moves.
--atomic
Move all LVs at once (all or nothing).
--alloc POLICY
Allocation policy for the new place.
-A, --autobackup y|n
Back up the metadata.
--noudevsync
Do not wait for udev.
--reportformat basic|json
Output format.

Common LVM options

-t, --test
Test only; change nothing.
-v, --verbose
More output (repeat for more).
-q, --quiet
Less output.
-y, --yes
Answer yes to questions.
-d, --debug
Debug output.
--config STRING
Override lvm.conf settings for this command only.
--commandprofile STRING, --profile STRING
Use a configuration profile.
--devices PV, --devicesfile STRING
Limit the devices LVM looks at.
--driverloaded y|n, --nolocking, --lockopt STRING, --nohints, --journal STRING
Special and debug settings.
-h, --help, --longhelp
Show help.
--version
Show the version.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 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.

  2. 2Move to a chosen PV

    pvmove /dev/vdc /dev/vde

    New disk first added with vgextend.

  3. 3Then remove the PV

    vgreduce vgdata /dev/vdc; pvremove /dev/vdc

    The disk can now be removed.

  4. 4Move only one LV

    pvmove -n lvdata /dev/vdc /dev/nvme0n1p3

    Put a busy LV on a faster disk.

  5. 5In the background

    pvmove -b /dev/vdc
    lvs -a -o name,copy_percent

    Watch the progress with lvs.

  6. 6Continue after an interruption

    pvmove

    Without arguments it continues unfinished moves.

  7. 7Stop a move

    pvmove --abort

    The data stays where it was safe.

  8. 8Check that the PV is empty

    pvs -o pv_name,pv_used /dev/vdc

    pv_used 0 = empty.

  9. 9Full disk replacement in one go

    vgextend vgdata /dev/vde && pvmove /dev/vdc /dev/vde && vgreduce vgdata /dev/vdc

    Old storage array to new one.

  10. 10Move a range of extents

    pvmove /dev/vdc:0-999 /dev/vde

    Fine control (rarely needed).

Exit codes

0Done.
5Error.