Grub with IDE and SATA Drives
From MEPIS Documentation Wiki
The GRUB loading problem with IDE and SATA drive mixtures
- The following is taken from a post on MEPIS Community forum. The basic problem is that the new Linux kernel in use for the MEPIS 7 Beta releases moves all drives to the SDA naming schema. This move is supposed to help address naming compatibility and register allocation, as well as cleaning up the code that manages hard-drive access.
- However, the new kernel code means that what the kernel presents for the drive layout... is not what the BIOS and GRUB are reporting for the drive layout.
Standard Bios Naming Schema
- The BIOS is the first part of the computer that turns on. The BIOS determines the boot order of the drives. In a standard PC BIOS the behavior is to list all of the IDE drives first, then list the SATA drives. IDE drives were generally represented with the naming schema hd*, probably standing for Hard Drive. Serial ATA Drives, or SATA, were giving the naming schema sd*, as stated by Warren, standing for SCSI drive.
- A fully loaded 4-channel IDE and 4-channel SATA drive setup, the BIOS typically posts this order.
- hda / hdb / hdc / hdd / sda / sdb / sdc / sdd
MEPIS 3.x and 6.x General Rules
- Thus in MEPIS 3.x and 6.x series these general rules were written for those attempting to dual boot Windows and MEPIS without having to directly edit the GRUB Menu.
- If you are using a system comprised entirely of IDE drives, then Windows would need to be installed on the first drive.
- hda Windows / hdb MEPIS
- If you are using a system comprised entirely of SATA drives, then Windows would need to be installed on the first drive.
- sda Windows / sdb MEPIS
- If you are using a system with mixed IDE and SATA drives, then Windows would need to be installed on the first IDE drive.
- hda Windows / sda MEPIS
MEPIS 7 Beta Series
- In MEPIS 7 Series the kernel places the IDE drives, the former hd* entries after the SATA drives, the sd* entries. The hd* naming schema is then completely removed. There are some versions of Linux using the 2.6.22 or 2.6.23 kernel that have patches in place to maintain the hd* naming schema. MEPIS 7 Beta series is not among them.
- With a fully loaded 4-channel IDE and 4-channel SATA drive setup the MEPIS 7 Series is reporting the following drive layout.
- sda / sdb / sdc / sdd / hda - sde / hdb - sdf / hdc - sdg / hdd - sdh
- The SATA drives are being reversed and are being placed in front of the IDE drives.
- The result is that in systems with both IDE and SATA drives, the BIOS presents the IDE drives first where the kernel presents the IDE drives last. So there is a critical issue in mixed drive systems where one of the drives may not be recognized and where Grub will experience issues trying to boot to a specific drive.
- In single drive type systems where only one type, SATA or IDE, drives are listed, there isn't a noticeable problem. There also are hardware adapters to allow older IDE drives to work on the SATA interface which allows for some hardware workarounds.
Desired Layout and what is being done to fix this
- The desired behavior would be have this order
- hda - sda / hdb - sdb / hdc - sdc / hdd - sdd / sde / sdf / sdg / sdh
- Here the IDE drives have first preference for the boot order and while their naming convention still changes, the actual boot order hasn't changed. Warren, lead developer for MEPIS, is aware of this issue and is reportedly working on an automatic fix. Other software suggestions are being accepted, and as much as we hate to admit it, we are also looking for a more permanent fix from either GRUB developers or Kernel Developers before MEPIS 7 goes final. We think this is a rather large Brown Bag mistake and we really don't want MEPIS users to suffer from it.
- Okay, we have a comment from Warren over this. Just trying to keep everybody in some sort of loop over what's going on.
- Some comments about the explanation:
- The BIOS drive order will usually depend on whether the mobo considers SATA or IDE to by the primary drives. In other words, newer mobos are more likely to have sdX first.
- Actually sd means SCSI Drive.
- The kernel does not, per se, determine the relative order of hda and sda drives as used by GRUB. The kernel just determines which device name is associated with which drive.
- Before booting, GRUB uses the "natural" order of the drives as presented by the BIOS.
- And after loading the kernel, GRUB applies what appears to be a complex algorithm that takes into account which drive is the BIOS designated boot drive, the actual boot drive for the OS, and the natural order of the drives. During GRUB install this algorithm is used to determine the appropriate drive order and creates a devices.map, unless a devices.map already exists.
- Theoretically if the devices.map were generated properly either manually or by a code fragment, before calling GRUB install, then the menu.lst would be created correctly. But I haven't had time to verify this.
- This is a well known problem with GRUB but it was not a major issue until newer mobos came out that mixed IDE and SATA. AFAIK, every distro that uses GRUB has this problem, except ubuntu which is trying to use UUIDs to identify the drives, but there are reports that this also does not work reliably.