3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

WSLのイメージ(ext4.vhdx)が肥大化した時の対処

Posted at

手順

※1,2の作業はなくてもよいかもしれない。不要かどうかは今後確認。

  1. VM内で次のコマンドを実行してディスクがいっぱいになるまで、内容0のファイルを作成する
    dd if=/dev/zefo of=/tmp/zero.img bs=1M

  2. Disk Fullになったら/tmp/zero.imgを削除

  3. vhdxの場所を確認。
     参考 https://qiita.com/neko_the_shadow/items/ae87b2480345152bc3cb

  4. vhdxを最適化する
     参考 https://blackbird-blog.com/optimize-vhd-01

vhdxの場所を確認

PS C:\Users\masat> Get-AppxPackage -Name "*Ubuntu*" | Select PackageFamilyName

PackageFamilyName
-----------------
CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc

Win+Rキーを押して、 %LOCALAPPDATA% と入力する

Packages の中の
PackageFamilyName(↑で調べたCanonical~~)の中の
LocalState にext4.vhdxがある

このファイルにoptimaize-vhdを実行する

最適化

PS C:\Users\masat> optimize-vhd C:\Users\masat\AppData\Local\Docker\wsl\data\ext4.vhdx -Mode Full
PS C:\Users\masat>

 

3
1
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?