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.
Thanks.
-Ben
Quoted 2 lines · Ben Nemec
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.
Signature · 1 line
Mikael Abrahamsson email: [email protected]
Quoted 6 lines · On Tue, 3 Aug 2010 07:22:01 +0200 (CEST) Mikael Abrahamsson <[email protected]>…
Quoted 2 lines · Ben Nemec
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
Quoted 4 lines
Use
dd_rescue(or ddrescue, they are two different utils) instead of dd in case you have any bad blocks.
Quoted 5 lines · On Tue, 3 Aug 2010 16:14:56 +1000 Neil Brown <[email protected]> wrote:
Quoted 1 line
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).
Signature · 2 lines
With respect, Roman
Quoted 9 lines · On Tue, 3 Aug 2010 13:46:58 +0600 Roman Mamedov <[email protected]> wrote:
Quoted 5 lines · On Tue, 3 Aug 2010 16:14:56 +1000 Neil Brown <[email protected]> wrote:
Quoted 1 line
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.
Quoted 6 lines
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
Quoted 10 lines · Neil Brown
Quoted 7 lines · On Tue, 3 Aug 2010 13:46:58 +0600 Roman Mamedov <[email protected]> wrote:
Quoted 4 lines · On Tue, 3 Aug 2010 16:14:56 +1000 Neil Brown <[email protected]> wrote:
Quoted 2 lines
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
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
the
same size. Normally they will but it is worth double checking that
the
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
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
Quoted 1 line
Quoted 1 line
drive to be of exactly the same size as the old one, by setting a HPA
on
Quoted 5 lines
Quoted 3 lines
it
(see hdparm -N).The thing that you include into the RAID0 must be the same size. If
that
Quoted 6 lines
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
Quoted 1 line
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
Quoted 10 lines
-----Original Message-----
From: [email protected] [mailto:linux-raid- [email protected]] On Behalf Of Ben Nemec
Sent: Monday, August 02, 2010 5:18 PM
To: [email protected]
Subject: Replacing a drive in RAID 0Hi,
Quoted 9 lines
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.
Quoted 11 lines · Leslie Rhorer
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:linux-raid- [email protected]] On Behalf Of Ben Nemec
Sent: Monday, August 02, 2010 5:18 PM
To: [email protected]
Subject: Replacing a drive in RAID 0Hi,
I have a disk in a RAID 0 array that SMART tells me is dying, but
hasn't
Quoted 1 line
Quoted 1 line
died yet. I have a warranty replacement on the way, and I'm wondering
if
Quoted 1 line
Quoted 1 line
there's any way to copy the data off the dying drive to the new drive
and
Quoted 10 lines
Quoted 6 lines
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
Quoted 4 lines
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
Quoted 1 line
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