All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Herr <gmane@wombatz.com>
To: linux-raid@vger.kernel.org
Subject: Re: Replacing a RAID1 drive that has not failed.
Date: Tue, 27 Oct 2015 16:45:23 +0000 (UTC)	[thread overview]
Message-ID: <n0o9n3$gmk$2@ger.gmane.org> (raw)
In-Reply-To: n0mbam$gmk$1@ger.gmane.org

Thanks to both Wol and Eddie for pointing me to the --replace option and 
for not simply telling me to RTFM.  Part of my confusion was based on my 
last attempt (years back) to find out if three drive RAID 1 was even an 
option.  Just as before I found stuff that laughed at the mere idea of a 
three drive mirror.  Seems people were getting too tied up on the word 
"mirror", which is not really a proper name for it in my view.  The 
mirror copy of myself when looking into a mirror is *not* the same in me 
in so many ways.  Oh, and now I think I understand that hardware RAID 
rarely or never allows it but Linux md RAID has it now and maybe had it 
the whole time.

That said, I really should have slogged thru the man page better.  It 
does seem that --replace includes the key feature that I want:

"the  device remains  in  service  during the recovery process to 
increase resilience against multiple failures."


So, just in case somebody wants to see if they can find anything I 
missed, here is my current plan...


 1. Partition new drive (plugged in via external SATA dock)
#fdisk /dev/sdc
(make it an exact match of sda/sdb unless it turns out to be smaller,
 in which case I can shrink /boot to make room.)

 2. Replace sda partition with sdc partition for each RAID.
(Could do all at once but feels safer to do one at a time.)
#mdadm /dev/md123 --replace /dev/sda7 --with /dev/sdc7
#watch /proc/mdstat
#mdadm /dev/md125 --replace /dev/sda6 --with /dev/sdc6
#watch /proc/mdstat
#mdadm /dev/md126 --replace /dev/sda3 --with /dev/sdc3
#watch /proc/mdstat
#mdadm /dev/md1 --replace /dev/sda5 --with /dev/sdc5
#watch /proc/mdstat
#mdadm /dev/md4 --replace /dev/sda2 --with /dev/sdc2
#watch /proc/mdstat

 3. All RAIDs should be "active" and in "[UU]" status, with no sda partitions.
#cat /proc/mdstat

(Consider if this should only be done later/never so that sda can 
 be a form of backup in case of issues during the post replace reboot.)
 4. Prevent the old partitions from ever being pulled into the RAIDs.
#mdadm --zero-superblock /dev/sda7
#mdadm --zero-superblock /dev/sda6
#mdadm --zero-superblock /dev/sda3
#mdadm --zero-superblock /dev/sda5
#mdadm --zero-superblock /dev/sda2

 5. Make a new /boot on sdc.
(using rsync since the language is taken from my daily cron and this is a 
 tad quicker if I end up running it more than once.)
(fstab line needing update: UUID=52b14d98-b284-41a0-a36f-459ae3ae12a7 /boot ext4 defaults 1 2)
#mkfs.ext4 /dev/sdc1
#mkdir /bootnew
#mount /dev/sdc1 /bootnew
#rsync -a --delete /boot/ /bootnew
#grub-install /dev/sdc
#blkid /dev/sdc1
#vim /etc/fstab
#umount /bootnew ; rmdir /bootnew

 6. Power down and swap sdc into sda "slot".

 7. Make sure that all RAIDs are "active" and in "[UU]" status:
#cat /proc/mdstat




-- 
Doug Herr 


  parent reply	other threads:[~2015-10-27 16:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26 23:00 Replacing a RAID1 drive that has not failed Doug Herr
     [not found] ` <CACsGCyTM_J2+_oJm0rUsZvuF0AXXu6xX572F4HP+OGsjP_AvfQ@mail.gmail.com>
2015-10-27  0:41   ` Fwd: " Edward Kuns
2015-10-27 16:45 ` Doug Herr [this message]
2015-10-27 21:31   ` Wols Lists
2015-10-28  5:28     ` Roman Mamedov
2015-10-28 15:54       ` Doug Herr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='n0o9n3$gmk$2@ger.gmane.org' \
    --to=gmane@wombatz.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.