[opensuse] check device existence on boot
Hello: My dmraid array occasionally runs only with one hard disk, since one of the disks is not recognized at boot. For this reason I would like the OS to check the existence of both of the hard disks during bootup and if it can't find one of them it should not finsih booting but restart the computer, before mounting the RAID array. I thought that a small script could go somewhere in /etc/init.d but I don't know where and how to name it or activate it. How could I do it? Thanks, Istvan PS: A more detailed explanation for those who are interested: I have a system with BIOS RAID1. Two indentical SATA hard disk are connected to a Silicon Image 3114 (SiI 3114) PCI card RAID controller. This works well with linux dmraid, but: Occasionally (for an unknown reason to me) one of the hard disk is not recognized by the RAID card when the computer is turned on, and opensuse boots up as if the disk was missing. This means that only one of the disks operates during the session as a complete RAID device. With different terms, the OS even does not know that there is a problem with the RAID array, however the array consist of only one disk instead of two. This leads to discrepancy between the disks content and I have to rebuild the array after such an event. On a long term I want to replace the RAID array to either sofware RAID or change the RAID card or motherbord. But in the meantime I would like to fix this issue. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Am Mittwoch, 2. Mai 2012, 13:29:03 schrieb Istvan Gabor:
My dmraid array occasionally runs only with one hard disk, since one of the disks is not recognized at boot. For this reason I would like the OS to check the existence of both of the hard disks during bootup and if it can't find one of them it should not finsih booting but restart the computer, before mounting the RAID array. I thought that a small script could go somewhere in /etc/init.d but I don't know where and how to name it or activate it.
How could I do it?
Do you know how to check whether the dmraid array is okay? Do you already know how to parse the output of, e.g., "dmraid -s" or "dmraid -b"? Or is it as simple as just checking for the existence of, e.g., "/dev/sda"? Since I do not run a dmraid, I cannot give you any (well) tested advice. I do not even know whether it is a good idea to automatically reboot from a an init script. You have been warned! However, I see /etc/init.d/boot.dmraid that seems to setup your dmraid. You could add the appropriate check and just execute "reboot" if the check fails. If this works, you could write your own boot.dmraidcheck script based on boot.dmraid that runs after it, e.g., by specifying "Required-Start: boot.dmraid". Gruß Jan -- Defeat never comes to any man until he admits it. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
2012. május 5. 17:51 napon Jan Ritzerfeld <suse@mailinglists.jan.ritzerfeld.org> írta:
Am Mittwoch, 2. Mai 2012, 13:29:03 schrieb Istvan Gabor:
My dmraid array occasionally runs only with one hard disk, since one of the disks is not recognized at boot. For this reason I would like the OS to check the existence of both of the hard disks during bootup and if it can't find one of them it should not finsih booting but restart the computer, before mounting the RAID array. I thought that a small script could go somewhere in /etc/init.d but I don't know where and how to name it or activate it.
How could I do it?
Do you know how to check whether the dmraid array is okay? Do you already know how to parse the output of, e.g., "dmraid -s" or "dmraid -b"? Or is it as simple as just checking for the existence of, e.g., "/dev/sda"?
Since I do not run a dmraid, I cannot give you any (well) tested advice. I do not even know whether it is a good idea to automatically reboot from a an init script. You have been warned!
However, I see /etc/init.d/boot.dmraid that seems to setup your dmraid. You could add the appropriate check and just execute "reboot" if the check fails. If this works, you could write your own boot.dmraidcheck script based on boot.dmraid that runs after it, e.g., by specifying "Required-Start: boot.dmraid".
Hello: Thank you for your advice. I know dmraid command (dmraid -s, -r, -b). I think you might be right that it isn't a good idea to reboot from a running boot process. It would be better to check the devices' availability before the boot starts, e.g. in the grub state. I look after whether it is possible. Thanks again, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2012-05-07 11:15, Istvan Gabor wrote:
I think you might be right that it isn't a good idea to reboot from a running boot process.
You can create a cron job on @reboot, that reboots the system if your raid is not present. :-? - -- Cheers / Saludos, Carlos E. R. (from 11.4 x86_64 "Celadon" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+nwM0ACgkQIvFNjefEBxr++QCgwBwAR0ahRfm1a6W2pkT4pIhU fRIAnjTcYpPqcf5s1xyX1EoEhPyBBbGY =RKX+ -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Istvan Gabor wrote:
2012. május 5. 17:51 napon Jan Ritzerfeld <suse@mailinglists.jan.ritzerfeld.org> írta:
Am Mittwoch, 2. Mai 2012, 13:29:03 schrieb Istvan Gabor:
My dmraid array occasionally runs only with one hard disk, since one of the disks is not recognized at boot. For this reason I would like the OS to check the existence of both of the hard disks during bootup and if it can't find one of them it should not finsih booting but restart the computer, before mounting the RAID array. I thought that a small script could go somewhere in /etc/init.d but I don't know where and how to name it or activate it.
How could I do it? [...] However, I see /etc/init.d/boot.dmraid that seems to setup your dmraid. [...]
I know dmraid command (dmraid -s, -r, -b). I think you might be right that it isn't a good idea to reboot from a running boot process. It would be better to check the devices' availability before the boot starts, e.g. in the grub state. I look after whether it is possible.
This mail has been some time ago, so I don't know if you made advances... /etc/init.d (e.g., sysvinit or systemd) is too late, at this time dmraid array is already assembled. You have to do the check in initrd. And there you can reboot without problems, as disk state isn't changed too much. To change your initrd, you have to use mkinitrd. man 8 mkinitrd and man 5 mkinitrd should get you started. A VM instance to try this out, for quick booting and snapshots if something went wrong, is probably the best development environment for such a feature. Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod, Roedermark, Germany Email: jschrod@acm.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (4)
-
Carlos E. R.
-
Istvan Gabor
-
Jan Ritzerfeld
-
Joachim Schrod