raidstart problem - weakness or bug
PATCH 1/1 raidstart problem - weakness or bug
Hi
I'v decided to build a raid set for on one of my machines here and while setting I did a simulated fail test so I knew what to expect out of the fail/recovery process.
In the course of this I discover that raidstart (I used debian stable to start with but reproduced and patched on raidtools 1.00-3) won't start and array where the first drive listed in /etc/raidtab has failed - or more accurately whose superblock is not readable.
An afternoons read through the code has led me to suggest this patch as a fix. No doubt the more experienced raid hands will tell me this is wrong for some subtle reason i can't see. ;_)
So what have I got wrong ?
TTFN
Signature · 4 lines
Roger. Home| http://www.sandman.uklinux.net/ Master of Peng Shui. (Ancient oriental art of Penguin Arranging) Work|Independent Systems Consultant | http://www.firstdatabase.co.uk/ So what are the eigenvalues and eigenvectors of 'The Matrix'? --anon
raidlib.c +12 -4
@@ -460,11 +460,19 @@case raidstart: {struct stat s; +int i=0 ; +for ( i=0 ; i<MD_SB_DISKS ; ++i) { + +if (!cfg->device_name[i][0 ]) { + rc++; +break ; + } +stat (cfg->device_name[i], &s); -stat (cfg->device_name[0 ], &s); - - fd =open_or_die (cfg->md_name); -if (do_mdstart (fd, cfg->md_name, s.st_rdev)) rc++; + fd =open_or_die (cfg->md_name); +if ( !do_mdstart (fd, cfg->md_name, s.st_rdev)) +break ; + }break ; }
Quoted 11 lines · On Friday November 14, [email protected] wrote:
Hi
I'v decided to build a raid set for on one of my machines here and while setting I did a simulated fail test so I knew what to expect out of the fail/recovery process.
In the course of this I discover that raidstart (I used debian stable to start with but reproduced and patched on raidtools 1.00-3) won't start and array where the first drive listed in
/etc/raidtabhas failed - or more accurately whose superblock is not readable.
Quoted 6 lines
An afternoons read through the code has led me to suggest this patch as a fix. No doubt the more experienced raid hands will tell me this is wrong for some subtle reason i can't see. ;_)
So what have I got wrong ?
You have tried to fix a program that really is not worth saving. raidstart should be erradicated from the universe. It is more of a problem than a solution. :-)
Apart from the problem you noticed which is fixable, there is the fact that it depends on device numbers being stable and uses the device numbers out of the superblock of one device to find all other devices. This mostly works OK with IDE, but with SCSI, devices can change there number (major/minor) and name quite easily and then raidstart cannot cope at all.
Use mdadm - it has a much better approach.
Debian/stable has the fairly old 0.7.2, which should work but is not the latest by a long way. You can find the latest at
http://www.kernel.org/pub/linux/utils/raid/mdadm/
NeilBrown