Re: safest way to swap in a new physical disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2006-11-14 at 00:06 -0800, Will Sheffler wrote:
> Hi.
> 
> What is the safest way to switch out a disk in a software raid array  
> created with mdadm? I'm not talking about replacing a failed disk, I  
> want to take a healthy disk in the array and swap it for another  
> physical disk. Specifically, I have an array made up of 10 250gb  
> software-raid partitions on 8 300gb disks and 2 250gb disks, plus a  
> hot spare. I want to switch the 250s to new 300gb disks so everything  
> matches. Is there a way to do this without risking a rebuild? I can't  
> back everything up, so I want to be as risk-free as possible.
> 
> I guess what I want is to do something like this:
> 
> (1) Unmount the array
> (2) Un-create the array
> (3) Somehow exactly duplicate partition X to a partition Y on a new disk
> (4) Re-create array with X gone and Y in it's place
> (5) Check if the array is OK without changing/activating it
> (6) If there is a problem, switch from Y back to X and have it as  
> though nothing changed
> 
> The part I'm worried about is (3), as I've tried duplicating  
> partition images before and it never works right. Is there a way to  
> do this with mdadm?

Is this a RAID 5 or RAID 6?  If so, you don't have to do steps 1 or 2.
Assuming that you have RAID 5 on /dev/md0, that your 250GB partition
is /dev/sda1, and that you have a fairly modern kernel/mdadm, here are
the steps:

1. Fail and remove the drive from the array:
   mdadm /dev/md0 -f /dev/sda1 -r /dev/sda1

2. Physically remove the drive and replace it with the 300GB drive.

3. Partition the new drive.  You can just make one partition that spans
the whole 300 GB.  Don't try to make it match the 250GB partition.

4. Add it to the array.
   mdadm /dev/md0 -a /dev/sda1
   (assuming /dev/sda1 is that new partition)

5. Repeat with the second drive.

6. If all went well, you could actually increase the devices of the
array (they are all using 250GB of the 300GB).
   mdadm -G /dev/md0 -z max
   WARNING:  once you increase the size of your usable partitions, you
will not be able to use those 250GB disks again.

-- 
Forrest

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux