LWN.net Logo

Fedora and LVM

Fedora and LVM

Posted Nov 1, 2012 9:50 UTC (Thu) by mordae (subscriber, #54701)
In reply to: Fedora and LVM by epa
Parent article: Fedora and LVM

> For example, suppose you want to upgrade your hard disk. With Slackware it is a simple task to plug in the second disk, boot the machine, partition the second disk and copy everything across, and install the boot loader on the second disk.

Yeah, and with LVM you can do that on-the-fly and safely move LVs while using them. You just move the LVs between PVs (the disks) within the same VG and finally you remove the old drive. You can even do it all incrementally.


(Log in to post comments)

Fedora and LVM

Posted Nov 1, 2012 11:04 UTC (Thu) by epa (subscriber, #39769) [Link]

Do you have a link to some instructions about how to do this?

I had hoped to set up the new disk without touching the old disk - so there is always a fallback if something goes wrong. If you move the LV to the new disk, that means your old disk will no longer work. I think that for upgrading your hard disk, you usually just want to clone everything to the new disk - only with a larger partition size than before.

Fedora and LVM

Posted Nov 1, 2012 12:57 UTC (Thu) by pbonzini (subscriber, #60935) [Link]

pvcreate "formats" a partition for use with LVM.

vgextend (mentioned in the man page for pvcreate) adds the partition to the existing volume group.

pvmove moves the logical volume from the old disk to the new disk.

vgremove removes the old partition from the volume group.

Remember to move /boot manually (it should be easy to do it with dd since it can be left read-only).

Fedora and LVM

Posted Nov 1, 2012 14:40 UTC (Thu) by epa (subscriber, #39769) [Link]

Thank you.

Fedora and LVM

Posted Nov 2, 2012 0:34 UTC (Fri) by lacos (subscriber, #70616) [Link]

s/vgremove/vgreduce/ ; see above (commenting here so you get an email possibly and don't miss the correction)

Fedora and LVM

Posted Nov 1, 2012 21:13 UTC (Thu) by agk (guest, #23332) [Link]

> pvcreate "formats" a partition for use with LVM.

BTW This step is optional now. Basic pvcreate functionality is included in vgextend (and vgcreate).

Fedora and LVM

Posted Nov 2, 2012 0:33 UTC (Fri) by lacos (subscriber, #70616) [Link]

> vgremove removes the old partition from the volume group.

I think this is not correct (it caught my eye because I also have the most trouble remembering this step).

"vgremove" removes an entire volume group.

Instead "vgreduce" is needed here (evict the PV (ie. the partition) from the VG).

Afterwards "pvremove" may be invoked on the partition to "wipe[] the label on [the] device so that LVM will no longer recognise it as a physical volume".

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds