Linux: How does the command 'pvmove' work?
Solution 1
pvmove leverage's LVMs ability to create mirror LVs. The first thing it does is set up a temporary LV mirror for each LV on the original PV. Then it syncs the mirrors the LV at the block level, I believe one at a time. Once a LV's mirror is in sync the mirror on the original PV is then removed.
Solution 2
A few standard references for pvmove.
-
pvmove manual page
- Linux Documentation Project LVM HOWTO page
And, a short article at hackery on pvmove Disk Migrations
Related videos on Youtube
simonwjackson
Try, test, fail, and repeat. I develop, prototype, and test innovative UI solutions that push the envelope on front-end engineering and inspire development teams and leaders to invest in new ideas. Specialties: ES6+ Javascript, Vue, Node, HTML, CSS, and an active interest in React / Redux
Updated on September 17, 2022Comments
-
simonwjackson almost 2 years
I have LVM set up on my server and i am going to remove a hard disk. When i use the command..
pvmove
..will this simply copy the data over to the other disks or does it wipe out data as its being copied over?
-
Javier over 14 yearsexactly right, uses mirroring to perform live migration of data. more precisely, it sets up small mirrors, one for each chunk of the data. That way, it can advance slowly and (mostly) safely, by mirroring, verifying, disconnecting the original, repeat with next chunk. Of course, there are lots of horror stories about interrupted moves that leave the whole VG in a mangled state. Backup first!