Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Gentoo: User

LVM: Removing 3 disks and replacing with 1

 

 

Gentoo user RSS feed   Index | Next | Previous | View Threaded


datty.wtb at gmail

Mar 6, 2012, 1:45 AM

Post #1 of 15 (242 views)
Permalink
LVM: Removing 3 disks and replacing with 1

Hi all,

I've got an LVM setup at the minute that consists of 3x1TB and 3x1.5TB
drives. Its setup with one huge XFS partition with all my data on. I don't
have a backup of any kind and I know thats pretty silly but with the cost
of replicating the whole lot being what it is and the lack of space in my
server for more drives I have to live with it for the minute. Its got to
the point now where I have 200gb free on it and the drives are pretty old
so I'm going to need to get some new storage. I initially want to replace
the 3x1TBs with a single 3TB drive but i've never removed/replaced a drive
in an LVM setup before. I think I understand how it is done, using pvmove
but a lot of the information around it has giant warnings saying backup
before you do it. Has anyone used pvmove before and has it gone as planned
or not? Also, would someone with a 3TB drive be able to give me the exact
size of the drive so I can work out if it will have enough extents to
replace the 3 drives?

Thanks for your help

Oliver


stroller at stellar

Mar 6, 2012, 8:32 AM

Post #2 of 15 (235 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On 6 March 2012, at 09:45, Datty wrote:
> … I initially want to replace the 3x1TBs with a single 3TB drive but i've never removed/replaced a drive in an LVM setup before. I think I understand how it is done, using pvmove …

Or you could just format and mount the new drive and use `cp`.

Stroller.


lists at xunil

Mar 6, 2012, 9:02 AM

Post #3 of 15 (236 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

Am 06.03.2012 17:32, schrieb Stroller:
>
> On 6 March 2012, at 09:45, Datty wrote:
>> … I initially want to replace the 3x1TBs with a single 3TB drive but
>> i've never removed/replaced a drive in an LVM setup before. I think I
>> understand how it is done, using pvmove …
>
> Or you could just format and mount the new drive and use `cp`.

;-)


lists at binarywings

Mar 6, 2012, 9:24 AM

Post #4 of 15 (237 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

Am 06.03.2012 17:32, schrieb Stroller:
>
> On 6 March 2012, at 09:45, Datty wrote:
>> … I initially want to replace the 3x1TBs with a single 3TB drive but
>> i've never removed/replaced a drive in an LVM setup before. I think I
>> understand how it is done, using pvmove …
>
> Or you could just format and mount the new drive and use `cp`.
>
> Stroller.
>

+1

If you still want to work on LVM, you can use lvconvert to mirror your
old volume on the new disk and then remove the old disks. The creation
of the mirror should be inherently secure. pvmove should be safe, too. I
know pvmove once crashed for me (old kernel bug, years ago) and I didn't
loose data.

# create mirror, report progress every 10 seconds
lvconvert --interval 10 -m1 vg00/lvol1 /dev/new_disk

# detach mirror, creates snapshot
lvconvert -m0 vg00/lvol1

Disclaimer: Untested

Regards,
Florian Philipp
Attachments: signature.asc (0.26 KB)


neil at digimed

Mar 6, 2012, 9:25 AM

Post #5 of 15 (236 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On Tue, 6 Mar 2012 16:32:56 +0000, Stroller wrote:

> > … I initially want to replace the 3x1TBs with a single 3TB drive but
> > i've never removed/replaced a drive in an LVM setup before. I think I
> > understand how it is done, using pvmove …
>
> Or you could just format and mount the new drive and use `cp`.

Thereby instantly removing the benefits of LVM and making it almost
impossible to extend the space by adding another drive when needed.

To the OP, pvmove is perfectly safe as it does a copy;verify;delete on
one small block of extents at a time. It also ensures that any new writes
while pvmove is running go to the new drive, so you can still use the
system while moving (try doing that with cp :).


--
Neil Bothwick

Interchangeable parts aren't.
Attachments: signature.asc (0.19 KB)


lists at binarywings

Mar 6, 2012, 9:44 AM

Post #6 of 15 (235 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

Am 06.03.2012 18:25, schrieb Neil Bothwick:
> On Tue, 6 Mar 2012 16:32:56 +0000, Stroller wrote:
>
>>> … I initially want to replace the 3x1TBs with a single 3TB drive but
>>> i've never removed/replaced a drive in an LVM setup before. I think I
>>> understand how it is done, using pvmove …
>>
>> Or you could just format and mount the new drive and use `cp`.
>
> Thereby instantly removing the benefits of LVM and making it almost
> impossible to extend the space by adding another drive when needed.
>

I don't think so. vgextend the volume group with the new disk, lvcreate
a new volume using only extents from the new disk, copy data over to it,
swap mount points, done.

Plus points: Removes fragmentation of the old file system. Also probably
faster.

> To the OP, pvmove is perfectly safe as it does a copy;verify;delete on
> one small block of extents at a time. It also ensures that any new writes
> while pvmove is running go to the new drive, so you can still use the
> system while moving (try doing that with cp :).
>
>

Wait, are we talking about a system disk (root and stuff)? I was under
the impression that it's just a data dump. Of course, with system
partitions and other media that cannot be handled read-only for a longer
time, pvmove or lvchange are the better options.

Regards,
Florian Philipp
Attachments: signature.asc (0.26 KB)


stroller at stellar

Mar 6, 2012, 10:34 AM

Post #7 of 15 (240 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On 6 March 2012, at 17:25, Neil Bothwick wrote:

> On Tue, 6 Mar 2012 16:32:56 +0000, Stroller wrote:
>
>>> … I initially want to replace the 3x1TBs with a single 3TB drive but
>>> i've never removed/replaced a drive in an LVM setup before. I think I
>>> understand how it is done, using pvmove …
>>
>> Or you could just format and mount the new drive and use `cp`.
>
> Thereby instantly removing the benefits of LVM and making it almost
> impossible to extend the space by adding another drive when needed.

Uh, why not create a new volume group with the new disk?

OP says he wants to *replace* the old disks.

Admittedly, I don't like the RAID0 nature of LVM, so my question probably did reflect that cynicism.

> To the OP, pvmove is perfectly safe as it does a copy;verify;delete on
> one small block of extents at a time.

Yeah, I actually have quite a bit of confidence that migrating entirely in LVM would work just fine, but my qualifications in this area are quite minimal.

I am glad, however, to have generated some responses to OP's question, which had been languishing for c 8 hours without replies when I commented.

Stroller.


mikemol at gmail

Mar 6, 2012, 10:47 AM

Post #8 of 15 (237 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On Tue, Mar 6, 2012 at 1:34 PM, Stroller <stroller [at] stellar> wrote:
>
> On 6 March 2012, at 17:25, Neil Bothwick wrote:
>
>> On Tue, 6 Mar 2012 16:32:56 +0000, Stroller wrote:
>>
>>>> … I initially want to replace the 3x1TBs with a single 3TB drive but
>>>> i've never removed/replaced a drive in an LVM setup before. I think I
>>>> understand how it is done, using pvmove …
>>>
>>> Or you could just format and mount the new drive and use `cp`.
>>
>> Thereby instantly removing the benefits of LVM and making it almost
>> impossible to extend the space by adding another drive when needed.
>
> Uh, why not create a new volume group with the new disk?
>
> OP says he wants to *replace* the old disks.

Makes a certain amount of sense. But it sounds like he found a tool
(pvmove) to do what he needs to do, and trying to do more on top
complicates things beyond what they need to be.


>
> Admittedly, I don't like the RAID0 nature of LVM, so my question probably did reflect that cynicism.

I typically put LVM on top of RAID.


--
:wq


neil at digimed

Mar 6, 2012, 11:05 AM

Post #9 of 15 (232 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On Tue, 06 Mar 2012 18:44:18 +0100, Florian Philipp wrote:

> >> Or you could just format and mount the new drive and use `cp`.
> >
> > Thereby instantly removing the benefits of LVM and making it almost
> > impossible to extend the space by adding another drive when needed.
> >
>
> I don't think so. vgextend the volume group with the new disk, lvcreate
> a new volume using only extents from the new disk, copy data over to it,
> swap mount points, done.

But Stroller made no mention of LVM on the new disk, just format and
mount.

> > To the OP, pvmove is perfectly safe as it does a copy;verify;delete on
> > one small block of extents at a time. It also ensures that any new
> > writes while pvmove is running go to the new drive, so you can still
> > use the system while moving (try doing that with cp :).

> Wait, are we talking about a system disk (root and stuff)? I was under
> the impression that it's just a data dump. Of course, with system
> partitions and other media that cannot be handled read-only for a longer
> time, pvmove or lvchange are the better options.

It doesn't have to be a system disk, just something that is in use.
Copying 3TB is going to take a while, making the drive unavailable to
whatever needs to write for it for that amount of time may be be
unacceptable and is certainly unnecessary.


--
Neil Bothwick

A consultant is a person who borrows your watch, tells you what time it
is, pockets the watch, and sends you a bill for it.
Attachments: signature.asc (0.19 KB)


lists at binarywings

Mar 6, 2012, 11:14 AM

Post #10 of 15 (236 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

Am 06.03.2012 19:47, schrieb Michael Mol:
> On Tue, Mar 6, 2012 at 1:34 PM, Stroller <stroller [at] stellar> wrote:
>>
>> On 6 March 2012, at 17:25, Neil Bothwick wrote:
>>
>>> On Tue, 6 Mar 2012 16:32:56 +0000, Stroller wrote:
>>>
>>>>> … I initially want to replace the 3x1TBs with a single 3TB drive but
>>>>> i've never removed/replaced a drive in an LVM setup before. I think I
>>>>> understand how it is done, using pvmove …
>>>>
>>>> Or you could just format and mount the new drive and use `cp`.
>>>
>>> Thereby instantly removing the benefits of LVM and making it almost
>>> impossible to extend the space by adding another drive when needed.
>>
>> Uh, why not create a new volume group with the new disk?
>>

Nitpicking: No need for a new volume group, just a new PV. Using a
separate VG makes migration harder.

>> OP says he wants to *replace* the old disks.
>
> Makes a certain amount of sense. But it sounds like he found a tool
> (pvmove) to do what he needs to do, and trying to do more on top
> complicates things beyond what they need to be.
>
>
>>
>> Admittedly, I don't like the RAID0 nature of LVM, so my question probably did reflect that cynicism.
>
> I typically put LVM on top of RAID.
>
>

I guess the OP is running the JBOD nature ("linear" in LVM terms). Not
that it matters, really.

BTW: Am I the only one seeing a good opportunity for creating a backup
using the old disks? LVM snapshots would be perfect here, as long as the
old disks can be kept running.

Regards,
Florian Philipp
Attachments: signature.asc (0.26 KB)


peter at humphrey

Mar 6, 2012, 4:46 PM

Post #11 of 15 (235 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On Tuesday 06 March 2012 19:05:01 Neil Bothwick wrote:
> A consultant is a person who borrows your watch, tells you what time
> it is, pockets the watch, and sends you a bill for it.

I didn't realise you'd been in the white heat of software project
management :-)

--
Rgds
Peter


neil at digimed

Mar 7, 2012, 1:03 AM

Post #12 of 15 (232 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On Wed, 7 Mar 2012 00:46:17 +0000, Peter Humphrey wrote:

> > A consultant is a person who borrows your watch, tells you what time
> > it is, pockets the watch, and sends you a bill for it.
>
> I didn't realise you'd been in the white heat of software project
> management :-)

Believe me, that kind of BS is not restricted to software projects :)


--
Neil Bothwick

Would a fly without wings be called a walk?
Attachments: signature.asc (0.19 KB)


Warp_7 at gmx

Mar 7, 2012, 5:33 AM

Post #13 of 15 (219 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On Wed, Mar 07, 2012 at 09:03:36AM +0000, Neil Bothwick wrote:
> On Wed, 7 Mar 2012 00:46:17 +0000, Peter Humphrey wrote:
>
> > > A consultant is a person who borrows your watch, tells you what time
> > > it is, pockets the watch, and sends you a bill for it.

Ah thanks for the notice, another nice catch for my signature database. :)

> [...]
> Neil Bothwick
>
> Would a fly without wings be called a walk?

What do you call a dead bee? - A was.
*scnr*


datty.wtb at gmail

Mar 8, 2012, 8:39 AM

Post #14 of 15 (221 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On Wed, Mar 7, 2012 at 1:33 PM, Frank Steinmetzger <Warp_7 [at] gmx> wrote:

> On Wed, Mar 07, 2012 at 09:03:36AM +0000, Neil Bothwick wrote:
> > On Wed, 7 Mar 2012 00:46:17 +0000, Peter Humphrey wrote:
> >
> > > > A consultant is a person who borrows your watch, tells you what time
> > > > it is, pockets the watch, and sends you a bill for it.
>
> Ah thanks for the notice, another nice catch for my signature database. :)
>
> > [...]
> > Neil Bothwick
> >
> > Would a fly without wings be called a walk?
>
> What do you call a dead bee? - A was.
> *scnr*
>

Thanks for the replies everyone, to give it a bit more info, its just a big
dump of data but I want to get the old drives out before they die and lose
everything (They're hitting 20,000 hours up time). Before now i'd been
replacing the whole array and literally using cp as mentioned but I can't
afford to do that this time thanks to the price of hard drives. The LVM is
just one big volume group with one big logical volume with xfs slapped on
top covering the whole thing, I set it up so I could just add drives as and
when and expand the filesystem. As far as I understand I'm pretty stuck in
this situation as I believe XFS partitions can't be shrunk only enlarged?
Based on your replies it looks like pvmove is going to be the way forward,
it'll be offline while its being done anyway as I dont have enough sata
ports to plug the new drive in whilst the old 3 are connected (going to
have to pull the OS drive and do the pvmove from sysrescuecd). The other
option of creating a new volume and moving the data to it can't happen
because theres a good 6tb of data on it and I only have a new 3tb going in.

Should it just be a case of adding the new drive as a pv to the volume
group then doing pvmove against one drive at a time and thus removing them
from the volume group?

Thanks again for the replies and I'll give pvmove a go when the drive
arrives.


neil at digimed

Mar 8, 2012, 8:47 AM

Post #15 of 15 (220 views)
Permalink
Re: LVM: Removing 3 disks and replacing with 1 [In reply to]

On Thu, 8 Mar 2012 16:39:11 +0000, Datty wrote:

> Should it just be a case of adding the new drive as a pv to the volume
> group then doing pvmove against one drive at a time and thus removing
> them from the volume group?

Yes, and once you've done the first you can replace it with your system
drive start using it again.


--
Neil Bothwick

Beware of cover disks bearing upgrades.
Attachments: signature.asc (0.19 KB)

Gentoo user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.