How to convert the mapping mode (linear -> striped) of an existing LV?

statik213

Golden Member
Oct 31, 2004
1,654
0
0
This is what I've got:

lvm> lvdisplay -m /dev/VolGroup00/LogVol01
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID toDuls-eeR5-c8ze-7W8j-OahQ-wkKH-CJIpx9
LV Write Access read/write
LV Status available
# open 1
LV Size 56.25 GB
Current LE 1800
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0

--- Segments ---
Logical extent 0 to 915:
Type linear
Physical volume /dev/hda3
Physical extents 0 to 915

Logical extent 916 to 1799:
Type linear
Physical volume /dev/hdb1
Physical extents 0 to 883

Anybody know if it's possible to convert this logical volume to a striped volume?
How? Is it safe?

Thanks!
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Off of the top of my head I would bet 'no'. I figure it would take a very long time to do.. it would be easier to copy or tar/netcat the information on the lvm to another system, redo the lvm into stripped mode, then copy the information back over.

But I am no lvm expert by any stretch of the imagination.
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
Originally posted by: drag
Off of the top of my head I would bet 'no'. I figure it would take a very long time to do.. it would be easier to copy or tar/netcat the information on the lvm to another system, redo the lvm into stripped mode, then copy the information back over.

But I am no lvm expert by any stretch of the imagination.

well this volume is mounted under '/' and contains practically everything..... i'm not scared of messing with it, reinstalling it is no biggie (don't have anything important on it).

can I do this from the fedora rescue cd? would I create a 'snapshot' of the volume and then recreate it and restore the snapshot?
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Well generally I would just do when I want to do something like upgrade a harddrive without having to reinstall stuff.

I have a couple systems. I'll use netcat and tar to copy over the entire / directory and whatever else over the network to another computer while booted up in knoppix or whatnot. Then once I know that worked out fine, then I'll do the format/hardware change or whatever. Then boot back up into knoppix and prepare the partitiosn or lvm or whatever I am using, copy the information back over.

Then I would need to edit /etc/fstab to reflect the changes, mount the proc directory to the now-restored root partition and install the bootloader. Then reboot and hope everything works. Even if I totally mess up I'd still have all the information aviable stored on another system.

Of course this won't be to helpfull if you only have one system or whatnot.

With LVM it may be even easier if you have enough disk space. Make a new logical volume, bootup in knoppix or whatnot, cp --archive or use tar (recommended) to copy over the OS to the new lvm. Confirm everything is copied correctly then remove the old root volume, then either expand the new logical volume to whatever size you like or recreate the old one with different options. If you changed the names of the logical volumes you'd have to fix it in your bootloader config (I generally have a seperate /boot partition from lvm so that I can use grub easily) and in /etc/fstab, but I think that's about it.

If your using a Redhat system you may have EVM setup. They would be more likely to have advanced features, like maybe a linear/striped conversion utility. I am not sure.. Like I said I am no lvm expert.

I'm a Debian user so I don't know exactly what newer versions of Fedora or Redhat may have.

But if you do find a utility or command option to do the conversion, you'll definately want to backup anything important because it's probably going to be pretty risky irregardless (like if you have a crash or a power outage during a conversion)


edit:
oh and for tar be sure to check out the -p and -s switchs for preserving permissions and order.
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
ok, thanks for the info. I'm pretty sure I have more than 50% free space on that volume.
So this is my plan:
1. boot into knoppix / fedora rescue cd (whichever has lvm2)
2. shrink the volume to 50%
3. create new striped volume
4. cp old volume to new
5. rm old volume
6. expand new volume to 100%
7. rename new volume to old volume's name

Since my /boot is a seperate partition (Fedora by default does this) and since the new volume is named the same as the old, I shouldn't have to mess with my boot loader right?

I don't care if i lose my data, there's nothing important here....
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
looks good to me. good luck.

just remember when copying files to allow for perserving permissions and such.