D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Converting to LVM?

 

Quoting Grant Sewell <dclug@xxxxxxxxxxxxxxxxxx>:

Hi all.

Just noticed Robin's message about LVM on Linux (root-raid, particularly) and
it got me thinking...

I will shortly be covering LVM in one of my classes and I was wondering
whether it is possible to "upgrade" a Linux system to LVM in-situ?  Kind of
like "upgrading to dynamic disks" under Windows?

This is just a ponder...

Got to say I do like LVM. I use it on my old server box, and the desktop PC as 
well. (Overkill for a desktop maybe, but being able to add a partition and 
resize the /usr partition has saved me from trouble a few times!)

Anyway, you got me thinking as well. A quick scan of the LVM howto, seems to 
sugguest there is no "magic command" or cheats you can use and bingo you have 
LVM.

Here is how I would do it if you got multiple partitions. You do need some 
disk space to do this.

1. Create a new partition using fdisk and set it to the correct type.
2. Run pvcreate to initalise the new parition.
3. Add the new parition to the volume group using vgextend (Or create it using 
vgcreate)
4. Create a logical volume using lvcreate for the same size as the partition 
you are going to move.
5. Format the newly created logical volume and mount it.
6. Move the data from the old partition to the new logical volume
7. Unmount the old partiton and remount the new logical volume in the correct 
mount point.
8. Using fdisk, change the type of the old partition to a LVM partition type.
9. Repeat steps 2 to 8 for each remaining partition. :)

One thing you can do is stick a spare hard disc in and add that to the volume 
group temporarly. Then use pvmove to move the data off it, and remove it from 
the volume group.

Pete Hatton
---------------------------------
E-mail:  pete@xxxxxxxxxxxxx
Webpage: http://www.monolight.org
---------------------------------




--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe. FAQ: www.dcglug.org.uk/linux_adm/list-faq.html