以下运行流程是解决磁盘有问题的 WSL 实例(Ubuntu),借助没用的另一个实例(Debian)

其中,文件路径为 Ubuntu 的磁盘路径

查看所有安装的 WSL 实例

 wsl -l -v
输出

NAME STATE VERSION

Ubuntu Stopped 2

Debian Stopped 2

关闭所有实例

 wsl --shutdown

使用另一个实例(Debian)挂载有问题的磁盘文件

 wsl -d Debian --mount "C:\Users\yjc\AppData\Local\wsl\{a6f80b81-889d-48d4-8a89-4e5807985fe7}\ext4.vhdx" --vhd --bare
输出

操作成功完成。

查看有哪些盘

 wsl -d Debian lsblk
输出

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sda 8:0 0 388.4M 1 disk

sdb 8:16 0 186M 1 disk

sdc 8:32 0 8G 0 disk [SWAP]

sdd 8:48 0 1T 0 disk

sde 8:64 0 1T 0 disk /mnt/wslg/distro

修复

 wsl -d Debian fsck /dev/sdd
输出

fsck from util-linux 2.36.1

e2fsck 1.46.2 (28-Feb-2021)

One or more block group descriptor checksums are invalid. Fix<y>? yes

Group descriptor 4919 checksum is 0x92b3, should be 0x297d. FIXED.

Group descriptor 5014 checksum is 0xfb90, should be 0x5638. FIXED.

Group descriptor 5086 checksum is 0xd88a, should be 0x722e. FIXED.

Group descriptor 6269 checksum is 0x6f39, should be 0xe94b. FIXED.

Group descriptor 6707 checksum is 0x1e29, should be 0x2712. FIXED.

Group descriptor 7793 checksum is 0xb3de, should be 0xd388. FIXED.

Group descriptor 7801 checksum is 0x34f0, should be 0x8fe5. FIXED.

Group descriptor 7865 checksum is 0x5474, should be 0xc730. FIXED.

Group descriptor 8033 checksum is 0xf6ff, should be 0x373e. FIXED.

Pass 1: Checking inodes, blocks, and sizes

Pass 2: Checking directory structure Directory inode 39994, block #0: directory passes checks but fails checksum. Fix<y>? yes

Pass 3: Checking directory connectivity

Pass 4: Checking reference counts

Pass 5: Checking group summary information

Padding at end of inode bitmap is not set. Fix<y>? yes

Block bitmap differences: Group 4919 block bitmap does not match checksum.

FIXED.

/dev/sdd: * FILE SYSTEM WAS MODIFIED *

/dev/sdd: 101409/67108864 files (0.2% non-contiguous), 5603420/268435456 blocks

取消挂载

 wsl -d Debian --unmount "C:\Users\yjc\AppData\Local\wsl\{a6f80b81-889d-48d4-8a89-4e5807985fe7}\ext4.vhdx"
输出

操作成功完成。