通过 WSL 删除 Linux 系统的 Windows 启动项
在 PowerShell 查询磁盘信息
# 查看物理磁盘信息
Get-PhysicalDisk | Format-Table
# 列出磁盘分区(示例 DiskNumber=1)
Get-Partition -DiskNumber 1
挂载 Linux 分区到 WSL
# 假设 Linux 分区是 Disk 1 Partition 4
wsl --mount \\.\PHYSICALDRIVE1 --partition 4 --type ext4
# 成功后,挂载路径一般是:
cd /mnt/wsl/PHYSICALDRIVE1p4
挂载虚拟文件系统以支持 chroot
mount --bind /dev /mnt/wsl/PHYSICALDRIVE1p4/dev
mount --bind /dev/pts /mnt/wsl/PHYSICALDRIVE1p4/dev/pts
mount --bind /proc /mnt/wsl/PHYSICALDRIVE1p4/proc
mount --bind /sys /mnt/wsl/PHYSICALDRIVE1p4/sys
mount --bind /run /mnt/wsl/PHYSICALDRIVE1p4/run
进入 chroot 环境
chroot /mnt/wsl/PHYSICALDRIVE1p4 /bin/bash
修改 GRUB 配置,禁止 os-prober 检测其他系统:
nano /etc/default/grub
# 找到:
# GRUB_DISABLE_OS_PROBER=false
# 修改为:
GRUB_DISABLE_OS_PROBER=true
# 保存并退出
更新 GRUB 配置
update-grub
输出示例:
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Windows 启动项已被排除
Ubuntu 内核和 Memtest 保留
退出 chroot 并卸载虚拟文件系统
exit
umount /mnt/wsl/PHYSICALDRIVE1p4/dev/pts
umount /mnt/wsl/PHYSICALDRIVE1p4/dev
umount /mnt/wsl/PHYSICALDRIVE1p4/proc
umount /mnt/wsl/PHYSICALDRIVE1p4/sys
umount /mnt/wsl/PHYSICALDRIVE1p4/run
卸载磁盘
wsl --unmount \\.\PHYSICALDRIVE1
完成后重启 Ubuntu 系统,GRUB 菜单中只显示 Linux 内核启动项,不再显示 Windows。