winsxs内のファイルの削除。

いまさらですがちょっと興味深かったのと、VirtualBoxで飼っているWindows 7のディスク容量がピンチになってきて調べてみたら\Windows\winsxs ディレクトリが10GB以上食っていたのでこれをどうにかしたいと思ったのとで、ググってみました。

「ディスクのクリーンアップ」で削除できるよ、という情報はMicrosoftの大きな Windows コンポーネント ストア (WinSxS) ディレクトリが原因で発生するディスク領域の問題を解決する方法にもあったのですが、どうやらこの10GBはこの方法ではだめみたいでして。

もうちょっとググったら、TechNetのほうにShould you delete files in the WinSXS directory? And what’s the deal with VSS?という記事を見つけました。

===
One of the common threads I noticed in my recent web trolling was the question “Can I delete the \Windows\Winsxs directory to save space?”.

So, to answer the question, the answer is simply: No.
===
(ちょっとBloggerの blockquote があまりにもアレなので、===で代用しています。ほんとはCSSいじればいいんですけど…)

基本的には手動で削除するのはだめ、だそうです。が、

===
Why? Because the component store (\Winsxs) is needed to repair the OS binaries in the event that a file becomes corrupted or, in worst case scenarios, compromised. There are a few directories in the component store so let’s look at them and what their general role is in Windows.

  1. \Winsxs\Catalogs: Contains security catalogs for each manifest on the system
  2. \Winsxs\InstallTemp: Temporary location for install events
  3. \Winsxs\Manifests: Component manifest for a specific component, used during operations to make sure files end up where they should
  4. \Winsxs\Temp: Temp directory used for various operations, you’ll find pending renames here
  5. \Winsxs\Backup: Backups of the manifest files in case the copy in \Winsxs\Manifests becomes corrupted
  6. \Winsxs\Filemaps: File system mapping to a file location
  7. \Winsxs\: The payload of the specific component, typically you will see the binaries here.

So, can you delete these? Sure, you could I guess. What would happen? Well, it depends. So long as the files in the \Windows\System32 directory are valid, most likely you wouldnt see any problems initially, the machine would “most likely” operate properly. However, the first time you attempt to update a binary, apply a service pack or service a component, it’s going to fail because the backing components needed arent there. The way the files end up in \System32 are via hardlinks. This should help answer another common question I see regarding how VSS is used in servicing. Short answer: It’s not. We use NTFS hardlinks to project the file to the file system from the component store. That’s why the \Winsxs directory is so important. The files there can be seen as the “authoritative” versions on the file system. When you encounter an issue and that binary needs to be replaced, running an SFC /SCANFILE against it will check the directories above and if the version doesnt match, it will re-project it so that its working.
===

意訳すると、
「コンポーネントストア(winsxs)はOSの修復のために必要だから削除できません。コンポーネントストア内にはいくつかのディレクトリがあるので、その役割を見てみましょう。
  1. \Winsxs\Catalogs: システム内のマニフェストごとのセキュリティカタログを含む
  2. \Winsxs\InstallTemp: インストール時の一時使用
  3. \Winsxs\Manifests: 特定のコンポーネントのマニフェスト
  4. \Winsxs\Temp: Tempディレクトリ、いろいろな用途に使われる
  5. \Winsxs\Backup: \Winsxs\Manifestsにあるファイルが壊れたときのためのバックアップ
  6. \Winsxs\Filemaps: ファイルの場所へのファイルシステムマッピング
  7. \Winsxs\: 特定のコンポーネントのペイロードで、通常はバイナリファイルがある

では、削除できるか?ええ、できます。何が起こる?場合によります。削除しても最初のうちは通常通り動いているように見えるでしょうが、バイナリのアップデートやサービスパックなどを当てようとしたときに、必要なファイルがそこにないからです。\system32にあるファイルはハードリンクなので。

だそうです。つまりはSystem32にあるファイルはwinsxs以下にあるファイルへのハードリンクなので、winsxs内のファイルを削除したあとで一見正常に動作しているように見えても、実はダメダメな状態になってしまっているよ、ということのようで。

でもアップデートされたあとの古いバージョンはちゃんと削除してほしいなぁ。

1 件のコメント:

  1. アップデート後の古いバージョンの削除
    DISM /Online /Cleanup-Image /StartComponentClenup /ResetBase

    返信削除

Windowsでシンボリックリンクを試してみる。

きっかけは、1つのファイルを別の名前で起動したら違う動きになるようなスクリプトを書く、でした。  busybox なんかでは、同じ実行形式ファイルの名前を、lsにすればlsと同じ、cpとすればcpと同じ動作をするようにしてますが、Pythonスクリプトでそれと同じように argv...