linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: David Brown <lvm@davidb.org>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] LVM - help replacing a drive.
Date: Tue, 21 Feb 2006 10:51:55 -0800	[thread overview]
Message-ID: <20060221185155.GA7180@old.davidb.org> (raw)
In-Reply-To: <BAY101-F36B95A665C96EE64901F3CC1FC0@phx.gbl>

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

      reply	other threads:[~2006-02-21 18:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-21 17:14 [linux-lvm] LVM - help replacing a drive Dave Schile
2006-02-21 18:51 ` David Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060221185155.GA7180@old.davidb.org \
    --to=lvm@davidb.org \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).