linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Turmel <philip@turmel.org>
To: Paul van der Vlis <paul@vandervlis.nl>, linux-raid@vger.kernel.org
Subject: Re: Wrong device name after hot-swap
Date: Fri, 22 Jan 2016 17:27:00 -0500	[thread overview]
Message-ID: <56A2ACB4.6060808@turmel.org> (raw)
In-Reply-To: <n7u8gr$1bv$1@ger.gmane.org>

On 01/22/2016 04:55 PM, Paul van der Vlis wrote:
> Hello,
> 
> I want to put bigger disks into my server. What I want to do is replace
> the first disk, rebuild the raid, replace the second disk, rebuild the
> raid. The machine has two disks, sda and sdb.
> 
> But, when I replace a disk, it gets a new device name. E.g. /dev/sdb
> becomes /dev/sdc. After a reboot it's good again, but I prefer not to
> reboot this machine!
> 
> Is there a way to get the correct device name?

No.  Device names are assigned in the order they are encountered after
boot, and that order is not guaranteed by the kernel.  You should never
depend on those names.

When a device name is fully disconnected, modern kernels will recycle
the name at the next opportunity.  You must be using a hotplug-enabled
driver.  For most motherboards, turning on "AHCI" mode in the BIOS on
those sata ports is all you need.

> When not:
> Is it maybe an idea too add the wrong device name to the md-device?
> mdadm /dev/md0 -a /dev/sdc1
> Then replace /dev/sda what becomes /dev/sdd:
> mdadm /dev/md0 -a /dev/sdd1
> Then restore grub on both disks (with "--recheck" ??)
> But what will happen after a reboot later? Will the md-device be
> restored with the old names?

MD stores signatures in the devices it uses that identify them for later
assembly.  It does not depend on the device name, though it is recorded
in the superblock as a "last connected as" kind of indicator.

In general, you should not rely on device names in your system
configuration.  UUIDs and filesystem labels were implemented
specifically to avoid this problem.

Phil

  reply	other threads:[~2016-01-22 22:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 21:55 Wrong device name after hot-swap Paul van der Vlis
2016-01-22 22:27 ` Phil Turmel [this message]
2016-01-22 23:15   ` Paul van der Vlis
2016-01-23  0:51     ` Phil Turmel
2016-01-23 14:45 ` Wols Lists

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=56A2ACB4.6060808@turmel.org \
    --to=philip@turmel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=paul@vandervlis.nl \
    /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 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).