使用GParted或U盘恢复Ubuntu 22启动分区的方法求助
我最近把一台Windows 10电脑格式化后装了Ubuntu 22,用U盘安装的——这台电脑有两块硬盘:2TB HDD和256GB SSD,我把Ubuntu装在了SSD上,HDD全程留空没动。
之前Ubuntu突然出现了声音问题,为了对比验证是不是系统本身的问题,我打算在空的HDD上创建300GB分区装Windows 10,看看同样的硬件下Windows会不会有同款错误。结果安装Windows时在后期突然报错:
"Windows could not prepare the computer to boot into the next phase of installation"
安装直接终止了。我以为是操作失误,重新尝试时发现之前创建的分区没法用了,于是用Windows安装器自带的分区工具,把HDD上所有Windows自动生成的分区都删掉(全程没碰SSD上的Ubuntu分区),再次安装还是弹出同样的错误,我索性放弃了装Windows的想法。
结果重启电脑时,直接进了BIOS界面,Ubuntu的启动选项完全消失了。我赶紧用之前的Ubuntu安装U盘启动,想用GParted排查问题:能识别到SSD,但SSD上的分区没法挂载。尤其是原EFI分区/dev/sdb1,双击查看详情时弹出一堆错误:
Warning:
Failed to read last sector (1083390): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
or it was not setup correctly (e.g. by not using mdadm --build ...),
or a wrong device is tried to be mounted,
or the partition table is corrupt (partition is smaller than NTFS),
or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/sdb1': Invalid argument
The device '/dev/sdb1' doesn't have a valid NTFS.
Maybe you selected the wrong device? Or the whole disk instead of a
partition (e.g. /dev/hda, not /dev/hda1)? Or the other way around?
用GParted的「检查」工具尝试修复这个分区,结果还是弹出同样的错误。现在我想请教:有没有办法用GParted或者Ubuntu安装U盘恢复这个分区,让Ubuntu能正常启动?
BootInfo工具生成的关键摘要
=> No boot loader is installed in the MBR of /dev/sda. => No boot loader is installed in the MBR of /dev/sdb. # sdb1(原EFI分区)信息 File system: ntfs Boot sector type: Windows 8/10/11/2012: NTFS Boot sector info: 分区引导扇区显示sdb1有1083391个扇区,但fdisk显示只有1048575个扇区 Mounting failed: (错误信息和上面一致) # sdb2(Ubuntu系统分区)信息 File system: ext4 Operating System: Ubuntu 22.04.3 LTS Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub # UEFI相关信息 BIOS/UEFI firmware: 2416(5.13) from American Megatrends Inc. SecureBoot已启用 BootCurrent: 0001(当前仅U盘启动项) BootOrder: 0001(无其他启动项) # 分区结构 /dev/sdb1: 512M,类型标记为EFI System,但文件系统是ntfs(我记得装Ubuntu时这里应该是vfat,这点特别奇怪) /dev/sdb2: 223.1G,ext4,Ubuntu系统分区 # fstab配置 UUID=ef972d4e-1b30-4111-b572-f50a35263ee9 / ext4 errors=remount-ro 0 1 UUID=2C42-47CD /boot/efi vfat umask=0077 0 1 /swapfile none swap sw 0 0
后续尝试的操作
- 用Boot-Repair工具运行推荐的修复方案,结果失败,提示:"NVram is locked (Ubuntu not found in efibootmgr)"
- 执行
sudo fdisk /dev/sdb -l确认分区结构,sdb1确实是EFI类型,但文件系统显示为ntfs
额外疑问
为什么原来的EFI分区会变成ntfs?会不会是Windows安装过程中被篡改了?这会不会是导致Ubuntu启动项消失的核心原因?
备注:内容来源于stack exchange,提问作者dhersz

