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

Re: [linux-lvm] LVM - help replacing a drive.



On Tue, Feb 21, 2006 at 05:14:41PM +0000, Dave Schile wrote:

> This is a simple question, but I really don't want to lose any data, so I'd 
> really appreciate it if someone could give me a quick rundown on how this 
> is done. I've searched around and read the LVM Howto but Im still not 
> comfortable with this specific scenario:

I just did something similar, and it seemed to work fine.

> I have a simple implementation of LVM that creates logical volume from 
> /dev/hda3 and /dev/hdc1. /dev/hda is a 250G drive that holds the filesystem 
> on /dev/hda1, but only /dev/hda3 is part of the volume group. /dev/hdc1 is 
> a 100G drive with only one partition and its part of the volume group.

Sounds like a reasonable setup.

# lvs --segments -o +devices
will show you the device (and offset) of each segment of each logical
volume.  It is the most concise way to see where everything is at.

> I want to replace /dev/hdc1 with a 250G drive I just bought. Right now the 
> whole logical volume is 334G. All of that is allocated and none is free as 
> far as physical extens go. However, I only have 119G of data on the whole 
> logical volume. Is there any way to tell where physically that data 
> resides? I cannot do a pvmove (as I understand it) because I have no free 
> extens on /dev/hda3. Is it better to make extens available somehow on 
> /dev/hda3 and do a pvmove? or should I install the new drive somewhere 
> else, like /dev/hdb, then add it to the volume group and do a pvmove? If 
> that's the case, then will it screw up the volume group when I move the new 
> drive into its permanent location at /dev/hdc?

Well, assuming that you volume on /dev/hda3 is about 84G, you don't have
enough space to store all of your data on that drive.

If you have another interface to add another drive, that is by far the
easiest way to do it.  I've even added a physical volume on a USB drive,
but I'm not sure I recommend it.

LVM will have no problem with the drives moving around.  Part of each
physical volume is a uuid, and it builds the volume group out of those, not
specific locations.  This does, of course, assume that your startup scripts
are correct.

So, after you add /dev/hdb and partition /dev/hdb1 as your lvm partition.

  # pvcreate /dev/hdb1
  # vgextend vgname /dev/hdb1
  # pvmove /dev/hdc1
    .. Wait ..
  # lvs --segments -o +devices
     Make sure everything is off of /dev/hdc1
  # vgreduce vgname /dev/hdc1

Now you should be able to remove the hdc drive, and put the new drive on
its own controller.

And, standard caveat, do a backup before trying any of this.

Dave


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