Schlagwort-Archive: Windows 7

Intel US15W “Poulsbo” Ultra Mobile chipset, SSDs and SATA TRIM

I have bad news. A lot of (very slow) netbooks with Intels US15W chipset—also known under its codename “Poulsbo”—use a PATA-to-SATA bridge chip, simply because of the fact that the chipset doesn’t feature SATA at all. So what netbook vendors did back in ~2008 was to add this bridge chip in order to get an Atom-based notebook at a low price with a back then already standard SATA interface. Apparently SSDs were not the standard back then: they used standard HDDs with either SATA I (1.5 GBit/s) or SATA II (3 GBit/s).

Since the Intel Atom of this generation, Z5xx mostly, isn’t really a fast processor anyway, it really makes not much of a difference if the ATA (IDE) i.e. “parallel ATA” or SATA i.e. “serial ATA” interface is used. Speed will always be limited by the processor, making the Atom Z500 series a bad choice for a real SATA-based system. BUT 2.5 inch disk drives from 2008 were mostly SATA, so they kind of had to add the PATA/SATA bridge to get it. In this view–and only in this view!–it makes perfectly sense to even think about adding such a PATA-to-SATA bridge chip.

The problem

Actually there wouldn’t be a problem, and with SATA HDDs there is none. Specifically, the problem is the PATA-to-SATA bridge chip they used. It doesn’t know about SATA TRIM. Which, by itself, is not a problem either, BUT for unknown reasons it doesn’t correctly relay the TRIM command, thus TRIM is never sent to and never received by the SATA SSD, therefor TRIM doesn’t work.

“Not so bad,” one might think. “Then I use an SSD with a good garbage collection mechanism and I’m okay.” Right? Wrong!

How the operating system handles SATA TRIM…

Every operating system I know of will check the ATA interface and the HDD/SSD for its supported features i.e. capabilities. Windows supports SATA TRIM since version 7 (2009). Therefor Windows up to Vista simply ignores the TRIM feature, even if it is supported by the SSD: it doesn’t check for it, doesn’t use it and will simply ignore it. Not even third party programs are able to use TRIM on Windows prior to Windows 7, which is normal, because every program that wants to send TRIM relys on kernel functions which were not yet implemented before Windows 7. On Linux and Mac OS X it is the same. Linux supports TRIM since Kernel version 2.6.33 (February 2010), Mac OS X since version 10.6.6 (special MacBook Pro version, February 2011) and 10.6.8 (June 2011), but only for selected Apple SSD hardware (which can be hacked to work with any SSD).

But if the operating system does have support for the TRIM command, it will ask the HDD on the ATA or SATA bus about its capabilities (features). A SATA SSD (or ATA SSD) will report that it supports TRIM through the standard ATA protocol. So far the used PATA-to-SATA bridge chip does everything right. So the SSD reports to Linux, Mac OS X, Windows and any other operating system and tool that it has TRIM capability.

Windows (and FreeBSD/NetBSD/OpenBSD, Linux, Mac OS X and any other OS with TRIM support) will then try to use this reported feature. And here the problem with this particular configuration starts, because as soon as Windows tries to use TRIM, this command will not “get through” the PATA-to-SATA bridge chip. One way to deal with this may be to simply ignore it, but apparently Windows does not do that… and hangs. My guess is that it somehow checks for a successful TRIM command, which fails, and any further disk input/output is therefor impossible from this point on. (Which is why the installer does not really crash: the mouse cursor is moving normally, only without any further disk i/o nothing can be done, not even to cancel the installation.)

Linux continues to work. This may be either because it doesn’t check for a successful TRIM command or because the US15W chipset may already be blacklisted. I did not do research any further, because quite frankly I don’t care that much. It is only important to notice that dispite the reported TRIM feature and all the trim functions enabled in Linux, trim still does not happen on the SSD. But the system will not hang, only you will not know about the non-working TRIM.

Work-around?

So, since now we know about the WHY? we can start asking about the HOW? to get around it. The logical answer: disable TRIM support on Windows. The other possiblity would be to make the SSD not report that it has TRIM capability. But this would mean to modify the firmware of the SSD, something only a very very very qualified hacker could do or the manufacturer of the SSD, both very unlikely…

So there we go: disable TRIM on Windows 7 and newer. How would we do that? The solution is not trivial, but can be accomplished with a bit of know-how.

First, you need the following things prepared:

  • Means for partitioning and formatting an NTFS volume on a TRIM-disabled SSD.
  • Means to change the windows registry in order to disable TRIM.

For the first one there are a couple of possibilities, all of which come down to using either an operating system that doesn’t support TRIM or one that at least doesn’t crash when partitioning and formatting the target drive and partition. I would like to point out two:

  • Partition the HDD/SDD and format the target NTFS partition using Linux: parted or fdisk and mkntfs (from NTFS-3G).
  • Use Windows installation media (USB pen drive or DVD) of a Windows prior to Windows 7 to partition the drive and format the partition. Ideal: Windows Vista.

This is necessary because Windows 7, 8, 8.1 and 10 installation media will stall when formatting any partition with NTFS, because it will try to TRIM the whole partition. Windows Vista on the other hand will not use TRIM at all, therefor the creation of an NTFS partition will be successful and it will not hang.

For the second task we need a Windows live system, such as Windows PE. It will, of course, also work to remove the SSD from the netbook, connect it to another PC running Windows and to import the registry hive there. If this is not an option or too complicated (when performing an upgrade this has to be done twice!) the live media is the better solution.

  • BartPE, at this time the only Windows live environment I know of.
  • Theoretically any Windows PE or Windows RE system that includes/supports running the Registry Editor regedit.exe works.

There are other Windows live solutions around, but BartPE seems the most easy to create and is available free of charge.

To create a BartPE live boot media (either USB or DVD) you need a copy of Windows, preferrably the one you try to alter the Windows Registry with, so I would suggest a Windows 7 version of BartPE. I did my modification with a Windows 8.1 version of BartPE and it worked, and I assume that a Windows Vista version will also work, nevertheless it seems logical to use the same version. Note that Windows Enterprise Edition is available free of charge for download and can be tested for 90 days for free, so you will have no problem to get a Windows version for the use with BartPE.

So, if you don’t have a bootable live Windows like BartPE yet, there will be a lot of downloading to do:

  • Download a Windows ISO image. If you register with Microsoft, Windows 10 Enterprise is free.
  • Use WinBuilder to create a bootable Windows PE live media, either a USB pen drive or a DVD.

Once you have done all that, start with a normal installation of Windows 7 or newer. Select the already prepared NTFS partition as installation target but do not format that partition! The Windows installation routine will copy all necessary files from the installation media to the NTFS partition and also copy and configure the boot loader and prepare the next installation steps after restarting the computer from the HDD or SSD. Luckily no TRIM is needed to write files.

When the Windows 7, 8/8.1 and 10 installation program reports that it has finished copying all files it will display a count-down in order to restart the computer automatically. You can start the reboot, but do NOT start the freshly installed Windows from the SSD!

Instead, do one of the following: 1) turn the PC off when the display gets dark, i.e. the reboot is in progress and the BIOS resets and initializes all the integrated devices. When you turn the computer back on again later, make sure to boot from the prepared Windows PE live media. 2) during the reboot, select the prepared Windows PE live media to boot from right away.

Selecting the live media as boot device requires you to know exactly what type of BIOS (or UEFI) your computer has. Some BIOS/UEFI implementations use the Escape key for a “BBS POPUP” i.e. the boot selection menu. Others expect the F5 key. Some want the F8, F9, F10, F11 or F12 key pressed during BIOS initialization. And so on. You really have to look into it. Try it first, so you already know how to boot from the live media when you need it after the first part of the Windows installation.

Disable TRIM in the Windows Registry

This is a step-by-step guide to disable the TRIM command for Windows. BTW, I was surprised to find that this is actually a registry key, and only that. If I would have had to guess, I would have guessed it must be a boot loader parameter. But it isn’t… (it appears that boot parameters have been discontinued by Microsoft…)

You have just started from the prepared BartPE (or any other Windows PE based live media). Now run regedit.exe. In the registry editor select HKLM i.e. HKEY_LOCAL_MACHINE. From the “File” menu select “Import Hive…” and load C:\Windows\System32\Config\SYSTEM. When asked for a name, give it a temporary name that you can easily identify, like “TEMP”. (Note: when you upgrade an existing Windows you have to do this on the C:\$Windows.~bt folder before, reboot, continue with the installation and on the next reboot load the registry hive again with the C:\Windows folder!)

Now, all you have to do is find all “ControlsetXXX” keys in the hive and change the Control\Filesystem\DisableDeleteNotification from 0 to 1. So, if you chose “TEMP” as name, the registry path will be HKEY_LOCAL_MACHINE\TEMP\ControlSet001\Control\Filesystem. In this path you will find the DWORD entry “DisableDeleteNotification”. Double-click it and change the value from 0 to 1. Check if there are other control sets, like HKEY_LOCAL_MACHINE\TEMP\ControlSet002, and change it there too.

Now, select HKEY_LOCAL_MACHINE\TEMP, go to the menu and unload the hive („File“ menu, „Unload Hive…“ while „TEMP“ is selected in the registry tree).

Reboot and continue with the installation, i.e. your BIOS boot selection will be the internal SSD. Windows 7, 8, 8.1 and 10 will now no longer use TRIM and therefor it will no longer stall.

Note: when you upgrade from a previous version of Windows, you need to do the registry change twice: once for the registry have in a directory called $Windows.~bt after rebooting for the first time, and a second time in the Windows directory when rebooting the second time. This is due to the way the Windows installer is built. It will have to move the previous Windows installation from C:\Windows away, which cannot be done when the installation program is run from that very Windows installation. It will use an intermediate installation step, which is in the $Windows.~bt directory. When the actual installation is performed after the first reboot, the old Windows installation will normally be moved to C:\Windows.old and the new one will be placed in C:\Windows, where the registry change is necessary once more.

Resources

Advertisements