My Linux server uses LVM because I replace the machine a year ago and installed from scratch. LVM has been a life saver and I love its flexibility. My Linux laptop, however, was last fully installed three years ago, and thus uses straight partitions.
Is it possible — without a reinstall — to convert an existing system to LVM? If so, what tools can do this job?
I expect that any filesystems to be shared with Windows on a dual-boot system cannot be LVM. If I am wrong, please let me know, but I would be surprised.
Best Answer
Yes, this can be done.
Yes, you can use it for a dual-boot windows system, provided you make Windows the first partition, and it's a primary partition (not an extended inside a logical). My instructions here do not cover this situation, which requires you have some experience dealing with dual booting. If you're after a dual-boot windows/linux setup, don't follow any advice below this point.
I'll go one better: with only a few exceptions, you should be able to migrate your entire laptop live, provided you use an external drive with enough capacity.
Warning! This proceedure is EXTREMELY DANGEROUS! It assumes you have intimate knowledge of the partitioning process, you have a separate /boot partition, and you know a botched attempt can leave you with a brain-damaged installation THAT WON'T BOOT! YOU HAVE BEEN WARNED!
You'll need:
General Procedure (forgive me for lack of a few commands, I'm writing this very quickly):
Create a two partitions on your external drive. In our example, this will show up as /dev/sdb1 and /dev/sdb2.
Format the first partition as ext2 or ext3, and labeled "boot". Format the second partition on the external drive as type "Linux LVM".
Get the newly minted LVM volume recognized by the system using
Carve off a large-enough chunk of the external LVM volume to hold the entire laptop's hard drive. If in doubt, just use all of the space available.
Format your LVM-based volume as ext3 or whatever filesystem tickles your fancy.
For each non-special file system mount, create a directory on your external disk and copy (with attributes) all of your files in each mount to that disk. Ignore copies of mountpoints like /proc, etc. as these are "special".