linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Replacing a drive in RAID 0
@ 2010-08-02 22:18 Ben Nemec
  2010-08-03  5:22 ` Mikael Abrahamsson
  2010-08-05  6:59 ` Leslie Rhorer
  0 siblings, 2 replies; 8+ messages in thread
From: Ben Nemec @ 2010-08-02 22:18 UTC (permalink / raw)
  To: linux-raid


Hi,

I have a disk in a RAID 0 array that SMART tells me is dying, but hasn't
died yet.  I have a warranty replacement on the way, and I'm wondering if
there's any way to copy the data off the dying drive to the new drive and
swap the RAID array to use the new one (assuming the old one lasts long
enough to do that, of course).  Can I just dd the entire drive over and
replace the bad drive?  Can the md tools do it somehow?  Maybe it's
impossible?  Obviously nothing on this array is irreplaceable, but it would
save me some hassle reinstalling things if I could save it.

Thanks.

-Ben

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

* Re: Replacing a drive in RAID 0
  2010-08-02 22:18 Replacing a drive in RAID 0 Ben Nemec
@ 2010-08-03  5:22 ` Mikael Abrahamsson
  2010-08-03  6:14   ` Neil Brown
  2010-08-05  6:59 ` Leslie Rhorer
  1 sibling, 1 reply; 8+ messages in thread
From: Mikael Abrahamsson @ 2010-08-03  5:22 UTC (permalink / raw)
  To: Ben Nemec; +Cc: linux-raid

On Mon, 2 Aug 2010, Ben Nemec wrote:

> enough to do that, of course).  Can I just dd the entire drive over and
> replace the bad drive?  Can the md tools do it somehow?  Maybe it's

Yes, you can binary copy the drive like that, that's what I usually do.

Use dd_rescue (or ddrescue, they are two different utils) instead of dd in 
case you have any bad blocks.

-- 
Mikael Abrahamsson    email: swmike@swm.pp.se

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

* Re: Replacing a drive in RAID 0
  2010-08-03  5:22 ` Mikael Abrahamsson
@ 2010-08-03  6:14   ` Neil Brown
  2010-08-03  7:46     ` Roman Mamedov
  0 siblings, 1 reply; 8+ messages in thread
From: Neil Brown @ 2010-08-03  6:14 UTC (permalink / raw)
  To: Mikael Abrahamsson; +Cc: Ben Nemec, linux-raid

On Tue, 3 Aug 2010 07:22:01 +0200 (CEST)
Mikael Abrahamsson <swmike@swm.pp.se> wrote:

> On Mon, 2 Aug 2010, Ben Nemec wrote:
> 
> > enough to do that, of course).  Can I just dd the entire drive over and
> > replace the bad drive?  Can the md tools do it somehow?  Maybe it's
> 
> Yes, you can binary copy the drive like that, that's what I usually do.

Of course you need to be sure that the old and new devices are exactly the
same size.  Normally they will but it is worth double checking that the
number of sectors (blockdev --getsize) is exactly the same.

NeilBrown

> 
> Use dd_rescue (or ddrescue, they are two different utils) instead of dd in 
> case you have any bad blocks.
> 


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

* Re: Replacing a drive in RAID 0
  2010-08-03  6:14   ` Neil Brown
@ 2010-08-03  7:46     ` Roman Mamedov
  2010-08-03  8:29       ` Neil Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Mamedov @ 2010-08-03  7:46 UTC (permalink / raw)
  To: Neil Brown; +Cc: Mikael Abrahamsson, Ben Nemec, linux-raid

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

On Tue, 3 Aug 2010 16:14:56 +1000
Neil Brown <neilb@suse.de> wrote:

> > Yes, you can binary copy the drive like that, that's what I usually do.
> 
> Of course you need to be sure that the old and new devices are exactly the
> same size.  Normally they will but it is worth double checking that the
> number of sectors (blockdev --getsize) is exactly the same.

Isn't it okay for the new drive to be larger? At least if the RAID0 was
created from partitions, not whole block devices.
And if it was created from devices, there is a way to make the new larger
drive to be of exactly the same size as the old one, by setting a HPA on it
(see hdparm -N).

-- 
With respect,
Roman

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

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

* Re: Replacing a drive in RAID 0
  2010-08-03  7:46     ` Roman Mamedov
@ 2010-08-03  8:29       ` Neil Brown
  2010-08-03 15:28         ` Ben Nemec
  0 siblings, 1 reply; 8+ messages in thread
From: Neil Brown @ 2010-08-03  8:29 UTC (permalink / raw)
  To: Roman Mamedov; +Cc: Mikael Abrahamsson, Ben Nemec, linux-raid

On Tue, 3 Aug 2010 13:46:58 +0600
Roman Mamedov <roman@rm.pp.ru> wrote:

> On Tue, 3 Aug 2010 16:14:56 +1000
> Neil Brown <neilb@suse.de> wrote:
> 
> > > Yes, you can binary copy the drive like that, that's what I usually do.
> > 
> > Of course you need to be sure that the old and new devices are exactly the
> > same size.  Normally they will but it is worth double checking that the
> > number of sectors (blockdev --getsize) is exactly the same.
> 
> Isn't it okay for the new drive to be larger? At least if the RAID0 was
> created from partitions, not whole block devices.
> And if it was created from devices, there is a way to make the new larger
> drive to be of exactly the same size as the old one, by setting a HPA on it
> (see hdparm -N).
> 

The thing that you include into the RAID0 must be the same size.  If that is
a partition, it is easy to make it the same size, but it is also easy to make
it a different size - so care must be taken.
If it is the whole device ... I wouldn't recommend using HPA - it would
probably confused you later.  Just create a partition of exactly the right
size and use that.

NeilBrown

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

* Re: Replacing a drive in RAID 0
  2010-08-03  8:29       ` Neil Brown
@ 2010-08-03 15:28         ` Ben Nemec
  0 siblings, 0 replies; 8+ messages in thread
From: Ben Nemec @ 2010-08-03 15:28 UTC (permalink / raw)
  To: Neil Brown; +Cc: Roman Mamedov, Mikael Abrahamsson, linux-raid


On Tue, 3 Aug 2010 18:29:50 +1000, Neil Brown <neilb@suse.de> wrote:
> On Tue, 3 Aug 2010 13:46:58 +0600
> Roman Mamedov <roman@rm.pp.ru> wrote:
> 
>> On Tue, 3 Aug 2010 16:14:56 +1000
>> Neil Brown <neilb@suse.de> wrote:
>> 
>> > > Yes, you can binary copy the drive like that, that's what I usually
>> > > do.
>> > 
>> > Of course you need to be sure that the old and new devices are
exactly
>> > the
>> > same size.  Normally they will but it is worth double checking that
the
>> > number of sectors (blockdev --getsize) is exactly the same.
>> 
>> Isn't it okay for the new drive to be larger? At least if the RAID0 was
>> created from partitions, not whole block devices.
>> And if it was created from devices, there is a way to make the new
larger
>> drive to be of exactly the same size as the old one, by setting a HPA
on
>> it
>> (see hdparm -N).
>> 
> 
> The thing that you include into the RAID0 must be the same size.  If
that
> is
> a partition, it is easy to make it the same size, but it is also easy to
> make
> it a different size - so care must be taken.
> If it is the whole device ... I wouldn't recommend using HPA - it would
> probably confused you later.  Just create a partition of exactly the
right
> size and use that.

Fortunately the arrays are built from partitions and not block devices,
and the one at the end of the disk is just /tmp so even if the new disk is
slightly smaller for some reason it won't be a big deal to lose that
particular array.  Now I just have to hope that the failing one lasts long
enough to pull the data off...

Thanks for all your help.

-Ben

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

* RE: Replacing a drive in RAID 0
  2010-08-02 22:18 Replacing a drive in RAID 0 Ben Nemec
  2010-08-03  5:22 ` Mikael Abrahamsson
@ 2010-08-05  6:59 ` Leslie Rhorer
  2010-08-05 14:51   ` Ben Nemec
  1 sibling, 1 reply; 8+ messages in thread
From: Leslie Rhorer @ 2010-08-05  6:59 UTC (permalink / raw)
  To: lists, linux-raid

> -----Original Message-----
> From: linux-raid-owner@vger.kernel.org [mailto:linux-raid-
> owner@vger.kernel.org] On Behalf Of Ben Nemec
> Sent: Monday, August 02, 2010 5:18 PM
> To: linux-raid@vger.kernel.org
> Subject: Replacing a drive in RAID 0
> 
> 
> Hi,
> 
> I have a disk in a RAID 0 array that SMART tells me is dying, but hasn't
> died yet.  I have a warranty replacement on the way, and I'm wondering if
> there's any way to copy the data off the dying drive to the new drive and
> swap the RAID array to use the new one (assuming the old one lasts long
> enough to do that, of course).  Can I just dd the entire drive over and
> replace the bad drive?  Can the md tools do it somehow?  Maybe it's
> impossible?  Obviously nothing on this array is irreplaceable, but it
> would
> save me some hassle reinstalling things if I could save it.

	Well, yes, although one cannot guarantee there won't be any data
loss.  Of course you will need to take the array offline, and indeed I
recommend you take it down now - or at least remount it as read-only, and
don't do any writes to it until after you have the new drive in place.
Install the new drive, and then use ddrescue to copy the contents of the old
drive to the new.  Read the man page for ddrescue carefully, and take care
not to accidentally copy the new drive to the old.


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

* RE: Replacing a drive in RAID 0
  2010-08-05  6:59 ` Leslie Rhorer
@ 2010-08-05 14:51   ` Ben Nemec
  0 siblings, 0 replies; 8+ messages in thread
From: Ben Nemec @ 2010-08-05 14:51 UTC (permalink / raw)
  To: Leslie Rhorer; +Cc: linux-raid


On Thu, 5 Aug 2010 01:59:02 -0500, "Leslie Rhorer" <lrhorer@satx.rr.com>
wrote:
>> -----Original Message-----
>> From: linux-raid-owner@vger.kernel.org [mailto:linux-raid-
>> owner@vger.kernel.org] On Behalf Of Ben Nemec
>> Sent: Monday, August 02, 2010 5:18 PM
>> To: linux-raid@vger.kernel.org
>> Subject: Replacing a drive in RAID 0
>> 
>> 
>> Hi,
>> 
>> I have a disk in a RAID 0 array that SMART tells me is dying, but
hasn't
>> died yet.  I have a warranty replacement on the way, and I'm wondering
if
>> there's any way to copy the data off the dying drive to the new drive
and
>> swap the RAID array to use the new one (assuming the old one lasts long
>> enough to do that, of course).  Can I just dd the entire drive over and
>> replace the bad drive?  Can the md tools do it somehow?  Maybe it's
>> impossible?  Obviously nothing on this array is irreplaceable, but it
>> would
>> save me some hassle reinstalling things if I could save it.
> 
> 	Well, yes, although one cannot guarantee there won't be any data
> loss.  Of course you will need to take the array offline, and indeed I
> recommend you take it down now - or at least remount it as read-only,
and
> don't do any writes to it until after you have the new drive in place.
> Install the new drive, and then use ddrescue to copy the contents of the
> old
> drive to the new.  Read the man page for ddrescue carefully, and take
care
> not to accidentally copy the new drive to the old.

Yeah, I actually did this last night and I double-checked that I was
copying to and from the correct drives about half a dozen times.  I used
the Ubuntu Rescue Remix that includes ddrescue to do the actual copy and
everything went perfectly, no lost data according to ddrescue, and the
array came right up once I swapped the new drive in.

Thanks again to everyone for all their help.

-Ben

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

end of thread, other threads:[~2010-08-05 14:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-02 22:18 Replacing a drive in RAID 0 Ben Nemec
2010-08-03  5:22 ` Mikael Abrahamsson
2010-08-03  6:14   ` Neil Brown
2010-08-03  7:46     ` Roman Mamedov
2010-08-03  8:29       ` Neil Brown
2010-08-03 15:28         ` Ben Nemec
2010-08-05  6:59 ` Leslie Rhorer
2010-08-05 14:51   ` Ben Nemec

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