[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: creating a logical volume with a disk with existing data

On 9/29/2010 4:53 PM, Nuno Magalhães wrote:

I followed [1] two days ago and it suited me. I had a non-LVM 160GB
disk with / and /home (ext3), plus a blank 1TB. What i did was
partition the whole 1TB as a "Linux LVM" partition, then set up the vg
and a -home (ext4) partition.

Then i mounted the LVM -home as /mount/tmp and copied my non-LVM /home
from the 160GB to the 1TB. I don't think it's feasible to turn a
non-LVM partition into an LVM one, you'd definitely lose data, so you
do need to copy.

So right now i have my old 160GB as it was, plus an LVM 1TB with a
-home partition (i wanna make sure it copied everything right before i
change fstab). The plan is to dump the partitions in the 160GB (which
include a rarely-if-ever used 15GB for XP (thanks to virtualbox)) and
to a fresh reinstall, using the installer's lvm-manager to set up both
drives. Hopefully it'll recognise one already has LVM, so i can add
everything to the same volume group.

Then i'll be able to set / as LVM (and /boot out of it apparently), as
well as other partitions for multimedia, vbox disks and maybe
something for public access like /var/www

Question 0: won't extending an existing lvm partition fragment it?

Question 1: is it feasable under linux (and an Asus m2npv-vm) to use
RAID as well? I was considering RAIDing 160GB since the drives are of
different sizes, maybe RAID 0 or 1, but i'm not sure such complexity
is worth it and even though the mb supports it, i think it's more sw
than hw-raid. But this is highjaking already.

RAID is definitely feasible under Linux. You would be using software RAID, but Linux has very good software RAID. No need to use the mb RAID. Use Linux RAID. (mdraid)

You can create partitions of equal size on each disk. The RAID would be across partitions. So, the unequal sizes of the disks would not matter. You can create and use additional partitions on the larger drive, separate from the RAIDed one. Thus, you would have the use of the whole drive capacity. However, the rest of the drive wouldn't be protected. It's even possible to have bizarre combinations spanning partitions on several disks.

After creating the setup you want, use LVM on top of the RAID.

Question 2: In order to add the 160GB drive, do i also format is as an
160GB "Linux LVM" partition and add that to the volume group? Will i
then have two drives under /dev/mapper? Is the split still there or
could i expand the existing LVM partition onto the 160GB and create
logical vlumes for / and what not in it?

HTH and TIA and some other acronym,

[1] http://www.linux.com/learn/tutorials/306352-weekend-project-migrate-from-direct-partitions-to-lvm-volumes

I'm not sure what you're asking. You probably want to set up the RAID first, and then put LVM on that. You will see different views of your setup in different places. As far as the Linux file system goes (what you see when you type "mount" on the command line), it will only see whatever separate individual logical volumes you create (that are mounted). There can be both LVM and non-LVM volumes visible as block devices at the same time.

If you put everything under LVM, you will see two "drives" if you have two logical volumes.

You can add new physical volumes and expand a logical volume at any time.

Reply to: