# SATA drive not recognized properly - /dev/hda [solved]

## cyrxi

Specs:

Dell XPS M1210 laptop

Intel 82901GBM/GHM (ICH7 Family) SATA IDE Controller

kernel-2.6.20-gentoo-r8

The long and the short of it:

The drive shows up on /dev/sda on both the Gentoo 2007.0 minimal CD and the Ubuntu Fiesty Fawn LiveCD (and I get the appropriate 45MB/sec buffered write speeds).

I installed Gentoo a few weeks ago and originally tried "genkernel -all", but upon reboot was getting errors about my root partition not being found or some such thing.  I read a lot of negative opinions about genkernel, so I decided to try compiling my own kernel, upon which I got a slightly different error still pertaining to my hard disk.  After playing around with grub, I ended up getting close to a working system by accident when I typed in my root as /dev/hda4 by accident (instead of /dev/sda4).  So I went and changed everything in my fstab to hda and got a working Gentoo install.  It is usable, however, it's just not right!  Furthermore, I'm getting really low (under 2MB/sec) buffered write speeds with when tested with "hdparm -tT /dev/hda".  

I have tried numerous threads and numerous wiki's to no avail.  I've recompiled my kernel at least 5 times now, and it's getting pretty old.  I have tried just about every combination I can think of in my kernel configuration having to do with IDE/SATA/SCSI.

I will post my full lspci and appropriate part of my kernel config when I get home from work, but as I've said, I've tried NUMEROUS kernel configs.  Please help if you can - I'd rather compile in way too many options just to have it work at this point.Last edited by cyrxi on Wed Jun 13, 2007 1:24 pm; edited 1 time in total

----------

## Ken69267

tbh I have everything under ATA/ATAPI/* disabled for my SATA.

Then I enable whats needed under scsi and the SATA/PATA section and my drives show up as sd*

Here's my kernels config if it helps: http://kpaste.dyndns.org/?show=138

----------

## vandien

In my experience, I've found compiling in a ton of options you don't need causes more problems... Once you go through and read the help for each option you're unsure about a couple times, configuring a kernel is easy and "just works" most of the time. If you post your lspci output when you get home it might be helpful, but here are some hints.

```
make sure everything in here is turned off
```

```
compile in (<*>) options for SCSI disk, cdrom, and generic (for USB devices I think)

disable everything in SCSI Transports and SCSI low-level drivers
```

```
enable your SATA option here, probably: Intel PIIX/ICH SATA support
```

```
enable EHCI HCD and USB Mass Storage support, for external USB drives if you plan to use any
```

This should make your primary hard drive /dev/sda and your cdrom drive /dev/sr0, adjust /etc/fstab if needed.

----------

## tomekki

I made the same experience with my Gigabyte DS3 mainboard first.

Than I figured out that it was a BIOS option which maps SATA to PATA.

If you you think it might be your problem as well, I could restart my machine and post the option later.

Greetings

----------

## Ken69267

 *tomekki wrote:*   

> I made the same experience with my Gigabyte DS3 mainboard first.
> 
> Than I figured out that it was a BIOS option which maps SATA to PATA.
> 
> If you you think it might be your problem as well, I could restart my machine and post the option later.
> ...

 

I have a Gigabyte DS3 and never changed anything in the BIOS besides a little voltage to my ram. Odd.

----------

## cyrxi

Okay, I followed vandien's advice to compile my kernel since it sounded pretty much the same as your's Ken - I then immediately set grub and fstab to look for /dev/sda instead and get the following error (which is exactly the same as one of the errors I got originally):

```
VFS: Cannot open root device "sda4" or unknown-block(0,0)

Please append a correct "root=" boot option

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
```

 *tomekki wrote:*   

> I made the same experience with my Gigabyte DS3 mainboard first.
> 
> Than I figured out that it was a BIOS option which maps SATA to PATA.
> 
> If you you think it might be your problem as well, I could restart my machine and post the option later. 

 

I don't seem to have any such option in my BIOS setup, so I doubt that's the problem.

Any thoughts on where to go from here?  I'll definitely still post my "lspci" when I get home (where I can access the internet from that machine), but I'm fairly certain "Intel PIIX/ICH SATA support" is what I need from there.

----------

## Ken69267

Looks like you just need the correct SATA/PATA driver now. And I definitely think you'll need the INTEL PATA support.

----------

## cyrxi

```
# lspci

00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub (rev 03)

00:01.0 PCI bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express PCI Express Root Port (rev 03)

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)

00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)

00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 01)

00:1c.3 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 4 (rev 01)

00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)

00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)

00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)

00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)

00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)

00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e1)

00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 01)

00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 01)

00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)

01:00.0 VGA compatible controller: nVidia Corporation G72M [GeForce Go 7400] (rev a1)

03:00.0 Ethernet controller: Broadcom Corporation BCM4401-B0 100Base-TX (rev 02)

03:01.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller

03:01.1 Class 0805: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 19)

03:01.2 System peripheral: Ricoh Co Ltd Unknown device 0843 (rev 01)

03:01.3 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 0a)

03:01.4 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 05)

0c:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)
```

I don't even know what to try next...

----------

## Ken69267

```
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 01) 
```

That means you'll need the Intel ESB/ICH/PIIX3/PIIX4 PATA/SATA Support, AFAIK.

----------

## cyrxi

Yet more combinations and I'm still stuck.

I followed the suggestions under 5.b (Enabling a SATA driver in the kernel) here: https://forums.gentoo.org/viewtopic-t-539024.html

And upon booting from the Gentoo minimal CD I get "sd" and "ata_piix" as my driver dependencies - these two have been enabled for nearly every config I've tried...  So I tried recompiling with NOTHING but those two (and SCSI CD ROM as "M") under the SCSI and SATA sections and everything in the ATAPI/... section completely off, but it still didn't work.

Upon an lsmod from the boot CD and some searching, I am now recompiling with "Pacific Digital ADMA Support" though I doubt this will fix the problem.  Also, the boot CD seems to load every SATA module, so I suppose that will be what I try next if this doesn't work...

And although it seems backwards, my attempt after that will be to set "# CONFIG_BLK_DEV_IDE_SATA" to Y as suggested by this thread: https://forums.gentoo.org/viewtopic-t-465985-highlight-sata.html

Any other thoughts?

----------

## cyrxi

 *Ken69267 wrote:*   

> 
> 
> ```
> 00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 01) 
> ```
> ...

 

Is that anything different than "CONFIG_ATA_PIIX"?  And why do you keep mentioning that you think I also need PATA support?

I tried that before as well even though I don't think I should need it and it didn't fix my issue.

----------

## Ken69267

The driver is called PATA/SATA   :Wink: 

----------

## cyrxi

Okay, it's still not working with "everything" enabled:

```

Device Drivers  --->

  ATA/ATAPI/MFM/RLL support  --->

    <*> ATA/ATAPI/MFM/RLL support

    <*>   Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support

    [*]   Support for SATA (deprecated; conflicts with libata SATA driver)

    [*]   generic/default IDE chipset support

  SCSI device support  --->

    --- SCSI device support

    <*> SCSI disk support

    <M> SCSI CDROM support

  Serial ATA (prod) and Parallel ATA (experimental) drivers  --->

    <*> ATA device support

    <*>   AHCI SATA support

    <*>   Serverworks Frodo / Apple K2 SATA support

    <*>   Intel PIIX/ICH SATA support

    <*>   Marvell SATA support (HIGHLY EXPERIMENTAL)

    <*>   NVIDIA SATA support

    <*>   Pacific Digital ADMA support

    <*>   Pacific Digital SATA QStor support

    <*>   Promise SATA TX2/TX4 support

    <*>   Promise SATA SX4 support

    <*>   Silicon Image SATA support

    <*>   Silicon Image 3124/3132 SATA support

    <*>   SiS 964/180 SATA support

    <*>   ULi Electronics SATA support

    <*>   VIA SATA support

    <*>   VITESSE VSC-7174 / INTEL 31244 SATA support

    <*>   Intel PATA MPIIX support

    <*>   Intel PATA old PIIX support (Experimental)

```

For those 3 trees if it is not listed above, I do not have it enabled.

I'm on to trying to remove the PATA drivers, then recompile.  Then I'll remove the ATA/ATAPI/... support and recompile.  Then I'll add back the PATA support (without ATA/ATAPI/...) and recompile.  If none of those 3 things work, I'm giving up unless someone can point  out something I'm missing or has some other suggestion.

----------

## gsoe

You definitely should get rid of 

```
[*]   Support for SATA (deprecated; conflicts with libata SATA driver) 
```

and i think you should also get rid of the PATA entries under 

```
Serial ATA (prod) and Parallel ATA (experimental) drivers  ---> 
```

When that is done, i think that the kernel config is allright. Then you should make sure that grub is working correctly. That is: Make sure that your kernel is properly installed in /boot (it is important, that the System.map is there as well), then from chroot (showing disk as sda) reinstall grub. You can try now to have a look at /boot/grub/device.map before you reinstall grub, it might show disk as hda.

No guarantees, just my hunch...

----------

## cyrxi

 *gsoe wrote:*   

> You definitely should get rid of 
> 
> ```
> [*]   Support for SATA (deprecated; conflicts with libata SATA driver) 
> ```
> ...

 

I know that none of that stuff belongs there, I'm just grasping at straws at this point.

 *gsoe wrote:*   

> 
> 
> Then you should make sure that grub is working correctly. That is: Make sure that your kernel is properly installed in /boot (it is important, that the System.map is there as well), then from chroot (showing disk as sda) reinstall grub. You can try now to have a look at /boot/grub/device.map before you reinstall grub, it might show disk as hda.
> 
> No guarantees, just my hunch...

 

Grub is definitely installed correctly, and I can boot to other kernels I have set up as "root=/dev/hda4" (if I also change everything in my fstab to /dev/hda*).  I do not, however, have a "System.map" file in /boot.  I do have:

/boot/grub/device.map containing a single line:

```
(hd0)     /dev/sda
```

Edit:

And apparently I have a System.map-genkernel-x86-2.6.20-gentoo-r8 in /boot that must be "leftover" from my original genkernel -all attempt.  Could that be causing the problems?

----------

## gsoe

Yes, I think so. If you compile and install your kernel like this

```
make && make modules && make modules_install && make install
```

you will have your vmLinuz-version, System.map-version and .config-version copied to /boot and in addition symlinks vmLinuz -->vmLinuz-version, System.map -->System.map-version will be setup, so you can have grub just pointing to vmLinuz.

Now, to fix the system, boot from cd and chroot into your system as in the installdocs and check that the disk is shown as /dev/sda, then compile the kernel and setup grub.conf to point at the symlink vmLinuz and install grub with grub-install following the directions from the installdocs. Hope you will be fine then...

EDIT: The all-important thing to do is to be sure that you mount everything correctly before you chroot, especially the /dev and /proc filesystems. Also the copying from /proc/mounts to /etc/mtab before you install grub is crucial.Last edited by gsoe on Thu Jun 07, 2007 7:35 pm; edited 1 time in total

----------

## cyrxi

Does it matter if I do this from a current working kernel off my hard disk (as hda*) or should I reboot off the install CD to rebuild my kernel?

----------

## Ken69267

 *cyrxi wrote:*   

> Does it matter if I do this from a current working kernel off my hard disk (as hda*) or should I reboot off the install CD to rebuild my kernel?

 

Shouldn't matter.

----------

## gsoe

To be honest, i'm not sure. I would avoid it though, just to eliminate a source of problems.

----------

## gsoe

Actually, think about this: In the gentoo handbook chapter about setting up grub, it is emphasized that you have to copy /proc/mounts to etc/mtab before you install grub. That will give you /dev/sdx devices in mtab. If you go from a kernel that sees your devices as /dev/hdx, that will be what's in mtab.

Probably a good idea to go with the cd....

----------

## cyrxi

Yeah, I figured the CD would be better - anyway, I don't have an option now as I deleted my entire /boot partition by accident while trying to clean some things up  :Embarassed: 

----------

## cyrxi

 :Evil or Very Mad: 

Still getting the same error.  I followed the Gentoo Handbook to chroot, re-compile my kernel and re-install grub, still no luck.  I also used "make install" as well when compiling the kernel, so I have System.map now.

Any ideas where to go from here?    :Crying or Very sad: 

----------

## NeddySeagoon

cyrxi,

Lets check your kernel install.  Run the command 

```
uname -a
```

Look at the date and time.

That is the date and time the running kernel was made. If you have just made a kernel, it should be at most hours ago.

Does it fit with the time you made your kernel?

If not, the kernel install was messed up or you have installed the kernel correctly but are not actually running it

----------

## cyrxi

Sorry it took so long, but here's the result:

```
 # uname -a

Linux tinytop 2.6.20-gentoo-r8 #15 SMP Thu Jun 7 16:25:32 EDT 2007 i686 Intel(R) Core(TM)2 CPU         T5600  @ 1.83GHz GenuineIntel GNU/Linux

```

Which is when I re-compiled / re-installed grub, so I am using the newly compiled kernel.

I don't know if this will help:

```

tinytop brandon # hdparm -i /dev/hda

/dev/hda:

 Model=HTS721010G9SA00, FwRev=MCZOC10H, SerialNo=MPCZH1Y0GEUHUD

 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }

 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4

 BuffType=DualPortCache, BuffSize=7538kB, MaxMultSect=16, MultSect=16

 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=195371568

 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4

 DMA modes:  mdma0 mdma1 mdma2

 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5

 AdvancedPM=yes: mode=0x80 (128) WriteCache=enabled

 Drive conforms to: ATA/ATAPI-7 T13 1532D revision 1:  ATA/ATAPI-2 ATA/ATAPI-3 ATA/ATAPI-4 ATA/ATAPI-5 ATA/ATAPI-6 ATA/ATAPI-7

 * signifies the current active mode

```

Again I'm just grasping at straws here, but could it have something to do with the hard disk itself?  It's brand new, I upgraded it to switch over to Gentoo because I couldn't afford to be without a working system (I still have my Ubuntu install on the 80GB 5400RPM drive that came with the system when I ordered it).  It's the only thing I've switched in the machine and no one else with an M1210 seems to be having a problem - they say "enable the Intel PIIX/ICH SATA drivers and you're set".

----------

## cyrxi

It might be an issue with the 2.6.20 kernel:  https://forums.gentoo.org/viewtopic-t-561457-highlight-.html

I'll post again when I've tried another version - I decided to give the Suspend2 sources a try, so I compiled 2.6.18 last night, but apparently I missed something (unrelated to my current issues) in the config because it stalls before it even gets to the error I was previously getting.  I'll double-check my configuration tonight or tomorrow.  In the mean time I'd be interested to hear what everyone else thinks...

----------

## cyrxi

Indeed it was an issue with the 2.6.20 kernel - is there somewhere I can report this bug?

I gave up on the Suspend2 sources and opted for gentoo-2.6.21-r2 - my SATA drive (with the exact same config under SCSI/SATA I tried originally) worked flawlessly and I am getting great speeds for buffered reads with hdparm.

Now on to getting my wireless and ALSA to work again...

----------

