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

Re: In-place migration to LVM?



> I have a data file collection on three hard disks, each with just one
> partition. The 'primary' partition has the complete directory structure. The
> two 'secondary' partitions partially mirror that directory structure. There
> are some data files on the primary partition. For each data file on one of
> the secondary partitions, there is a soft link to it from the primary
> partition. Each partition has a couple of GB space left. 

> Is it possible to migrate these partitions into one logical volume without loosing or backing up the data? If I had a backup storage large enough to hold all the data ...

If you really really really really want to do it, it can probably
be done.  Something like:

- shrink each partition as much as you can (using resize2fs or
  somesuch).
- move each one of those partitions to the end of the drive.
  this can be done with parted or manually with dd.
- create a new partition on the now free space on each drive.
- give those partitions to LVM.
- create an LVM group and volume, create a filesystem on it and
  mount it.
- move as much as you can from the old 3 partitions to the new
  LVM partition.
- now you have more free space in your old partitions, so, again:
  shrink them, move them to the end of the drive.
- grow your 3 LVM partition with the space newly created.
- move as much as you can from the old 3 partitions to the new
  LVM partition.
- repeat until the old partitions are empty.

The more free space, the faster.

I've done similar things (tho on a single drive), so I know it can
be done.

But I strongly recommend you don't do that, even if you can find a spare
drive to temporarily hold your data and make the whole thing less
painful: spreading a single partition over 3 drives means that if one of
the drives fails, you'll most likely lose most/all of the data rather
than just a third of it.


        Stefan



Reply to: