0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

wsl2の仮想ディスクのサイズを最適化する

Last updated at Posted at 2025-07-11

背景

仮想ディスク最適化の記事は複数あったが、環境が原因なのか上手く行かなかった。ただ、参照リンクの記事だと上手くいったので、また最適化するとき無くさないようにここに残します。

環境

  • Windows11
  • Optimize-VHD なし

実行

  1. wsl --shutdown で wsl を終了
  2. diskpart で DiskPart を起動
  3. DiskPart で下記コマンドを実行
DISKPART> select vdisk file="C\Users\{dir_path}\ext4.vhdx"
DISKPART> attach vdisk readonly
DISKPART> compact vdisk
DISKPART> detach vdisk
DISKPART> exit

これでWSL2の対象の仮想ディスクサイズが減りました。

参照リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?