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

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

On September 29, 2010 11:46:05 am Mark Allums wrote:
> 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.
> 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.

The existing data is not on LVM, but I should clarify: The 500 GB disk is used for file storage and is not mounted as root.  I can unmount it without affecting the system.  It occurs to me after reading your post that I could create the logical volume using the 1 TB drive, copy the data from the 500 GB drive to the logical volume, then extend the logical volume to include the 500 GB drive, giving me the 1.5 TB storage volume that I was looking for.

It's still not clear to me though, if I can create the logical volume using the 500 GB drive without losing the data and saving the time it takes to copy the data over.

Chris Purves

"I've seen the look of a fat man having dinner." - Frank Sinatra

Reply to: