Thread (11 messages) 11 messages, 5 authors, 2015-03-06

Re: Last working drive in RAID1

From: NeilBrown <hidden>
Date: 2015-03-05 21:52:22

On Thu, 05 Mar 2015 15:00:18 -0500 Phil Turmel [off-list ref] wrote:
On 03/05/2015 10:55 AM, Wols Lists wrote:
quoted
Sorry to butt in, but I'm finding this conversation a bit surreal ...
take everything I say with a pinch of salt. But the really weird bit
was "what does linux do if /dev/sda disappears?"

In the old days, with /dev/hd*, the * had a hard mapping to the
hardware. hda was the ide0 primary, hdd was the ide1 secondary, etc
etc. I think I ran several systems with just hdb and hdd. Not a good
idea, but.

Nowadays, with sd*, the letter is assigned in order of finding the
drive. So if sda is removed, linux moves all the other drives and what
was sdb becomes sda.
On reboot, yes.  Not live.  If /dev/sda has anything using it when
unplugged, it stays there and gives errors.  Existing devices retain
their names, and new devices are added to the end.  Only if all users
are completely unhooked will a kernel name get re-used live.
quoted
Which is why you're advised now to always refer
to drives by their BLKDEV or whatever, as linux provides no guarantees
whatsoever about sd*. The blockdev may only be a symlink to whatever
the sd*n code of the disk is, but it makes sure you get the disk you
want when the sd*n changes under you.
Correct, but once assembled or mounted, the kernel names are locked.
quoted
Equally surreal is the comment about "what does raid1 do with no
working devices?". Surely it will do nothing, if there's no spinning
rust or whatever underneath it? You can't corrupt it if there's
nothing there to corrupt?
It has to stay there to give errors to the upper layers that are still
hooked to it.  When they are administratively "unhooked", aka unmounted
or disassociated with mdadm --remove.

Or, quite possibly, the device is plugged back in, at which point the
device name is there for it (as long as you use the same port, of
course).  In which case the filesystem may very well resume successfully.
I was with you right up to this last point.
When a device is unplugged and then plugged back in, it will always get a new
name.  Detecting "is the same device" is far from fool-proof, particularly as
the device could have been plugged into some other machine and has 'fsck' etc
run.
Once a mounted device is unplugged, that mount is permanently unusable.

NeilBrown

quoted
Sorry again if this is inappropriate, but you're coming over as so
buried in the trees that you can't see the wood.
Sometimes the expanded view is appropriate :-)

Regards,

Phil Turmel
  

Attachments

  • (unnamed) [application/pgp-signature] 811 bytes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help