我正在尝试访问外部 SSD(USB 3.0)。但 Ubuntu 无法挂载它。
它显示在鹦鹉螺,但是当我单击它时,我收到消息“操作已处于待处理状态”。
当我做fdisk -l,虽然花费了很多功夫,但最终还是找到了:
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sdb: 238,49 GiB, 256060514304 bytes, 500118192 sectors
Disk model: RTL9210 NVME
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 16384 bytes
I/O size (minimum/optimal): 16384 bytes / 16384 bytes
Disklabel type: gpt
Disk identifier: #########
Device Start End Sectors Size Type
/dev/sdb1 2048 1050623 1048576 512M EFI System
/dev/sdb2 1050624 500117503 499066880 238G Linux filesystem
当我做sudo mount -t ext4 /dev/sdb2 /media/mydisk,它一直挂了很长时间才给出消息can’t read superblock
。
如果我尝试分开,将发生以下情况:
$ sudo parted /dev/sdb
Warning: Error fsyncing/closing /dev/sdb1: Input/output error
Retry/Ignore? i
Warning: Error fsyncing/closing /dev/sdb2: Input/output error
Retry/Ignore? i
Error: Error initialising SCSI device /dev/sdb - No such device
Ignore/Cancel? i
Error: Could not stat device /dev/sdb - No such file or directory.
Retry/Cancel? c
Warning: Error fsyncing/closing /dev/sdb: Input/output error
Retry/Ignore? i
并且所有 USB 端口停止工作。
以下是我尝试时发生的情况磁盘分区:
$ sudo gdisk /dev/sdc
GPT fdisk (gdisk) version 1.0.5
Warning! Read error 5; strange behavior now likely!
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! Error 5 reading partition table for CRC check!
Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Command (? for help): p
Disk /dev/sdc: 500118192 sectors, 238.5 GiB
Model: RTL9210 NVME
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): ########
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 500118158
Partitions will be aligned on 2048-sector boundaries
Total free space is 2669 sectors (1.3 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00 EFI System Partition
2 1050624 500117503 238.0 GiB 8300
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdc.
Unable to save backup partition table! Perhaps the 'e' option on the experts'
menu will resolve this problem.
Warning! An error was reported when writing the partition table! This error
MIGHT be harmless, or the disk might be damaged! Checking it is advisable.
Command (? for help):
但磁盘仍然无法工作。
当我尝试使用克隆分区时日,我得到:
$ time sudo dd if=/dev/sdc1 of=/media/N/ssd.img
dd: error reading '/dev/sdc1': Input/output error
176680+0 records in
176680+0 records out
90460160 bytes (90 MB, 86 MiB) copied, 9,92451 s, 9,1 MB/s
real 0m12,017s
user 0m0,237s
sys 0m1,429s
并且所有 USB 端口停止工作。
当尝试安装时视窗(使用 ext4 的专用工具),我能够看到我的文件,所以我猜硬件没有问题。
答案1
我无法恢复硬件,但我能够复制所有数据。以下是我所做的:
- 在视窗,我安装了一个名为Linux 阅读器。
- 我打开了Linux 阅读器,找到我的分区并在外部硬盘中创建了它的映像(右键单击分区即可查看此选项)。
- 回到Linux,我能够使用磁盘分区:
(关于第 1 步和第 2 步的建议:如果你能够使用 dd 制作图像在 Linux 上,请这样做)。
首先,我尝试山图像。列出分区后得到:
$ sudo sfdisk -d SSD.img
label: gpt
label-id: ####
device: SSD.img
unit: sectors
first-lba: 34
last-lba: 500118158
SSD.img : start= 2048, size= 1048576, (...)
SSD.img : start= 1050624, size= 499066880, (...)
我想要挂载的分区从 1050624 开始,所以我必须给出一个偏移量 1050624*512=537919488:
$ sudo mount -o loop,offset=537919488 SSD.img /media/ssd
mount: /media/us: wrong fs type, bad option, bad superblock on /dev/loop19, missing codepage or helper program, or other error.
这不起作用,所以我继续尝试恢复磁盘映像。
我对分区表进行了备份(以防万一):
$ sudo sfdisk -d SSD.img > pt.txt
然后我跑了磁盘分区并按下p
:
$ sudo gdisk SSD.img
GPT fdisk (gdisk) version 1.0.5
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk SSD.img: 500118192 sectors, 238.5 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): ##########
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 500118158
Partitions will be aligned on 2048-sector boundaries
Total free space is 2669 sectors (1.3 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00 EFI System Partition
2 1050624 500117503 238.0 GiB 8300
由于一切看起来都正常,我按下w
(请参阅 gdisk 手册以了解这些选项):
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to SSD.img.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
然后我就可以安装该图像了。
建议:除非您知道自己在做什么,否则不要做任何事情。花点时间研究或打电话给专业人士。务必备份所有重要数据。