Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Monday, January 4, 2010

Getting AHCI to work with an IDE installation of windows

If anybody has tried to install windows XP (with SP3 or the 64-bit version) with SATA drives, they'll quickly find out the challenge of installing with AHCI enabled in BIOS. I was one of many who gave up trying, and simply set IDE compatibility mode in the BIOS, which ensures that your new SATA drive will work with older operating systems. For the longest time I had simply assumed that I was stuck with the slower IDE drivers, and would forgo the double data transfer rate of SATAII, as well as the lower wear-and-tear on my hard drive from the use of NCQ. Or I would have to spring the cash for a brand new install of Windows Vista or Windows 7. However, I came across a somewhat painless method for enabling AHCI in BIOS, using the following tutorial. (Since this link appears down at the moment, I will reproduce the text below)

Posted by Giulio in Computers

This is a topic I often googled for to have the definitive solution, but I never found a complete one.

Sometimes you install Windows on your PC while the disk controller is in IDE (compatible) mode, and you later realize you would like to switch to the newer AHCI mode.

Doing this after the install procedure is tricky, because Windows needs the disk driver to boot, and if it doesn’t have it, well, it will blue screen forever because it’s not able to mount the system volume.

I found a lot of articles regarding this topic, but often they were specific to some SATA controller, incomplete, and didn’t explain *why* this happens and how to define a generic solution.

So, here is my best effort to explain this.

In Windows, drivers are installed as services. You can find a pretty list of them in the registry, using the well known regedit.

Fire regedit up, and browse to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services key.

Every key here represents a service, which could be a driver or a service as you see them in the Services console.

CurrentControlSet is the current system configuration. Actually, this a link to one of those ControlSetXXXX keys you can see at the same level of CurrentControlSet.

Windows does this to keep track of different system configurations, so you can have a “last good configuration”, and so on.

You can tell which control set is the current one by having a look at the HKEY_LOCAL_MACHINE\System\Select key. Here you can see four values : Current, Default, Failed, LastKnownGood. The value of each of these indicates which ControlSetXXXX is the corresponding one. Value names are pretty self explanatory, so I won’t detail them. Since you need to modify the current one, anyway, let’s stick to CurrentControlSet.

Now, before switching to AHCI (which can be done in the BIOS of your computer, and if you’re reading this you probably know how to do that), the proper driver must be manually installed.

Since the most common vendor for AHCI controllers is Intel, I will cover how to install the iaStor driver, which is the generic driver for all recent Intel SATA controllers.

First, download the drivers. A quick google search will point where to get them. The installer won’t work, because the controller now is in IDE mode, and has a different hardware ID. So, they must be manually installed.

The quickest way to have the actual driver files is to download the plain ZIP package from Intel’s website. The only file needed from the archive is iaStor.sys.

Throw this file in C:\Windows\System32\Drivers. Of course, if “Windows” is not where Windows is installed, replace with the correct folder name.

Now, a registry key for the driver must be created.

To speed things up, a .reg file can be created to quickly import new keys and values in the registry. Copy and paste the following in a text file and save it as ‘iastor.reg’, or whatever .reg name. Double click on the .reg file to import it.

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\iaStor] "Type"=dword:00000001 "Start"=dword:00000000 "Group"="SCSI miniport" "ErrorControl"=dword:00000001 "ImagePath"="system32\\drivers\\iaStor.sys" "tag"=dword:00000019 "DisplayName"="Intel AHCI Controller" [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\iaStor\Parameters] "queuePriorityEnable"=dword:00000000 "BusType"=dword:00000003

Now, Windows knows of the iaStor driver. Windows also needs to know that your AHCI controller is a critical device, and the driver must be loaded early, before painfully crash with a bluescreen.

Another key in the registry must be created, in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase. Here a key exists for each device which is critical for boot time. A new key with the hardware PCI ID of your specific AHCI controller. This PCI ID can be retrieved by having a look at the ‘iaStor.inf’ (for SATA RAID) or ‘iaAhci.inf’ (for plain AHCI) files which come with the drivers. Doing some text search (and of course knowing the name of your controller, like ICH8, ICH9, etc) will uncover some lines which match the controller name with its PCI ID. Here is an extract of iaAhci.inf.

PCI\VEN_8086&DEV_2653&CC_0106.DeviceDesc = "Intel(R) 82801FBM SATA AHCI Controller" PCI\VEN_8086&DEV_27C1&CC_0106.DeviceDesc = "Intel(R) 82801GR/GH SATA AHCI Controller" PCI\VEN_8086&DEV_27C5&CC_0106.DeviceDesc = "Intel(R) 82801GBM SATA AHCI Controller" PCI\VEN_8086&DEV_2681&CC_0106.DeviceDesc = "Intel(R) 631xESB/632xESB SATA AHCI Controller" PCI\VEN_8086&DEV_2821&CC_0106.DeviceDesc = "Intel(R) 82801HR/HH/HO SATA AHCI Controller" PCI\VEN_8086&DEV_2829&CC_0106.DeviceDesc = "Intel(R) 82801HEM/HBM SATA AHCI Controller" PCI\VEN_8086&DEV_2922&CC_0106.DeviceDesc = "Intel(R) ICH9 SATA AHCI Controller"

As for the iaStor key, the following text can be copied and pasted in a .reg text file for quick import, but be careful to substitute my PCI ID (the red string) with yours. You should change only the DEV_ value, since VEN and CC are the same for all controllers. Double click the file, just as for the previous one, to import it.

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_8086&dev_2829&cc_0106] "Service"="iaStor" "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}" "Security"=hex:01,00,04,90,00,00,00,00,00,00,00,00,00,00,00,00,14,00,00,00,02,\ 00,4c,00,03,00,00,00,00,00,14,00,ff,01,1f,00,01,01,00,00,00,00,00,05,12,00,\ 00,00,00,00,18,00,ff,01,1f,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,\ 00,00,00,18,00,9f,01,12,00,01,02,00,00,00,00,00,05,20,00,00,00,21,02,00,00

OK. Now, you can reboot, change the controller from IDE to AHCI in the BIOS, and hopefully everything will work. At least, it worked for me

If something went wrong, just switch back to IDE mode and verify that all steps have been done correctly.

These steps should be quite similar for other vendors/drivers, so feel free to improvise

Have fun!

I tried this method, and wasn't successful at enabling AHCI, but I *was* successful in enabling RAID in my BIOS. Don't worry, you don't need to mount a RAID volume, it will use your existing volumes without you needing to do anything, but if you want to use RAID in the future. Also, the RAID option encapsulates the ACHI option, so you'll benefit from the same features such as SATAII and NCQ. You can then install Intel's Matrix Storage Manager if you'd like. I recommend using a utility such as HD Tune to confirm that you're getting the faster transfer rates and features present with your SATA drive--the free version is sufficient in reporting this information.

Tuesday, March 4, 2008

Getting Windows Vista NOT to screw up networking

I recently bought a low-end laptop, and much to my surprise, it came Windows Vista instead of Windows XP. It sure looks pretty, and, in fact, I'm using to write this blog write now. However, Windows Vista has an infuriating flaw.

It won't network with Windows.

First a little background on my network topography. I run Windows 2003 Server as a router, file server, and print server. I've gotten everything, and I mean everything to read file shares on this network. I've gotten almost every Windows OS (save Vista) to work: Windows 95, Windows 98 SE, Windows 2000, Windows XP Professional, Windows XP Professional 64-bit. I've even gotten openSUSE (a flavor of Linux) to read network shares using Samba, with the small exception of folders on NTFS drives.

And Windows Vista? Absolutely nothing. Yes, I can connect to the internet, but I see nothing on the network. Microsoft Help pointed me in the direction of installing the LLTD (Link-Layer Topology Discovery) protocol. Of course, it can only install in Windows XP. I forced it to install using compatibility mode on Windows 2003, and added the protocol to my network card, and rebooted the server.

Four hours of a wasted evening later, I can now not only finally see the shared files on the network, but I can also see the position of my 2003 server in my network. If it had taken one hour longer, I would have torched my laptop. Let's just say I don't expect the average home user to figure out this problem on their own, and may cause a small amount of chaos in IT departments across the country. Thanks, Microsoft.

Thursday, March 8, 2007

Problems Installing Linux

Since Windows Vista makes me sick, I decided to to give Linux a spin, as I remember the KDE interface to be quite tasty. I'm now on my FIFTH flavor of Linux trying to get it installed. My system is neither bleeding edge, nor obscure, but it is rather new. It is made with off-the-shelf parts and assembled myself. Windows XP 64-bit installed perfectly and runs amazingly well. The specs are as follows:

So I fire up Kubuntu 6.06 Dapper 64-bit edition, the latest stable release of that flavor of Linux. A half-minute through the standard install selection, and I get this un-userfriendly obscure error:

PCI: Failed to allocate mem resource #6: 20000@50000000 for 0000: 01:00.0

Even with a Computer Engineering Degree from a Big 10 University and 2.5 years experience in software development, this doesn't mean squat to me. Some googling later reveals that this release of Kubuntu/Ubuntu doesn't have the latest kernel of Linux, and therefore doesn't support the Intel Core 2 Duo. Why Windows XP-64 with SP1, an operating system that dates from April 25 2005 (according to wikipedia), doesn't have any problems is a mystery to me.

Thinking that the kernel is the problem, I download instead Kubuntu 6.10 Edgy. I got the following problems with this installer:

/bin/sh: can't access tty; job control turned off

Some searching for this problem revealed that my SATA drive might be to blame (really?). I tried some command line switches that people suggested in some forums, and got the same result. Another post recommended I use the Alternative installation CD. So, I download this one, burn it, run it, and choose the text installer. After choosing some initial options, I get this lovely error:

No common CD-ROM drive was detected

No CD-ROM? Are you joking? How the hell did this installer run in the first place? I tried manually selecting one, but nothing was detected this way. It kindly suggested that I abort the installation. Later on I discovered this happened on machines who happened to have windows installed on the primary partition of a SATA drive.

Having exhausted most flavors of Kubuntu, and not wishing to download the absolutely-bleeding-edge developer's nightmare edition, I opted out, and browsed the other breeds of Linux on distrowatch.com. I was disappointed in not being able to install Ubuntu/Kubuntu, since it is the most popular one on there. I opted next for SimplyMEPIS 6.5 RC1, another Debian based Linux, and reportedly similar to Kubuntu. Two episodes of Babylon 5 later, it's downloaded and ready to go. Things looked promising at first until in unexpectedly left the install GUI and went into an infinite loop of printing out the following line of text:

/etc/init: 5 /linuxrc: not found

Apparently this is caused by the fact that I have an Intel 965 motherboard. So much for off-the-shelf parts, eh?

Despairingly, I decided to simply pick at random from the list of the top linuxes on DistroWatch. OpenSUSE 10.2 seemed promising for one particular reason: it had an optional "mini-install" that downloads packages directly from the internet. Sick of downloading large ISO files, I opted for this one. I popped in the CD and started the installer. At first it seemed to have the same problems as Kubuntu in not liking my SATA and DVD-ROM combination, but eventually the prompt for an internet installer. I followed the instructions verbatim from SUSE's website, and eureka! it started downloading without a hitch.

The installer is quite pretty and intuitive. It intelligently set up extra partitions on my hard drive, detecting my windows partitions and leaving them alone. It automatically set up a pagefile partition, which is something I have to do manually for Windows using a special partitioning boot CD. The defaults were nice, but gave you the option of specifying your own partitions, so either a novice or an expert would be happy. The default software packages were intelligently picked as well, assuming that I wanted a standard selection of desktop applications. The only thing I had to add in "expert" mode was an optional 32-bit environment (for WINE to run windows applications). Optionally there were server and developer packages advanced users could install. I could also pick which GUI I wanted to download: Gnome, KDE, or "other". It gave me a nice summary of my choices at the end, allowing me to go back and fix any choices. It then started downloading, giving me the estimated size remaining of the download, number of packages, and time remaining.

Looks like it will continue downloading during the night, so my user experience will have to wait for another post. Hopefully, I will be able to figure out how to get it to interact on my Windows network. Though I was frustrated with the install process at first, I reminded myself that at least I didn't pay for this operating system. All it cost me was some internet bandwidth, a couple evenings, and a few blank CD's. This is more than I can say for people's experiences installing windows vista.