使用 GParted 或 USB 恢复 Ubuntu 22 启动分区

使用 GParted 或 USB 恢复 Ubuntu 22 启动分区

最近,我将一台 Windows 10 计算机格式化为 Ubuntu 22,并通过 USB 棒进行安装。这台计算机有两个存储磁盘(一个 2 TB 的 HDD 和一个 256 GB 的 SSD),我将 Ubuntu 安装在 SSD 上,并决定将 HDD 完全清空。

今天早些时候,我在 Ubuntu 中遇到了一些声音问题,我不记得以前在 Windows 中出现过这些问题,但为了仔细检查,我决定在空硬盘上创建一个 300 GB 的分区并在那里安装 Windows 10,看看错误是否也会发生在那里。

当我尝试从 USB 驱动器安装 Windows 10 时,我在安装的高级阶段遇到了错误(“Windows 无法准备计算机以启动到安装的下一阶段”),导致安装过程停止。我决定再试一次,以为我在过程的早期做错了什么,但后来我无法使用我之前尝试过的相同分区,因为它不再是空的,或者类似的东西(我忘记了 Windows 安装管理器输出的确切错误)。然后,使用 Windows 安装程序中的“分区管理器”,我清空了该分区以及 Windows 安装创建的一些其他分区(我只清空/删除了 2 TB HDD 中的分区,而 SSD 保持不变),然后尝试再次安装 Windows。我遇到了之前遇到的相同错误,并决定忘记安装 Windows。

接下来,当我再次打开电脑时,它直接启动到 BIOS 管理器,Ubuntu 22 分区没有列为启动选项之一。我决定使用 Ubuntu USB 棒来看看是否能了解可能出了什么问题,使用 GParted 我可以看到 SSD 仍然被识别但无法安装。以下是 GParted 的屏幕截图:

在此处输入图片描述

(“标签:Recuperação”的意思类似于“标签:恢复”)

当我双击 /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?

Failed to open '/dev/sdb1'.

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?

Unable to read the contents of this file system!
Because of this some operations may be unavailable.
The cause might be a missing software package.
The following list of software packages is required for ntfs file system support:  ntfs-3g / ntfsprogs.

我尝试使用 GParted“检查”工具修复此分区,但遇到同样的错误。

那么,我的问题是,如果可能的话,我如何使用 GParted 来恢复该分区,或者是否可以使用我之前安装时使用的相同的 Ubuntu 22 USB 记忆棒来恢复它。


编辑:BootInfo 摘要报告的链接:https://paste.ubuntu.com/p/BD3NcNSNv2/

============================== Boot Info Summary ===============================

 => No boot loader is installed in the MBR of /dev/sda.
 => No boot loader is installed in the MBR of /dev/sdb.

sda1: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  
    Boot files:        

sdb1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  According to the info in the boot sector, sdb1 has 
                       1083391 sectors, but according to the info from fdisk, 
                       it has 1048575 sectors.
    Mounting failed:   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 seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
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 seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

sdb2: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Ubuntu 22.04.3 LTS
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub

sdc: ___________________________________________________________________________

    File system:       iso9660
    Boot sector type:  Grub2 (v1.99-2.00)
    Boot sector info:  Grub2 (v1.99-2.00) is installed in the boot sector of 
                       sdc and looks at sector 0 of the same hard drive for 
                       core.img, but core.img can not be found at this 
                       location.
    Mounting failed:   mount: /mnt/BootInfo/FD/sdc: /dev/sdc already mounted or mount point busy.


================================ 1 OS detected =================================

OS#1:   Ubuntu 22.04.3 LTS on sdb2

================================ Host/Hardware =================================

CPU architecture: 64-bit
Video: Caicos [Radeon HD 6450/7450/8450 / R5 230 OEM] from Advanced Micro Devices, Inc. [AMD/ATI]
Live-session OS is Ubuntu 64-bit (Ubuntu 22.04.3 LTS, jammy, x86_64)

===================================== UEFI =====================================

BIOS/UEFI firmware: 2416(5.13) from American Megatrends Inc.
The firmware is EFI-compatible, and is set in EFI-mode for this live-session.
SecureBoot enabled according to mokutil - Please report this message to [email protected].
BootCurrent: 0001
Timeout: 1 seconds
BootOrder: 0001
Boot0001* UEFI: KingstonDT 101 G2 PMAP, Partition 2 PciRoot(0x0)/Pci(0x14,0x0)/USB(7,0)/HD(2,GPT,f45e2fa1-c5a6-4d79-876d-c8245af921e0,0x95f864,0x2754)..BO


============================= Drive/Partition Info =============================

Disks info: ____________________________________________________________________

sda : is-GPT,   no-BIOSboot,    has-noESP,  not-usb,    not-mmc, no-os, no-wind,    2048 sectors * 512 bytes
sdb : is-GPT,   no-BIOSboot,    has---ESP,  not-usb,    not-mmc, has-os,    no-wind,    2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

sda1    : no-os,    64, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   farbios
sdb1    : no-os,    64, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   not-far
sdb2    : is-os,    64, apt-get,    signed grub-pc grub-efi ,   grub2,  grub-install,   grubenv-ok, update-grub,    farbios

Partitions info (2/3): _________________________________________________________

sda1    : isnotESP, part-has-no-fstab,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sdb1    : is---ESP, part-has-no-fstab,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sdb2    : isnotESP, fstab-has-bad-efi,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot

Partitions info (3/3): _________________________________________________________

sda1    : maybesepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sdb1    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sdb
sdb2    : not--sepboot, with-boot,  fstab-without-boot, not-sep-usr,    with--usr,  fstab-without-usr,  std-grub.d, sdb

fdisk -l (filtered): ___________________________________________________________

Disk sda: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk identifier: 03A3614D-E623-4463-A1DF-B71987932D26
      Start        End    Sectors  Size Type
sda1   2048 3907028991 3907026944  1.8T Linux filesystem
Disk sdb: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk identifier: 6ABAEFB0-0832-477B-B7E2-5BA4DC728AFC
        Start       End   Sectors   Size Type
sdb1     2048   1050623   1048576   512M EFI System
sdb2  1050624 468860927 467810304 223.1G Linux filesystem
Disk sdc: 14.53 GiB, 15606349824 bytes, 30481152 sectors
Disk identifier: F45E2FA1-C5A6-4D79-876F-C8245AF921E0
        Start      End  Sectors  Size Type
sdc1       64  9828451  9828388  4.7G Microsoft basic data
sdc2  9828452  9838519    10068  4.9M EFI System
sdc3  9838520  9839119      600  300K Microsoft basic data
sdc4  9842688 30481088 20638401  9.8G Linux filesystem

parted -lm (filtered): _________________________________________________________

sda:2000GB:scsi:512:4096:gpt:ATA ST2000VX008-2E31:;
1:1049kB:2000GB:2000GB:ext4::;
sdb:240GB:scsi:512:512:gpt:ATA ADATA SU630:;
1:1049kB:538MB:537MB:ntfs:EFI System Partition:boot, esp;
2:538MB:240GB:240GB:ext4::;
sdc:15.6GB:scsi:512:512:gpt:Kingston DT 101 G2:;
1:32.8kB:5032MB:5032MB::ISO9660:hidden, msftdata;
2:5032MB:5037MB:5155kB::Appended2:boot, esp;
3:5037MB:5038MB:307kB::Gap1:hidden, msftdata;
4:5039MB:15.6GB:10.6GB:ext4::;

blkid (filtered): ______________________________________________________________

NAME   FSTYPE   UUID                                 PARTUUID                             LABEL                    PARTLABEL
sda                                                                                                                
└─sda1 ext4     36b4b1d0-800e-4932-9e84-16491804f34a b7d07aab-beda-4dc2-b71c-2f3aeb5e2151                          
sdb                                                                                                                
├─sdb1 ntfs     D00AC0220AC00784                     85f53d02-d29d-413a-8397-c54b128a3e06 Recuperação              EFI System Partition
└─sdb2 ext4     ef972d4e-1b30-4111-b572-f50a35263ee9 099e66d2-1e4b-42c2-adb5-8ecb24e810d0                          
sdc    iso9660  2023-08-08-01-19-05-00                                                    Ubuntu 22.04.3 LTS amd64 
├─sdc1 iso9660  2023-08-08-01-19-05-00               f45e2fa1-c5a6-4d79-876e-c8245af921e0 Ubuntu 22.04.3 LTS amd64 ISO9660
├─sdc2 vfat     F7DB-4D56                            f45e2fa1-c5a6-4d79-876d-c8245af921e0 ESP                      Appended2
├─sdc3                                               f45e2fa1-c5a6-4d79-876c-c8245af921e0                          Gap1
└─sdc4 ext4     205ad84b-7713-45f6-b896-559938e0d683 fd2e93c8-7e6b-1b42-abf1-6da693f5d375 writable                 

Mount points (filtered): _______________________________________________________

                                                              Avail Use% Mounted on
/dev/disk/by-label/writable[/install-logs-2023-11-08.1/crash]  9.1G   0% /var/crash
/dev/disk/by-label/writable[/install-logs-2023-11-08.1/log]    9.1G   0% /var/log
/dev/sda1                                                      1.7T   0% /mnt/boot-sav/sda1
/dev/sdb2                                                     56.9G  69% /media/ubuntu/ef972d4e-1b30-4111-b572-f50a35263ee9
/dev/sdc1                                                         0 100% /cdrom

Mount options (filtered): ______________________________________________________


====================== sdb2/boot/grub/grub.cfg (filtered) ======================

Ubuntu   ef972d4e-1b30-4111-b572-f50a35263ee9
Ubuntu, with Linux 6.2.0-36-generic   ef972d4e-1b30-4111-b572-f50a35263ee9
Ubuntu, with Linux 6.2.0-26-generic   ef972d4e-1b30-4111-b572-f50a35263ee9
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_uefi-firmware ###

========================== sdb2/etc/fstab (filtered) ===========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb2 during installation
UUID=ef972d4e-1b30-4111-b572-f50a35263ee9 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda2 during installation
UUID=2C42-47CD  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

======================= sdb2/etc/default/grub (filtered) =======================

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

==================== sdb2: Location of files loaded by Grub ====================

           GiB - GB             File                                 Fragment(s)
  61.855365753 = 66.416693248   boot/grub/grub.cfg                             1
  61.263824463 = 65.781530624   boot/vmlinuz                                   1
  84.021610260 = 90.217517056   boot/vmlinuz-6.2.0-26-generic                  1
  61.263824463 = 65.781530624   boot/vmlinuz-6.2.0-36-generic                  1
  84.021610260 = 90.217517056   boot/vmlinuz.old                               1
  81.831398010 = 87.865794560   boot/initrd.img                                1
  81.416347504 = 87.420137472   boot/initrd.img-6.2.0-26-generic               1
  81.831398010 = 87.865794560   boot/initrd.img-6.2.0-36-generic               1
  81.416347504 = 87.420137472   boot/initrd.img.old                            1

===================== sdb2: ls -l /etc/grub.d/ (filtered) ======================

-rwxr-xr-x 1 root root 18683 Dec 18  2022 10_linux
-rwxr-xr-x 1 root root 43031 Dec 18  2022 10_linux_zfs
-rwxr-xr-x 1 root root 14387 Dec 18  2022 20_linux_xen
-rwxr-xr-x 1 root root 13369 Dec 18  2022 30_os-prober
-rwxr-xr-x 1 root root  1372 Dec 18  2022 30_uefi-firmware
-rwxr-xr-x 1 root root   700 May 17 05:35 35_fwupd
-rwxr-xr-x 1 root root   214 Dec 18  2022 40_custom
-rwxr-xr-x 1 root root   215 Dec 18  2022 41_custom

mount -t ntfs-3g -o remove_hiberfile /dev/sdb1 /mnt/boot-sav/sdb1 
mount -t ntfs-3g -o remove_hiberfile /dev/sdb1 /mnt/boot-sav/sdb1 


Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub-efi-amd64-signed of
sdb2,
using the following options:  sdb1/boot/efi
Additional repair would be performed: unhide-bootmenu-10s use-standard-efi-file

Final advice in case of suggested repair: ______________________________________

Please do not forget to make your UEFI firmware boot on the Ubuntu 22.04.3 LTS entry (sdb1/efi/****/shim****.efi (**** will be updated in the final message) file) !

编辑 2:我尝试运行推荐的修复,但没有成功,提示“NVram 已锁定(在 efibootmgr 中未找到 Ubuntu)”。以下是修复 pastebin:https://paste.ubuntu.com/p/vWXJZQMdZN

在我无知的眼睛看来,为什么 EFI 系统分区是 ntfs 似乎很奇怪,因为我不认为我在安装 Ubuntu 时它是 ntfs。它可能因为某种原因被“转换”为 ntfs 吗?还是我只是弄错了,ntfs 是正常的?请注意,这次我没有尝试重新安装 Windows。


编辑3:这是运行的结果sudo fdisk /dev/sdb -l

Disk /dev/sdb: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk model: ADATA SU630     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 6ABAEFB0-0832-477B-B7E2-5BA4DC728AFC

Device       Start       End   Sectors   Size Type
/dev/sdb1     2048   1050623   1048576   512M EFI System
/dev/sdb2  1050624 468860927 467810304 223.1G Linux filesystem

相关内容