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

Re: [linux-lvm] Bringing an existing filesystem under LVM2 control

Alasdair G Kergon wrote:
A question which came up again on irc last night was whether an existing
filesystem on a non-LVM partition can be turned into an LVM logical volume
without having to wipe the disk.

With LVM2, I think the answer is often 'Yes'.

6. Finally run fsck on your new logical volume and check everything worked.

Wow, that's a bit scary. The problem I see with it is you have PV data sitting inside a LV. An errant tool operating on the filesystem would wipe out your entire volumegroup (until you manually intervened) rather then just screwing up one filesystem.

What I would do is copy the first (and probably last depending on alignment) extant out to another PV, then pvcreate. You end up losing one or extants due to it, but there's always waste when dealing with large blocksizes.

Something like this:

lvcreate temporary-filesystem-head
copy one extant from raw partition -> vg1/temporary-filesystem-head
pvcreate on raw partition
vgextend vg1  raw partition
edit  the config backup to set the pe_start=pe_size
restore the config
lvextend temporary-filesystem-head raw_partition filesystem size

depending on alignment and allocation, you may have to copy the filesystem tail to another PV.

Wastes a bit more space, but you don't end up with an oddball PV with
it's UUID in the middle of a filesystem.

Now for the tough question: With LVM2 built on device-mapper, why isn't extant_size = 512 bytes? Is large-chunk allocation just leftover from LVM1, or is there a deeper technical reason for keeping it large?

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