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.

Saturday, April 11, 2009

Public Entrepreneurship

Just recently the Champaign County Libertarian Party had the opportunity to have a discussion with Joseph T. Mahoney on his collaborative paper (written with Peter Klein, Anita McGahan, Christos Pitelis) about “The Economic Organization of Public Entreprenership”.

I created a podcast of the discussion in AAC format that is available here (6.2 megs, one and a half hours), as well as a google video version which is viewable below:

Among topics discussed were Arrow's Impossibility Theorem, Coase's Theorem, and how the government's role can be to enhance the wealth of nations as opposed to destroying it through the harnessing of entrepreneurship in the public sphere. Some specific examples are thrown in, as well as how the topic related to local politics in Champaign-Urbana.

Some of the arguments were new to me, some of them being more from a utilitarian-libertarian point of view than a deontological-libertarian view. Also, the paper is based upon a minarchist view of the world--that is to say, it assumes that a government will exist. It is a pragmatist idea of how to improve government that could appeal to both conservatives and liberals I think.

For instance, the typical small-government view is that government inaction is better than government action. However, imagine the following hypothetical. A community is under imminent danger from an objectively demonstrable threat (a natural disaster, the collapse of a bridge, etc.). The private parties that make up this community cannot all agree on a plan to remedy the situation. In this case, the government stepping in doing something would be preferable to doing nothing, as a haphazard solution would be better than total disaster. If the government solution is unpleasant enough, or would take too long to implement, this would stimulate entrepreneurs to come together with a plan for the public good. More often then not this plan is more effective, faster, and more efficient than the government plan, and more appreciated by the public as it doesn't involve increased taxes or regulation.

There are surprisingly many instances of this happening, in light of the bungling done with the bridge collapse in Minnesota and Hurricane Katrina at the hands of the government. Just recently I was forwarded an email on how citizens and businesses built a bridge in Hawaii because the government was unable or unwilling to do it. Not only did it get done faster, but much cheaper than the projected cost. Not only that, the cost did not result in increased taxes or government debt--it was absorbed by the businesses who would benefit from the repaired bridge. The "free rider problem" in this case was averted. There are other examples of course, such as citizens volunteering to sandbag an overflowing river. Their efforts not only save their own property, but help save the property of their neighbors as well.

The only downside I can think of, is that while public entrepreneurship is better than a government solution due to government's use of force, is that it sometimes requires the threat of force. In other words, action is only taken because the government bureaucracy's solution is more feared. This of course is tied into legitimacy of the government's force (see: Arrow's Impossibility Theorem), which may be called into question if the democratic process is absent or easy to manipulate--the paper discusses this issue in some detail.

Overall it was a fascinating topic that I think will gain more traction as people realize that the government isn't very good at creating value or solving things--and we may have to rely on ourselves and our neighbors.

Friday, July 4, 2008

Recharge any battery: save the environment by saving money

People are skeptical when I say economic efficiency means environmental efficiency. They often point out externalities as a counter argument, though if you defend property and individual rights, this problem can be mediated: pollute my land, and I sue you. Outside of the tort system, here's a way you, as an individual and as a consumer, can both save a lot of money and save the environment.

Don't throw away your batteries when they're dead! Any student of chemistry knows that a battery is a reversible chemical reaction. The truth is, many alkaline batteries can be recharged. Now the reason why I use the qualifier most is that some batteries are purposely designed to malfunction when you recharge them, to get you to buy more of course.

What I use is a discontinued Rayovak Recharger, which is a scaled down version of this one. I don't know why they stopped making these, but perhaps they did when people found out they could recharge any alkaline battery, as opposed to just rayovak brand rechargeables. Recently, Rayovak launched a new line of rechargeables, but I have not tested these out to see if these still work.

Ideally, any automatic recharger works (the kind that shut themselves off when they detect a full charge), but be careful testing. You can even do it yourself if you're adventurous. One thing I must point out though is that the chemicals inside the battery can irritate your skin, so if you see any sign of leakage, remove the battery with a thick paper towel and wash your hands. You'll notice a distinctive sour odor when batteries burst, which is another way of telling if they've malfunctioned. If the leakage got onto the charger or electronics, you can either wipe it down immediately or wait until it dries and dust it off. Also, if the battery stays warm a while after you've charged it, that means that the battery shorted and can no longer be used. Also, most batteries have some kind of expiration date on them, and this is a good rule of thumb as to your success in recharging the battery.

Ideally you should be able to recharge the batteries as often as you want until the battery can no longer be recharged. If you want, you can use a permanent marker and add a tally mark each time you recharge your batteries.

Good luck, have fun, and remember, safety first!

Tuesday, April 8, 2008

Wayne Allyn Root Speech in Chicago

Here is my video of Wayne Allen Root speaking last week, April 3rd 2008. For those that don't know, he's currently the front runner Libertarian Party presidential candidate.

You can download a high-res version of the film from bittorrent, or watch the lower-res youtube segments below:

You can also view Mr. Root debate the other candidates at the Heartland Libertarian Conference on April 5th.

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.

Sunday, February 10, 2008

Shuttering the Chicago Ron Paul Office

Since Mitt Romney's "suspension" of his campaign, the chance of a brokered Republican Convention this year is close to zero. Because of this, the need for a national campaign through November is over, though Ron Paul will still compete in remaining states. Since Illinois' primary was this past week, the campaign has decided to shutter all the offices here and transfer remaining campaign materiel elsewhere. So, I went over to the Chicago office to pick up some stuff and help with "striking the set". It was a somber affair mostly, akin to packing up all your things for a permanent move, where you know you'll leave behind friends and memories. Overall the office suited its purpose, sharing the ideas of liberty, and I met all kinds of interesting free-minded folks. It's good to know that independent yet generous people (all the equipment in the office was donated) are still around, and will be around for along time to come. I took some final photographs of the Chicago Ron Paul office, before it passed into history:

Saturday, February 2, 2008

The Ron Paul Portrait Is Unveiled in Chicago

Yesterday, I was at an event at the Chicago Ron Paul Office, where they unveiled a new portrait of Ron Paul by the artist Caleb O'Connor. I got a chance to interview him, and ask him about his work and what inspired him.

View Larger Map