* Wrong device name after hot-swap
@ 2016-01-22 21:55 Paul van der Vlis
2016-01-22 22:27 ` Phil Turmel
2016-01-23 14:45 ` Wols Lists
0 siblings, 2 replies; 5+ messages in thread
From: Paul van der Vlis @ 2016-01-22 21:55 UTC (permalink / raw)
To: linux-raid
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?
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?
With regards,
Paul van der Vlis.
--
Paul van der Vlis Linux systeembeheer Groningen
https://www.vandervlis.nl/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Wrong device name after hot-swap
2016-01-22 21:55 Wrong device name after hot-swap Paul van der Vlis
@ 2016-01-22 22:27 ` Phil Turmel
2016-01-22 23:15 ` Paul van der Vlis
2016-01-23 14:45 ` Wols Lists
1 sibling, 1 reply; 5+ messages in thread
From: Phil Turmel @ 2016-01-22 22:27 UTC (permalink / raw)
To: Paul van der Vlis, linux-raid
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Wrong device name after hot-swap
2016-01-22 22:27 ` Phil Turmel
@ 2016-01-22 23:15 ` Paul van der Vlis
2016-01-23 0:51 ` Phil Turmel
0 siblings, 1 reply; 5+ messages in thread
From: Paul van der Vlis @ 2016-01-22 23:15 UTC (permalink / raw)
To: linux-raid
Op 22-01-16 om 23:27 schreef Phil Turmel:
> 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.
Correct, I see that with USB-sticks.
> 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.
I have that. I am using an Intel chipset:
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset
Family SATA AHCI Controller (rev 05)
>> 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.
So I can do it as described above?
> In general, you should not rely on device names in your system
> configuration. UUIDs and filesystem labels were implemented
> specifically to avoid this problem.
So far I know I cannot configure anywhere a disk UUID or a filesytem
label to a MD-device.
It feels wrong when I add /dev/sdc1 to the raid, when the name is
normally /dev/sdb1. But maybe it's no problem, because the device name
is not impartant while booting from an MD-device.
With regards,
Paul van der VLis.
--
Paul van der Vlis Linux systeembeheer Groningen
https://www.vandervlis.nl/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Wrong device name after hot-swap
2016-01-22 23:15 ` Paul van der Vlis
@ 2016-01-23 0:51 ` Phil Turmel
0 siblings, 0 replies; 5+ messages in thread
From: Phil Turmel @ 2016-01-23 0:51 UTC (permalink / raw)
To: Paul van der Vlis, linux-raid
On 01/22/2016 06:15 PM, Paul van der Vlis wrote:
> Op 22-01-16 om 23:27 schreef Phil Turmel:
>> 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.
>
> So I can do it as described above?
Yes. Though I won't comment on grub part. (I've stopped using it and
am no long current.)
>> In general, you should not rely on device names in your system
>> configuration. UUIDs and filesystem labels were implemented
>> specifically to avoid this problem.
>
> So far I know I cannot configure anywhere a disk UUID or a filesytem
> label to a MD-device.
Modern udev creates /dev/disk/by-id/ and similar symlinks, but its not
important for md.
> It feels wrong when I add /dev/sdc1 to the raid, when the name is
> normally /dev/sdb1. But maybe it's no problem, because the device name
> is not impartant while booting from an MD-device.
It's not a problem. Unless you have specific member device names in
mdadm.conf. (Don't do that.)
Phil
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Wrong device name after hot-swap
2016-01-22 21:55 Wrong device name after hot-swap Paul van der Vlis
2016-01-22 22:27 ` Phil Turmel
@ 2016-01-23 14:45 ` Wols Lists
1 sibling, 0 replies; 5+ messages in thread
From: Wols Lists @ 2016-01-23 14:45 UTC (permalink / raw)
To: Paul van der Vlis, linux-raid
On 22/01/16 21:55, 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.
Have you only got two slots?
>
> 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!
Sounds like you're pulling a drive then replacing it. Can't you replace
it then pull?
That'll mean that when the array is at its most vulnerable, ie it's
rebuilding, you'll have three drives on line not one.
How new is your mdadm? You'll need one that supports the "--replace" syntax.
Cheers,
Wol
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-01-23 14:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-22 21:55 Wrong device name after hot-swap Paul van der Vlis
2016-01-22 22:27 ` Phil Turmel
2016-01-22 23:15 ` Paul van der Vlis
2016-01-23 0:51 ` Phil Turmel
2016-01-23 14:45 ` Wols Lists
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).