1. Subscriptions
  2. Services
  3. Hardware
  4. Support

ClearFoundation

Forums
Welcome, Guest
Second drive in software RAID1 array not bootable?
(1 viewing) 1 Guest
Go to bottomPage: 1
TOPIC: Second drive in software RAID1 array not bootable?
#14967
Second drive in software RAID1 array not bootable? 1 Month, 1 Week ago  
Hello,

First post here, I am not new to linux but this is my first time setting up a software RAID and I have ran into a little problem. I have two disks setup as RAID1, this is going to be a production machine so I wanted to make sure I could boot the system if one of the drives fails. If I remove the second drive which is /dev/sdb and just boot with the first drive /dev/sda it boots without issue. If I remove the first drive and try to boot with just the second drive in I get a grub error that simply says "Grub hard disk error" I tried psychically moving the second drive to the first SATA port but I still get the same error.

I created the RAID and partitions using this guide:

www.clearcenter.com/support/documentatio..._partitions_and_raid

There is a section in here that talks about his problem, it says:

If the secondary disk fails (/dev/sdc), then the system will still be bootable. If the primary disk fails (/dev/sda), then your system will not boot. In order to make the secondary disk bootable as well, run the following command:

grub-install /dev/sdc


My second disk is /dev/sdb so I ran "grub-install /dev/sdb" but I still have the same issue. Here is the output of mdadm:

[root@clearos grub]# mdadm --detail /dev/md0
/dev/md0:
Version : 0.90
Creation Time : Wed Jul 21 05:07:21 2010
Raid Level : raid1
Array Size : 152512 (148.96 MiB 156.17 MB)
Used Dev Size : 152512 (148.96 MiB 156.17 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Wed Jul 28 16:10:44 2010
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

UUID : 0999ec57:bb019b3a:9483853a:ead3eda6
Events : 0.42

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1

This is what I get when I run "grub-install /dev/sdb"

[root@clearos grub]# grub-install /dev/sdb
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

# this device map was generated by anaconda
(hd0) /dev/sda
(hd1) /dev/sdb

Any help would be greatly appreciated!

-Chris
Chris
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#14975
Re:Second drive in software RAID1 array not bootable? 1 Month, 1 Week ago  
Hmm.. my understanding here is a little different... and there is a defference in the way IDE and SATA gets their drive letters...

With IDE

1st Controller Primary hda
1st Controller Secondary hdb
2nd Controller Primary hdc
2nd Contoller Secondary hdd

This hold true regardless if a drive is installed or missing...
eg if for the 1st controller you have no Primary drive installed, but do have one on the Secondary, the secondary disk is still hdb - and hda will be missing...

With SATA things are different... Letters are assigned on a first found basis so for example with a 4 port SATA controller with all ports occupied we have this

Port 1 - disk installed sda
Port 2 - disk installed sdb
Port 3 - disk installed sdc
Port 4 - disk installed sdd

now for the difference...
Port 1 - no disk
Port 2 - disk installed sda
Port 3 - disk installed sdb
Port 4 - disk installed sdc

Now consider your situation...

Both drives found and working, normal operation...
Port 1 SATA - sda
Port 2 SATA - sdb

Disk on Port1 broken so cannot be found, or missing
Port 1 SATA - nothing
Port 2 SATA - sda

Disk on Port 1 not bootable, but found - want to boot from disk on Port 2
Port 1 SATA - sda
Port 2 SATA - sdb

So to me to my understanding, the best thing with SATA is to setup
Grub so both disks are setup as if they were sda. Then if the inital sda breaks.
remove it, move the original sdb to the port that was occupied by the original sda
and boot as the new sda. Install the replacement disk as sdb, sync and use grub
to setup as a sda to be bootable. Then if the disk that was sdb and now sda breaks
the process can be repeated...
Tony Ellis
Platinum Boarder
Posts: 560
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#14994
Re:Second drive in software RAID1 array not bootable? 1 Month, 1 Week ago  
Assuming grub has been installed to both drives which is required, I would also duplicate the stanza in /etc/grub.conf so that it has two boot lines, one for each drive.

In theory something similar too (note the change in root():-
Code:

title LinuxDrive0 (2.6.18-164.6.1.v5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-164.6.1.v5 ro root=/dev/md2 vga=0x317 
        initrd /initrd-2.6.18-164.6.1.v5.img
title LinuxDrive1 (2.6.18-164.6.1.v5)
        root (hd1,0)
        kernel /vmlinuz-2.6.18-164.6.1.v5 ro root=/dev/md2 vga=0x317 
        initrd /initrd-2.6.18-164.6.1.v5.img



Alternatively you would have to physically reconnect the drive in the location of the first one as Tony posted above
Tim Burgess
Moderator
Posts: 2001
graph
User Online Now Click here to see the profile of this user
Last Edit: 2010/07/29 04:16 By timb80.
The administrator has disabled public write access.
Nothing is fool proof to a talented fool
http://starlane.gotdns.org
RPM FTP Mirror
 
#16238
Re:Second drive in software RAID1 array not bootable? 2 Weeks, 3 Days ago  
Would it be possible to get some help on grub-install. I tried, but here is what I get:

/boot is mounted on /dev/md2

Code:


[root@system ~]# mdadm --detail /dev/md2
/dev/md2:
        Version : 0.90
  Creation Time : Mon Aug 23 16:10:57 2010
     Raid Level : raid1
     Array Size : 104320 (101.89 MiB 106.82 MB)
  Used Dev Size : 104320 (101.89 MiB 106.82 MB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 2
    Persistence : Superblock is persistent

    Update Time : Tue Aug 24 00:04:08 2010
          State : active
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : 2595a89e:989bedbf:ef6f227a:cd070023
         Events : 0.11

    Number   Major   Minor   RaidDevice State
       0      22       65        0      active sync   /dev/hdd1
       1       3        1        1      active sync   /dev/hda1
[root@system ~]# grub-install /dev/hdd1
/dev/hdd1 does not have any corresponding BIOS drive.
[root@system ~]# grub-install /dev/hda1
/dev/hdd1 does not have any corresponding BIOS drive.
[root@system ~]# grub-install /dev/hda
/dev/hdd1 does not have any corresponding BIOS drive.
[root@system ~]# grub-install /dev/hdd
/dev/hdd does not have any corresponding BIOS drive.
[root@system ~]#



not sure where to go from here.

Also, when updating grub.conf should the line
root (hd#,0) <-- where # =3 because it is /dev/hdd?

ie. hda=0, hdb=1,hdc=2, hdd=3 ?

TIA
Michael Sporer
Fresh Boarder
Posts: 14
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2010/08/24 03:34 By pasta514.
The administrator has disabled public write access.
 
#16255
Re:Second drive in software RAID1 array not bootable? 2 Weeks, 2 Days ago  
Yes to the last part for hd3, also this thread might solve your BIOS drive issue
www.linuxquestions.org/questions/linux-s...-drive-error-401582/

You can also install grub maually to the other drive e.g. (replace hd3 with what ever drive you want grub on)
Code:

grub
root(hd3,0)
setup(hd3)
quit

Tim Burgess
Moderator
Posts: 2001
graph
User Online Now Click here to see the profile of this user
The administrator has disabled public write access.
Nothing is fool proof to a talented fool
http://starlane.gotdns.org
RPM FTP Mirror
 
#16279
Re:Second drive in software RAID1 array not bootable? 2 Weeks, 2 Days ago  
Here is what worked (sort of) for me.
1) clean install (again!! )
2) edit /boot/grub/device.map to include the 2nd grub-install target
--> do not use grub-install --recheck it assigns wrong numbers to hdd!
3) edit /boot/grub/grub.conf to add the second boot image
4) execute grub-install /dev/hdd
5) execute grub-install /dev/hda <-- should not be necessary

My system: 2x 160GB drives connected to primary master (hda) and secondary slave (hdd) on the motherboard
2x 200GB drives on a PCI IDE expansion card. (hde and hdg)

I can now boot from either disk in the array and once booted load the kernel from either /boot partition.

Code:


[root@system ~]# cd /boot/grub/
[root@system grub]# more device.map
(hd0)   /dev/hda
(hd3)   /dev/hdd
(hd4)   /dev/hde
(hd6)   /dev/hdg

[root@system grub]# more grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/md1
#          initrd /initrd-version.img
#boot=/dev/md2
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Linux0 (2.6.18-194.8.1.v5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-194.8.1.v5 ro root=/dev/md1
        initrd /initrd-2.6.18-194.8.1.v5.img
title Linux1 (2.6.18-194.8.1.v5)
        root (hd3,0)
        kernel /vmlinuz-2.6.18-194.8.1.v5 ro root=/dev/md1
        initrd /initrd-2.6.18-194.8.1.v5.img

Michael Sporer
Fresh Boarder
Posts: 14
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2010/08/25 15:27 By pasta514.
The administrator has disabled public write access.
 
#16298
Re:Second drive in software RAID1 array not bootable? 2 Weeks, 1 Day ago  
Hi Chris,

I believe the solution to your problem lies in your ability to copy the MBR (Master Boot Record) from HD1 to HD2...by default, the MBR is only created on the first disk in a RAID1 array.

This gets kind of technical and it was quite some time ago that I looked into this...I believe the MBR resides on the first 512 bytes of your physical disk.

The command would be something like:
Code:

dd if=/dev/hda of=/dev/hdd bs=512 count=1



BTW - if you're just setting this up, and you have some time, you may want to try to enable some code in the RaidSoftware class that was intentionally disabled because it wasn't tested enough.

I wouldn't recommend doing this on a system that's already in production with data files on it...but if you're able to one more re-install or have yet to begin any specific configuration, here's the edit:

File: /var/webconfig/api/RaidSoftware.class.php

Line: 179-180

Change:
Code:


//if ((!isset($this->config['copy_mbr']) || $this->config['copy_mbr'] == 0) && $raid_level == 1 && $clean_array) {
                if (false) {



to:

Code:


if ((!isset($this->config['copy_mbr']) || $this->config['copy_mbr'] == 0) && $raid_level == 1 && $clean_array) {



Note the removal of the double forward slash to enable the line, and removal of the conditional false at the start of the if statement.

In theory (I think it worked for me during testing...just chicken to put it out to the world with such a small sample/testing) this will automatically copy your MBR when you first visit the Software RAID page in webconfig.

So, your steps would be:

1. Install ClearOS, selecting "Do your own partitioning" and creating software RAID1 array
2. Go through webconfig's initial wizard
3. Visit Software RAID page in webconfig...this should trigger the MBR copy...you can confirm by doing:

Code:

cat /etc/system/raid.conf



If you see a directive named "copy_mbr = 1" then it should have been successful...if not, the flag will either be set to 0 or non-existant.
4. Shutdown, remove drive 2 and boot...should be OK
5. Connect drive 2 and allow to sync
6. Shutdown, remove drive 1 and connect drive 2 and boot...should now boot OK (whereas, with that snippet of code disabled, you would not boot because the MBR was missing on disk2).

One final thing I just noticed is that webconfig does not have the 'dd' command in the suders file.

You'll need to modify /etc/sudoers using visudo or 'nano /etc/sudoers' and add '/bin/dd' to the list of "CC" executables. I.e., you'll see something like:

Code:


Cmnd_Alias CC = /usr/bin/jnettop, /sbin/reboot, /sbin/halt, /usr/sbin/awstatsreports, /var/webconfig/scripts/archive_resend.php, /var/webconfig/scripts/archive.php, /usr/bin/archive_bootstrap, /usr/bin/zgrep, /usr/bin/snortsam-state, /var/webconfig/scripts/userimport.php, /usr/sbin/postsuper, /usr/sbin/postmap, /usr/sbin/postfix, /usr/sbin/postconf, /usr/sbin/mailqfmt.pl, /usr/bin/newaliases, /usr/sbin/usersetup, /usr/sbin/syncmailboxes, /usr/sbin/syncusers, /usr/sbin/groupmod, /usr/sbin/groupdel, /usr/sbin/groupadd, /usr/sbin/useradd, /usr/bin/passwd, /sbin/iptables, /usr/sbin/tracklist, /usr/sbin/hping2, /usr/sbin/dhcptest, /usr/sbin/tw_cli, /usr/sbin/mpt-status, /sbin/sfdisk, /sbin/mdadm, /var/webconfig/scripts/avscan.php, /usr/bin/yum, /var/webconfig/scripts/rbs-schedule.php, /var/webconfig/scripts/rbs-client.php, /usr/bin/killall, /usr/bin/freshclam, /usr/bin/mkhost.sh, /bin/tar, /sbin/iwconfig, /sbin/ifup, /sbin/ifdown, /sbin/ifconfig, /sbin/ethtool, /bin/netstat, /bin/hostname, /bin/umount, /bin/mount, /usr/sbin/updateflexperms, /usr/sbin/proftpd, /usr/sbin/httpd, /usr/sbin/authconfig, /usr/sbin/ldapsync, /usr/sbin/kolabconf, /usr/sbin/slapcat, /usr/sbin/slapadd, /usr/sbin/slappasswd, /usr/sbin/add-samba-directories, /usr/bin/smbpasswd, /usr/bin/pdbedit, /usr/bin/net, /usr/sbin/ntpdate, /sbin/hwclock, /usr/bin/openssl, /usr/sbin/userdel, /usr/sbin/app-rename, /usr/sbin/app-realpath, /usr/sbin/app-passwd, /usr/bin/du, /usr/bin/chfn, /usr/bin/head, /usr/bin/find, /usr/bin/file, /usr/bin/api, /sbin/service, /sbin/shutdown, /sbin/chkconfig, /bin/touch, /bin/rm, /bin/mv, /bin/mkdir, /bin/ls, /bin/kill, /bin/cp, /bin/chown, /bin/chmod, /bin/cat



You'll need to add ", /bin/dd" to the end of that list.

That's it! Any takers?

Ben
Ben Chambers
ClearFoundation
Posts: 107
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2010/08/25 09:40 By bchambers.
The administrator has disabled public write access.
 
Go to topPage: 1
  get the latest posts directly to your desktop