D&C GLug - Home Page

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

Re: [LUG] Converting to LVM?

 

On Fri, 18 Mar 2005 11:44:36 +0000
Pete Hatton wrote:

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

Thanks Pete.  I thought it might come to this.  I'm not actually using LVM, but I 
think I might give it a try this afternoon (setting up a new server for myself).  I 
was just wondering if there was a nice feature where you could just "give it a 
command" and voila your non-LVM setup would be magically transformed into LVM.  Bear 
in mind that for my students, this is likely to be the first time they've met LVM, 
so they won't know the ins and outs of it all, so I was trying to find as much 
common ground between OSs.

Cheers.

Grant.
-- 
Artificial intelligence is no match for nuratal stidutipy.

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