public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] LVM: Removing 3 disks and replacing with 1
@ 2012-03-06  9:45 Datty
  2012-03-06 16:32 ` Stroller
  0 siblings, 1 reply; 15+ messages in thread
From: Datty @ 2012-03-06  9:45 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1059 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06  9:45 [gentoo-user] LVM: Removing 3 disks and replacing with 1 Datty
@ 2012-03-06 16:32 ` Stroller
  2012-03-06 17:02   ` Stefan G. Weichinger
                     ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Stroller @ 2012-03-06 16:32 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 309 bytes --]


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.


[-- Attachment #2: Type: text/html, Size: 610 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06 16:32 ` Stroller
@ 2012-03-06 17:02   ` Stefan G. Weichinger
  2012-03-06 17:24   ` Florian Philipp
  2012-03-06 17:25   ` Neil Bothwick
  2 siblings, 0 replies; 15+ messages in thread
From: Stefan G. Weichinger @ 2012-03-06 17:02 UTC (permalink / raw
  To: gentoo-user

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`.

;-)




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06 16:32 ` Stroller
  2012-03-06 17:02   ` Stefan G. Weichinger
@ 2012-03-06 17:24   ` Florian Philipp
  2012-03-06 17:25   ` Neil Bothwick
  2 siblings, 0 replies; 15+ messages in thread
From: Florian Philipp @ 2012-03-06 17:24 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 910 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06 16:32 ` Stroller
  2012-03-06 17:02   ` Stefan G. Weichinger
  2012-03-06 17:24   ` Florian Philipp
@ 2012-03-06 17:25   ` Neil Bothwick
  2012-03-06 17:44     ` Florian Philipp
  2012-03-06 18:34     ` Stroller
  2 siblings, 2 replies; 15+ messages in thread
From: Neil Bothwick @ 2012-03-06 17:25 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06 17:25   ` Neil Bothwick
@ 2012-03-06 17:44     ` Florian Philipp
  2012-03-06 19:05       ` Neil Bothwick
  2012-03-06 18:34     ` Stroller
  1 sibling, 1 reply; 15+ messages in thread
From: Florian Philipp @ 2012-03-06 17:44 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06 17:25   ` Neil Bothwick
  2012-03-06 17:44     ` Florian Philipp
@ 2012-03-06 18:34     ` Stroller
  2012-03-06 18:47       ` Michael Mol
  1 sibling, 1 reply; 15+ messages in thread
From: Stroller @ 2012-03-06 18:34 UTC (permalink / raw
  To: gentoo-user


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.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06 18:34     ` Stroller
@ 2012-03-06 18:47       ` Michael Mol
  2012-03-06 19:14         ` Florian Philipp
  0 siblings, 1 reply; 15+ messages in thread
From: Michael Mol @ 2012-03-06 18:47 UTC (permalink / raw
  To: gentoo-user

On Tue, Mar 6, 2012 at 1:34 PM, Stroller <stroller@stellar.eclipse.co.uk> 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



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06 17:44     ` Florian Philipp
@ 2012-03-06 19:05       ` Neil Bothwick
  2012-03-07  0:46         ` Peter Humphrey
  0 siblings, 1 reply; 15+ messages in thread
From: Neil Bothwick @ 2012-03-06 19:05 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1514 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06 18:47       ` Michael Mol
@ 2012-03-06 19:14         ` Florian Philipp
  0 siblings, 0 replies; 15+ messages in thread
From: Florian Philipp @ 2012-03-06 19:14 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]

Am 06.03.2012 19:47, schrieb Michael Mol:
> On Tue, Mar 6, 2012 at 1:34 PM, Stroller <stroller@stellar.eclipse.co.uk> 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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-06 19:05       ` Neil Bothwick
@ 2012-03-07  0:46         ` Peter Humphrey
  2012-03-07  9:03           ` Neil Bothwick
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Humphrey @ 2012-03-07  0:46 UTC (permalink / raw
  To: gentoo-user

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



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-07  0:46         ` Peter Humphrey
@ 2012-03-07  9:03           ` Neil Bothwick
  2012-03-07 13:33             ` Frank Steinmetzger
  0 siblings, 1 reply; 15+ messages in thread
From: Neil Bothwick @ 2012-03-07  9:03 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

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?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-07  9:03           ` Neil Bothwick
@ 2012-03-07 13:33             ` Frank Steinmetzger
  2012-03-08 16:39               ` Datty
  0 siblings, 1 reply; 15+ messages in thread
From: Frank Steinmetzger @ 2012-03-07 13:33 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

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*

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-07 13:33             ` Frank Steinmetzger
@ 2012-03-08 16:39               ` Datty
  2012-03-08 16:47                 ` Neil Bothwick
  0 siblings, 1 reply; 15+ messages in thread
From: Datty @ 2012-03-08 16:39 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1919 bytes --]

On Wed, Mar 7, 2012 at 1:33 PM, Frank Steinmetzger <Warp_7@gmx.de> 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.

[-- Attachment #2: Type: text/html, Size: 2341 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] LVM: Removing 3 disks and replacing with 1
  2012-03-08 16:39               ` Datty
@ 2012-03-08 16:47                 ` Neil Bothwick
  0 siblings, 0 replies; 15+ messages in thread
From: Neil Bothwick @ 2012-03-08 16:47 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-03-08 16:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-06  9:45 [gentoo-user] LVM: Removing 3 disks and replacing with 1 Datty
2012-03-06 16:32 ` Stroller
2012-03-06 17:02   ` Stefan G. Weichinger
2012-03-06 17:24   ` Florian Philipp
2012-03-06 17:25   ` Neil Bothwick
2012-03-06 17:44     ` Florian Philipp
2012-03-06 19:05       ` Neil Bothwick
2012-03-07  0:46         ` Peter Humphrey
2012-03-07  9:03           ` Neil Bothwick
2012-03-07 13:33             ` Frank Steinmetzger
2012-03-08 16:39               ` Datty
2012-03-08 16:47                 ` Neil Bothwick
2012-03-06 18:34     ` Stroller
2012-03-06 18:47       ` Michael Mol
2012-03-06 19:14         ` Florian Philipp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox