[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 10:19 AM, Chris Purves wrote:
I have a 500 GB disk that is full and I would like to use it and a new 1 TB disk to create a 1.5 TB logical volume.  Is it possible to do this without destroying the data on the 500 GB disk?

The manpage for pvcreate gives a warning that running pvcreate on a whole disk will erase the partition table (and therefore the data), but doesn't say what the effect is when running on an existing partition.

I haven't used lvm2 before, and although it seems straightforward to create logical volumes with empty disks, I couldn't find any info for disks with existing data.

Thanks.


It's not clear to me reading your post: Is the existing data on LVM? If so, then moving it is easy. If not, then it's a little too late to use LVM to move the data.

However, you should definitely use LVM for your new setup.

If not on LVM, it is easiest to move the data with the partition *not* mounted as / (root). If you have another computer running Linux, you can just temporarily move both drives over there and do it. If you only have the one, then you might want to use a live CD. Boot from it, then do the work.

But *do* definitely use LVM on the new drive, and next time, you will be ahead of the game.

Some people would use rsync, and some might use chroot shenanigans, but I think it's safer to mount the partition read-only and then copy the files.


Reply to: