本文标签:Windows 2008, Windows 7, Windows Vista
这是一个在安装Windows Vista和Windows Server 2008时候经常被提及的问题.为了解答这个问题,首先我们要了解“组件化”这个词的含义,然后再谈一谈Vista里面的组件们是如何被管理的.
Vista相比于前任的重大变化之一就是从用“安装配置”(INF文件)描述的操作系统过渡到组件化的系统.Windows中的所谓“组件”就是一或多个二进制文件,一个索引文件,还有一个描述安装过程如何进行的XML格式文档.这个文档描述了可能的注册表操作或者安全权限需求.组件们以逻辑单元分组,这些单元的不同就是Windows不同版本的区别.
WinSxS这个文件夹存放了Windows所需要的所有组件。每一个组件都有属于自己的命名,可以看出它属于何种版本、语言,以及是32位还是64位的Windows。每当系统需要任何一种文件的时候,都会从这个文件夹找到相应的文件,再拷贝到需要的路径里面,或者直接创建一个映射,指向winsxs文件夹里的源文件(显然这么做对硬盘空间仁慈多了)。也就是说,实际上Winsxs这个文件夹和Windows完全安装一次所需的磁盘空间一样大。
What is the WINSXS directory in Windows 2008 and Windows Vista and why is it so large?
A commonly asked question among people looking at a Windows Vista or Windows Server 2008 installation is “why is the WinSxS folder so big?!” To answer that question I need to first describe componentization, and how components are managed in Windows Vista.
One of the largest changes between previous versions of Windows and Windows Vista was a move from an INF described OS to componentization. A component in Windows is one or more binaries, a catalog file, and an XML file that describes everything about how the files should be installed. From associated registry keys and services to what kind security permissions the files should have. Components are grouped into logical units, and these units are used to build the different Windows editions.
All of the components in the operating system are found in the WinSxS folder – in fact we call this location the component store. Each component has a unique name that includes the version, language, and processor architecture that it was built for. The WinSxS folder is the only location that the component is found on the system, all other instances of the files that you see on the system are “projected” by hard linking from the component store. Let me repeat that last point – there is only one instance (or full data copy) of each version of each file in the OS, and that instance is located in the WinSxS folder. So looked at from that perspective, the WinSxS folder is really the entirety of the whole OS, referred to as a "flat" in down-level operating systems. This also accounts for why you will no longer be prompted for media when running operations such as System File Checker (SFC), or when installing additional features and roles.
That explains why the folder starts off big, but not why it gets larger over time – the answer to that question is servicing. In previous versions of Windows the atomic unit of servicing was the file, in Windows Vista it’s the component. When we update a particular binary we release a new version of the whole component, and that new version is stored alongside the original one in the component store. The higher version of the component is projected onto the system, but the older version in the store isn’t touched. The reason for that is the third part of why the component store gets so large.
Not every component in the component store is applicable, meaning that not every component should be projected onto the system. For example, on systems where IIS is available but has not been installed, the IIS components are present in the store, but not projected into any location on the system where they might be used. If you’re familiar with how multi-branch servicing works in previous versions of Windows then it’ll make sense to you that we have a different version of the component for each distribution branch and service pack level, and that all these different versions are also stored in the WinSxS folder, even if they’re not immediately applicable. So a single Post SP1 GDR package that contains an update to one component will end up installing four versions of that component in the WinSxS folder – double that on a 64 bit operating system for some components.
Now that you know why the store can grow to be so large, your next question is probably to ask why we don’t remove the older versions of the components. The short answer to that is reliability. The component store, along with other information on the system, allows us to determine at any given time what the best version of a component to project is. That means that if you uninstall a security update we can install the next highest version on the system – we no longer have an “out of order uninstall” problem. It also means that if you decide to install an optional feature, we don’t just choose the RTM version of the component, we’ll look to see what the highest available version on the system is. As each component on the system changes state that may in turn trigger changes in other components, and because the relationships between all the components are described on the system we can respond to those requirements in ways that we couldn’t in previous OS versions.
The only way to safely reduce the size of the WinSxS folder is to reduce the set of possible actions that the system can take – the easiest way to do that is to remove the packages that installed the components in the first place. This can be done by uninstalling superseded versions of packages that are on your system. Service Pack 1 contains a binary called VSP1CLN.EXE, a tool that will make the Service Pack package permanent (not removable) on your system, and remove the RTM versions of all superseded components. This can only be done because by making the Service Pack permanent we can guarantee that we won’t ever need the RTM versions.
So yes, the WinSXS folder is very large, and it will continue to grow as the OS ages. I hope that this clears up some of the questions about why that is, and what you can do about it. Note that the Windows servicing structure and the layout of the store is subject to change.
Joseph Conway Senior Support Escalation Engineer Microsoft Enterprise Platforms Support
» 转载请注明来源:电脑知识收藏夹 » 《Windows 7,Vista,2008,Win7的Winsxs文件夹为什么越来越大》» 订阅本站:http://feed.x2009.net