# [SOLVED] hd1 can't be found by grub or kernel

## spacelike

I installed a second harddrive on my system, and I do have a line:

(hd1)    /dev/sdb

in my /boot/grub/device.map

However, grub can't find it. I've even tried checking with:

grub> geometry (hd1)

Error 21: Selected disk does not exist

Also, when I boot into my system on (hd0) I have no /dev/sdb, so the kernel on my (hd0) system can't see my other hard drive either.

However, when I am on the installation CD I can see both /dev/sda and /dev/sdb so both HDD's are connected correctly.

Could it possibly be that by the time GRUB starts up my system has put (hd1) to sleep somehow, whereas if I run it from install CD this doesn't happen? I can't think of any other explanation..Last edited by spacelike on Thu Aug 30, 2012 1:12 pm; edited 1 time in total

----------

## DONAHUE

boot cd, run lspci -k -- post an lspci 

boot installed linux, run lspci -k

compare the outputs, any differences in devices or drivers?

any secrets like sda is sata, sdb is usb? usb 1,2,3? sata 1,2,3? hard drive? ssd? bios? mbr? uefi? 

boot to bios, does bios see the drive as a boot option? is smart enabled

have you partitioned sdb, installed file system on a partition on sdb, mounted a partition on sdb?

motherboard make and model?

disks make and model?

----------

## spacelike

(hd0) has gentoo installed, (hd1) has windows 7 installed, they are both SATA 500GB internal hard drives. The windows HD is installed normally with a windows disk nothing else, fdisk (from the installCD) reveals that it has 2 partitions sdb1(bootable) and sdb2. The Gentoo HD has partitions /boot (sda1), swap (sda2), and root (sda3) and uses GRUB, grub.conf has an option which should allow me to boot into (hd1) holding windows.

I CAN boot the windows HD if I physically switch the cables of the two HD's so that the windows HD appears first to my motherboard. So basically whichever one is first can boot. I want my gentoo disk first (hd0) and windows second (hd1) so that I can use GRUB to choose, but GRUB can't find anything other than (hd0) for some reason. (I have verified this with grub> geometry as well as tab completion, it only sees (hd0))

Since this is an issue already at the GRUB level I don't think it has anything to do with my kernel, I was only bringing it up to prove that the (hd1) is in fact connected properly to my computer because I can see it (and mount+read files) from the gentoo installCD.

Let me know if this makes sense, because my guess is that both HD's turn on when they receive power, but as soon as my system decides to look at the MBR on the first harddrive it powers the second one off, which would explain why the install CD can still see both because they would remain on. (is that plausible?)

My motherboard is Asus P6T

My (hd0) HD with gentoo on it is: Western Digital Caviar Blue WD5000AAKX 500GB 7200 RPM 16MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive -Bare Drive - OEM

My (hd1) HD with windows on it is pretty much the same thing. I can dig up the exact details if you need it, but it's also 500B, 3.5" Internal SATA.

I can see both HD's in my BIOS, but I'm not sure if it knows they are both bootable. If I try to change boot order in my BIOS I only shows 1 HD (whichever is plugged into the first slot on the motherboard).

lspci -k from CD chroot environment:

https://gist.github.com/3501676

lspci -k from installed system:

http://bpaste.net/show/42537/

There is really only one difference between them which is that on my system it uses driver i7core_edac. The other differences are entirely due to chroot using them as modules, and my kernel compiling them in. They are listed below anyway but are in my kernel too:

```
   Kernel modules: uhci-hcd

   Kernel modules: ehci-hcd

   Kernel modules: snd-hda-intel

   Kernel modules: ahci

   Kernel modules: ata_generic, pata_acpi, ata_piix

   Kernel modules: ata_generic, pata_acpi, pata_jmicron
```

----------

## DONAHUE

win 7 disc likely will be formatted gpt which is unreadable by legacy grub, unreadable by a kernel without gpt support builtin

Use grub2 -- http://dev.gentoo.org/~scarabeus/grub-2-guide.xml -- http://en.gentoo-wiki.com/wiki/Grub2#Microsoft_Windows_Entry

From the handbook for kernel config:

File systems --->

(Select one or more of the following options as needed by your system)

  <*> Second extended fs support

  <*> Ext3 journalling file system support

  <*> The Extended 4 (ext4) filesystem

  <*> Reiserfs support

  <*> JFS filesystem support

  <*> XFS filesystem support

  ...

  Pseudo Filesystems --->

    [*] /proc file system support

    [*] Virtual memory file system support (former shm fs)

(Enable GPT partition label support if you used that previously)

  Partition Types --->

    [*] Advanced partition selection

      ...

      [*] EFI GUID Partition support

----------

## spacelike

I did your suggestions.

Gentoo still boots fine with grub2, and I added the 40custom entry for windows and remade the config file

when I try to select the windows option to boot with I get the following error:

error: hd1 cannot get C/H/S values

sorry, I don't know what other information to provide other than the fact I spent the last few hours searching about this error as well as my motherboards BIOS and I'm starting to think my BIOS could be the cause, this doesn't make any sense to me.

----------

## DONAHUE

```
emerge -av os-prober
```

comment out the 40custom entry for windows

run 

```
os-prober

grub2-mkconfig -o /boot/grub2/grub.cfg
```

----------

## spacelike

Sorry I skipped that part because I didn't think it would work since I couldn't even see /dev/sdb

But I just tried it and upon running os-prober I get:

  No volume groups found

and just to verify since I removed the windows entry in 40custom when I get to the grub prompt there is no option for anything other than my gentoo HD.

----------

## DONAHUE

```
emerge wgetpaste

mount /boot

ls -l /boot | wgetpaste

ls -l /boot/grub2 | wgetpaste

wgetpaste /boot/grub2/grub.cfg

zcat /proc/config.gz | wgetpaste
```

 post the url's returned

----------

## spacelike

ls -l /boot | wgetpaste

http://bpaste.net/show/42564/

ls -l /boot/grub2 | wgetpaste 

http://bpaste.net/show/42565/

wgetpaste /boot/grub2/grub.cfg 

http://bpaste.net/show/42566/

zcat /proc/config.gz | wgetpaste

http://bpaste.net/show/42567/

----------

## DONAHUE

the running kernel is still not configured to support gpt disks. Something went wrong; if it is not within an hour of Aug 28 11:12 where you are, the new kernel did not get copied to /boot. please try again.

```
cd /usr/src/linux;make menuconfig

mount /boot
```

edit to:

 *Quote:*   

>  -*- Enable the block layer  ---> 
> 
> --- Enable the block layer                                       
> 
> -*-   Block layer SG support v4                                  
> ...

 exit saving the new configuration

```
make && make modules_install

cp arch/x86/boot/bzImage /boot/kernel-3.4.9-gentoo

reboot
```

upon rebooting

```
os-prober 

grub2-mkconfig -o /boot/grub2/grub.cfg
```

----------

## spacelike

Ok, I made sure to compile the red options in the kernel and no luck.

Still says "no volume groups found" when running os-prober.

I saw a forum post where someone else had an Asus board with a similar problem and he solved it by physically plugging the second HD into sata3.

He mentioned that sata1 and 2 are orange ports and his 3rd was red. I have 1 and 2 as orange and 3-6 are red.

If you don't object to this for whatever reason I'll give it a shot later in the day tomorrow.

----------

## DONAHUE

just to check:

```
zgrep -i partition_advanced /proc/config.gz
```

should yield  *Quote:*   

> CONFIG_PARTITION_ADVANCED=y

 

```
zgrep -i efi_partition /proc/config.gz
```

should yield  *Quote:*   

> CONFIG_EFI_PARTITION=y

 

if not the running kernel still lacks gpt support.

if the kernel indeed has gpt support:

```
parted -l
```

should show two disks (although kernel config shows ntfs support perhaps os-prober wants ntfs-3g) 

bedtime here also

----------

## spacelike

```
 ~ # zgrep -i partition_advanced /proc/config.gz

CONFIG_PARTITION_ADVANCED=y

 ~ # zgrep -i efi_partition /proc/config.gz

CONFIG_EFI_PARTITION=y

 ~ # parted -l

Model: ATA WDC WD5000AAKX-0 (scsi)

Disk /dev/sda: 500GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Disk Flags: 

Number  Start   End     Size    Type     File system     Flags

 1      1049kB  34.6MB  33.6MB  primary  ext2            boot

 2      34.6MB  9698MB  9664MB  primary  linux-swap(v1)

 3      9698MB  500GB   490GB   primary  ext4
```

All show yes, and still parted -l outputs 1 disk  :Sad: 

Also, I already tried getting ntfs3g. I followed the guide in the gentoo wiki all it said to do was emerge "ntfs3g" so I don't know if I need to do any kernel changes, but here are my USE flags for it:

```
Calculating dependencies... done!

[ebuild   R    ] sys-fs/ntfs3g-2012.1.15-r1  USE="acl crypt external-fuse ntfsprogs udev -debug -extras -static-libs -suid -xattr" 0 kB
```

[EDIT]

I made a change to my BIOS recently, I saw that my SATA mode was set to IDE, and I changed it to AHCI. Gentoo still boots up just fine, but I just thought I should mention that I did it last night. So all of the above output was obtained after that change. I can easily change the setting back, just let me know.

[/EDIT]

----------

## DONAHUE

http://en.gentoo-wiki.com/wiki/NTFS-3G

kernel config needs

```
File systems  --->

     <M> FUSE (Filesystem in Userspace) support
```

my fstab has  *Quote:*   

> /dev/sda1		/mnt/xp			ntfs-3g		defaults		0 0

 and xp partition mounts nicely

 *Quote:*   

> I saw that my SATA mode was set to IDE, and I changed it to AHCI.

 good performance enhancement

----------

## spacelike

My kernel already had FUZE set as a module.

Ok, tomorrow I will try moving it to SATA 3.

----------

## DaggyStyle

 *DONAHUE wrote:*   

> win 7 disc likely will be formatted gpt which is unreadable by legacy grub, unreadable by a kernel without gpt support builtin
> 
> Use grub2 -- http://dev.gentoo.org/~scarabeus/grub-2-guide.xml -- http://en.gentoo-wiki.com/wiki/Grub2#Microsoft_Windows_Entry
> 
> 

 

actually, that is wrong, grub legacy on gentoo has gpt support, see: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-boot/grub/files/grub-0.97-gpt.patch?view=markup

and I run gpt with grub legacy.

----------

## krinn

Some controller have specific limitations, something wrote in your mb manual.

I've seen some cannot work with sata+pata, some could handle 1 sata but as soon as 2 are connect, refuse to handle them if not in raid mode... Odd things like that.

You have also some limitations by standard itself : a 6 port sata controller running ahci might run fine but as soon as you enable legacy mode it will only expose 4 ports to comply with classic ide controller, gaving you a 6 disks scheme on bios and 4 disk when booting

And instead of that hell of changes to your kernel, grub... You better partition the windows disk using fdisk and not gparted, then you will have 0 change as windows will format and install on the already present disk structure.

Windows 7 handle gpt but also classic partitions type. And if windows 7 (which i'm not sure, specially as your asus mb doesn't have an uefi bios) default to using gpt, partitionning yourself your disk in linux will bypass this default.

----------

## spacelike

It works now!

When I moved the second hard drive into the SATA3 port I noticed that my BIOS now gave me the option to choose hard drive boot order which it didn't before. I found a picture of my motherboard and was able to tell what the ports were labeled, which I couldn't see on my own due to having everything plugged in.

Apparently the two ports I was using were labeled SAS1 AND SAS2. I'm not sure what those are, but I also noticed that two other ports were labeled SATA1 AND SATA2, so I wasn't using those.

I left my second hard drive plugged into SATA3 and moved my first up to the real SATA1 and now I can boot either from the GRUB prompt.

Thank you all so much. Even though the problem was caused by a stupid wiring error on my part, the people on this board are just amazing. I hope I can be as helpful to Gentoo users one day.

----------

