Win7 the Windows directory taking up much disk space?



This topic was originally prepared in 8 months ago to write, but for various reasons, has been postponed until now. Tonight (or morning), taking the time to put procedures are done, because only the program after I've written, this topic will have actual value. The topic is: Windows directory in the end take up much real disk space?

See this issue, I think 99% of people would say: use Windows Explorer, right-click the directory to see if property is not to know? Why trick too!

However, I Smallfrogs be so stupid to put a question we all know, re-turned out? Since raised this topic, there is my reason! Please durability patience to look down to see our students again playing Microsoft What kind of flower live, huh, huh.

We know how to view a directory of the most efficient way is to look at Explorer folder properties, but today I want to say is: If you use this method to see WindowsVista/Windows7 system directory, you will be you The eyes deceive, because, Microsoft WindowsVista/Windows7 which a large number of students using one of the NTFS file system features: the hard-wired (HardLink) to achieve WinSxS mechanism!

We know that you want to install WindowsVista/Windows7 system, the system partition must be NTFS file system. The reasons are the following:

System File Protection all necessary security protection mechanisms, such as the required MIC WinSxS required ... ...

On the last point of the WinSxS required, I have not seen the relevant information, but be sure, this is WindowsVista/Windows7 system needs a condition NTFS file system, because only in the NTFS file system above, to achieve hard-wired mechanism, and can optimize the disk space occupied by Windows directory purposes.

On hard-wired, MSDN is so interpreted:

A hard link is the file system representation of a file by which more than one path references a single file in the same volume. To create a hard link, use the CreateHardLink function. Any changes to that file are instantly visible to applications that access it through the hard links that reference it. However, the directory entry size and attribute information is updated only for the link through which the change was made.

In short, is a special shortcut for the file, but the realization of such a shortcut and shortcuts in general not the same.

General shortcut is to create a LNK file LNK file in the description of the target inside the file / directory attributes, the resource manager, or other file management tools using the API function inside SHELL32.DLL get the LNK file points to file / directory to visit. Hard-wired: is based on the file system level shortcut for the file, the file system level based on the meaning of words, as long as the file system boot, then the corresponding shortcut also in force. In other words, this connection is often maintained, because the file system must be random start.

NTFS file system hard link is one of the attributes specific to, the following in Linux, has a similar mechanism. Hard-wired for the file in the same volume level, hard-wired can not cross volume.

WindowsVista/Windows7 own command to create hard-wired: mklink.exe, use this command, we can specify the file to create a hard link:

The following command will link.txt and source.txt relationship between the hard-wired

C: UsersSmallfrogsDesktop> mklink / hlink.txtsource.txt

To link.txt <<===>> source.txt create hard links

Note that the above example: link.txt This is a file does not exist, but when the command after the implementation of complete mklink, link.txt file also been created. In fact, link.txt is a false document, which is in the file system level, a map of the source.txt file, but link.txt not account for the hard disk space.

Occupation on the hard disk space problem, Smallfrogs like this test:

1, to partition a new hard disk partition, space is only 2GB

2, in the test directory inside the new partition, a 1.9GB file size, then the remaining space is 0.1GB

3, with mklink command to the 1.9GB file size of the establishment of a hard-wired

4, check this partition the remaining space, or 0.1GB, but if using Explorer to see the properties of test directory, you will find 2 files, total size is 3.8GB (the partition only 2GB, can hold 3.8GB file size it? obviously impossible)

Or against the above example, if we delete the original file source.txt later, link.txt file will still exist, and the contents of the file content is source.txt. That is, we remove source.txt, actually just deleted that connection of the file itself is not being operated.

On hard-wired, a need to introduce the contents of the final is: when a hard link is established, hard to connect the two sides of any object is modified, will cause the corresponding connection object is modified. For example, the example above: If you modify link.txt, then source.txt file will be modified simultaneously, and vice versa. This level of shortcuts and different SHELL, SHELL levels LNK shortcut file is just a direct relationship between the changes do not affect the LNK file LNK file points to the object, modify the LNK file points to the object will not affect the LNK file.

Well, introducing the basics done, let's actually look inside the Windows directory for the use of it hard-wired.

Often see people complain, WindowsWinSxS directory taking up too much space, which are often found in the file named, and those of the same name files in the directory below WindowsSystem32 also exist, which is Why? In fact that is hard-wired result.

Microsoft actually WindowsWinSxS directory and Windows directory hard link between the relationship, give a simple example:

For Windows7RTM, you can find in two places Ntoskrnl.exe file. The first place is: WindowsSystem32ntoskrnl.exe, there is another place is WindowsWinSxSx86_microsoft-windows-os-kernel_31bf3856ad364e35_6.1.7600.16385_none_6c06b7c41576a7d9ntoskrnl.exe, this is a typical example of a hard connection. Microsoft in the file system on the face of a hard connection made ntoskrnl.exe make ntoskrnl.exe to appear in a different directory which, however, occupy only a ntoskrnl.exe hard disk space. Using this mechanism, some of the benefits below:

The same file, just to maintain a hard link between the copy does not require multiple, so you can save hard disk space if it involves the file update, simply download the first well in the WinSxS directory inside a new version of the same name and then modify the following files WindowsSystem32 hard-wired relations, from the old version of the hard-wired connection point to the new version of the hardware, so that documents can be quickly updated to complete the work without the need for file copying, the speed is also quick to uninstall many of the same patch, just need to hard connection point to the old version on it, no file replacement problems. And established the relationship between hard-wired changes between the files are synchronized, so long as one is changed, the other will be modified

Having said that, how to know the true size of the Windows directory it? Smallfrogs provides a tool that can easily know what files on your system which are hard-wired relations, and the real Windows directory under the file size.

Tools from http://www.kztechs.com/hardlink/realwindirsize.zip (use right-click Save As ... to download) or in the annex to download, unzip after download, you can start scanning directly run the.

Scanning process is relatively long scan is completed, will see the following reminder:






In addition, realwindirsize.exe directory under the file name will generate a file called LinkedFile.TXT, which records the Windows directory on the relationship between the various hard-wired.

As shown above, we scanned the 65 088 documents, of which there are 48,022 real documents, and other 17 066 files are hard-wired file. Paper takes up 14981682KB real hard disk space, and if you use Windows Explorer to see the directory, then be prompted to say that Windows directory taking up 18244902KB hard disk space. In fact, Windowssystem32 directory and most files are hard-wired WinSxS directory established relationship.

Having said that, and finally to summarize it:

Hard-wired, a volume based on the same file system inside the Windows directory the following file shortcuts extensive use of hard-wired technology WindowsSystem32 directory most of the documents, and WinSxS directories are hard-wired relationships established their own system to check inside the Windows directory hard to connect, download the tools http://www.kztechs.com/hardlink/realwindirsize.zip own scan bar

OK, this Windows7 of this completed, please continue to wait for the next bar!