[Gllug] Replacement SATA disk naming

Alain Williams addw at phcomp.co.uk
Thu Mar 5 15:07:09 UTC 2009


On Thu, Mar 05, 2009 at 02:30:39PM +0000, Bruce Richardson wrote:
> On Thu, Mar 05, 2009 at 01:57:16PM +0000, Alain wrote:
> > On Thu, Mar 05, 2009 at 01:07:07PM +0000, Bruce Richardson wrote:
> > 
> > > > How do I get the kernel to rename /dev/sdc as /dev/sda ?
> > > 
> > > Don't.  Use udev to create unique names (or symlinks) in /dev/ for your
> > > disks and their partitions and then tell your raid software about that. 
> > 
> > Hmmmm: pity the installation s/ware (anaconda) didn't do that.
> > /dev/sda is referenced is all sorts of places, eg: nagios & smart monitoring.
> > I'd like to try this one something other than a live customer machine -- first time round.
> 
> If you create a unique symlink rather than a unique name, you can cope
> for the moment by making sda a symlink to sdc and then removing the
> symlink before a reboot.  Alternatively, make a rule that creates a
> unique name for the drive AND the sdc symlink.   
> 
> It is a good idea to investigate udev and unique names whereever you are
> working with hot-pluggable devices.  Saves so much pain in the long run.
> So many Mythtv newbies, for example, get everything working at last,
> disconnect the usb kb, reboot and wonder why the ir device is no longer
> working.

Remember: this is mirrors of the main system disk. Not intended to plug out/in,
but did so because of failure ... that I am trying to recover from completely
w/out reboot -- on reboot all would work nicely.

I created links sda* -> sdc* .... but the mirroring stuff looks through that
to the device numbers:
'mdadm --query --detail /dev/md0' reports:

       0       8       33        0      active sync   /dev/sdc1
       1       8       17        1      active sync   /dev/sdb1

       2       8        1        -      faulty spare

	# l sd?1
	lrwxrwxrwx 1 root root     4 Mar  5 14:46 sda1 -> sdc1
	brw-r----- 1 root disk 8, 17 Feb 19 19:14 sdb1
	brw-r----- 1 root disk 8, 33 Mar  5 14:48 sdc1

So I suspect that when the machine is rebooted and what is currently sdc is given
its ''proper'' name sda  then the mirror code will be looking for maj,min of 8,1
not 8,17 -- so the system won't work.

I still *really* want the kernel to forget old /dev/sda completely so that the replaced
disk can become /dev/sda. This is where the poor documentation of the kernel interface
makes life hard. Looking at the kernel sources I think that I can echo stuff into
	/sys/bus/scsi/devices/0:0:0:0/state
things like: running cance deleted offline
however the effect is not described (where I have yet stumbled across).
Or there is:
	/sys/bus/scsi/devices/0:0:0:0/delete
but who knows what that does!

> > 	udevinfo -q all -n sdc
> Older version, perhaps?

What is current on CentOS 5: udev-095-14.16.el5

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
Past chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h>
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list