1

I've spent a couple of hours on this (and gone through dozens of StackExchange posts) and am still stuck.

I've got a Debian box in a software RAID 1 configuration. The machine currently boots fine.

I'm in the process of replacing the hard drives in my machine. In the process, I noticed that my boot process was actually not mirrored the way I expected. When I tried removing my first hard drive (/dev/sda) the server doesn't boot. It seems I can't boot off of (/dev/sdb) alone.

I've tried a couple of things:

  • sudo grub-install /dev/sdb, sudo update-grub /dev/sdb
  • sudo dpkg-reconfigure grub-pc (note that when I've done this, it gives me the option to install on sda, sdb, and md0. I've checked both sda and sdb and the installation appears to succeed. The installation fails though when I try and check md0.

I'll note too that it seems like GRUB is pointing at my raid array (md0), rather than the drives themselves (i.e. sda or sdb). I imagine that could be the problem since the array won't have started at the time GRUB is loading during the boot? Still, I thought I had seen that GRUB2 (which is what I believe is installed) should be able to handle a RAID array?

I'd love to hear any ideas that folks might have, and THANK YOU so much in advance! If it helps, here's my system configuration:

# taken from grub.cfg
if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod part_msdos
insmod diskfilter
insmod mdraid09
insmod ext2
set root='mduuid/73f4f8fa4b4d9ea4dbaa835b9c9612ac'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='mduuid/73f4f8fa4b4d9ea4dbaa835b9c9612ac'  20fb3f71-3911-4f65-8773-7cf6bf334
e0d
else
  search --no-floppy --fs-uuid --set=root 20fb3f71-3911-4f65-8773-7cf6bf334e0d
fi
    font="/usr/share/grub/unicode.pf2"
fi
~$ sudo blkid
/dev/sda1: UUID="73f4f8fa-4b4d-9ea4-dbaa-835b9c9612ac" TYPE="linux_raid_member"
/dev/sda5: UUID="882c3c60-15c3-d6f8-d399-c9bc0b1041c7" TYPE="linux_raid_member"
/dev/sda6: UUID="6b77ee71-58d7-20c2-e510-ea20661b7451" TYPE="linux_raid_member"
/dev/sda7: UUID="361b574d-18d0-f4a5-3076-c1e8f6240de2" TYPE="linux_raid_member"
/dev/sdb1: UUID="73f4f8fa-4b4d-9ea4-dbaa-835b9c9612ac" TYPE="linux_raid_member"
/dev/sdb5: UUID="882c3c60-15c3-d6f8-d399-c9bc0b1041c7" TYPE="linux_raid_member"
/dev/sdb6: UUID="6b77ee71-58d7-20c2-e510-ea20661b7451" TYPE="linux_raid_member"
/dev/sdb7: UUID="361b574d-18d0-f4a5-3076-c1e8f6240de2" TYPE="linux_raid_member"
/dev/md0: UUID="20fb3f71-3911-4f65-8773-7cf6bf334e0d" TYPE="ext3"
/dev/md1: TYPE="swap"
/dev/md2: UUID="089c64c1-fefc-4cb4-8b9f-f06439f6a757" TYPE="ext3"
/dev/md3: UUID="0865f8c6-95ac-4582-b7c5-9e9d02a34e8e" TYPE="ext3"
~$ lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
fd0       2:0    1     4K  0 disk  
sda       8:0    0 698.7G  0 disk  
├─sda1    8:1    0  18.6G  0 part  
│ └─md0   9:0    0  18.6G  0 raid1 /
├─sda2    8:2    0     1K  0 part  
├─sda5    8:5    0   1.9G  0 part  
│ └─md1   9:1    0   1.9G  0 raid1 [SWAP]
├─sda6    8:6    0 169.4G  0 part  
│ └─md2   9:2    0 169.4G  0 raid1 /home
└─sda7    8:7    0 465.7G  0 part  
  └─md3   9:3    0 465.7G  0 raid1 /time_mac
sdb       8:16   0 931.5G  0 disk  
├─sdb1    8:17   0  18.6G  0 part  
│ └─md0   9:0    0  18.6G  0 raid1 /
├─sdb2    8:18   0     1K  0 part  
├─sdb5    8:21   0   1.9G  0 part  
│ └─md1   9:1    0   1.9G  0 raid1 [SWAP]
├─sdb6    8:22   0 169.4G  0 part  
│ └─md2   9:2    0 169.4G  0 raid1 /home
└─sdb7    8:23   0 465.7G  0 part  
  └─md3   9:3    0 465.7G  0 raid1 /time_mac
sr0      11:0    1  1024M  0 rom 
$ sudo parted -l
Model: ATA SAMSUNG HD753LJ (scsi)
Disk /dev/sda: 750GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  20.0GB  20.0GB  primary   ext3            raid
 2      20.0GB  704GB   684GB   extended
 5      20.0GB  22.0GB  1999MB  logical   linux-swap(v1)  raid
 6      22.0GB  204GB   182GB   logical   ext3            raid
 7      204GB   704GB   500GB   logical   ext3            raid


Model: ATA WDC WD1005FBYZ-0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  20.0GB  20.0GB  primary   ext3            raid
 2      20.0GB  704GB   684GB   extended
 5      20.0GB  22.0GB  1999MB  logical   linux-swap(v1)  raid
 6      22.0GB  204GB   182GB   logical   ext3            raid
 7      204GB   704GB   500GB   logical   ext3            raid
$ sudo grub-probe --target=device /boot/grub
/dev/md0

2 Answers 2

1

A very interesting problem.

You wrote:

my boot process was actually not mirrored the way I expected

The simplest solution I see here is that you will have some third drive, on which you will install GRUB, and which will point to your raid array (md0) (if that is even possible, and if the RAID will be able to somehow start without the second disk, see explanation below). Alternatively you could try shrinking a bit both sda and sdb and get the GRUB partition on either of the available space (again, given that the RAID config would allow you to boot without the second disk), but I guess that is not what you would like, because you would be forced to the same for each new (replacement disk) you would have.


To address this issue that the GRUB should point to:

the drives themselves (i.e. sda or sdb)

As far as I know, there is no logic conditions implemented in GRUB which would handle the clause such as:

if (md0) is not available:
   boot from (sda)

or

if (sda) is not available:
   boot from (sdb)

That is why, unfortunately, with the setup you have at the moment, GRUB has to point to md0 for booting, and you need both drives for the RAID to start first.


I thought I had seen that GRUB2 (which is what I believe is installed) should be able to handle a RAID array

It does, it handles the RAID array if both drives are there, and the array was started properly. In your case (removing one of the drives), the GRUB was loaded, but it points to "not yet started array" (md0), hence the system won't boot.

In other words, once you decide to go with the RAID, you need two (both) drives. You cannot simply switch to just one, with exactly the same GRUB settings.


The only viable (theoretical) solution I see is to have some external partition, and the GRUB, or some kind of a custom low-level service (implementing the logic), running there, on this separate partition, governing all the possible scenarios you would like:

  1. Booting to md0 with both sda and sdb onboard
  2. Booting just to sda
  3. Booting just to sdb

To be honest, I wrote "theoretical", because I am not sure if it is even possible to disregard the RAID part on either of the sda or sdb. Similarly, as you expected, such skipping/ignoring/disregarding the fact that the RAID was configured in the first place, should be handled maybe by the RAID configuration itself, and not by the GRUB (again, maybe). Whether it is the fact, or it should just work the way we would like it to -- I cannot say, someone else would have to comment on that.


To sup up, I regret to say that, but it seems the GRUB, and the RAID, have just not been designed the way you would like it to, in this case, unfortunately. It doesn't mean that such functionality won't ever be implemented, it surely can be. It is just very uncommon to do what you would like.

Normally, as I heard, you just replace the disk, and you go on with the GRUB pointing to md0. You don't expect the system to be able to work with one disk alone. I of course can be wrong, but you asked for ALL opinions, so here's mine. Good luck with your problem. I will be monitoring this question, because I am genuinely curious about the potential solutions.

1

Thank you Mikolaj!

I wanted to follow up and sheepishly share that I figured out the problem! It seems that all I had to do was swap the drive connections so that the drive previously on /dev/sdb was connected where /dev/sda was. At that point, the boot went fine!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .