我的 32 Gb ssd 被划分为 8 Gb 和 29 Gb。我使用 dd 将 ubuntu iso 写入我的 pendrive,但不小心将其写入了我的 ssd 的 8 gb 分区。现在 gparted 没有显示那个 8 Gb 分区。我该如何恢复它??命令是dd if=path_to_iso of=/dev/sdb
sdb 是 ssd 输出sudo fdisk -l
是:
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xb367fbf3
` Device Boot Start End Blocks Id System
/dev/sda1 1 976773167 488386583+ ee GPT
Partition 1 does not start on physical sector boundary. `
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdb: 32.0 GB, 32017047552 bytes
255 heads, 63 sectors/track, 3892 cylinders, total 62533296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x01a1f343
` Device Boot Start End Blocks Id System `
并且输出为df -h
:
Filesystem Size Used Avail Use% Mounted on
/dev/sda7 303G 8.3G 280G 3% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 2.9G 4.0K 2.9G 1% /dev
tmpfs 594M 1.2M 593M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.9G 288K 2.9G 1% /run/shm
none 100M 44K 100M 1% /run/user
的输出sudo parted -l
是:
Model: ATA ST500LT012-9WS14 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 525MB 524MB fat32 EFI system partition boot
2 525MB 567MB 41.9MB fat32 Basic data partition hidden
3 567MB 701MB 134MB Microsoft reserved partition msftres
4 701MB 1215MB 514MB ntfs Basic data partition hidden, diag
5 1215MB 153GB 152GB ntfs Basic data partition msftdata
7 153GB 484GB 331GB ext4
8 484GB 489GB 5243MB linux-swap(v1)
6 489GB 500GB 11.0GB ntfs Microsoft recovery partition hidden, diag
Model: ATA LITEONIT LMS-32L (scsi)
Disk /dev/sdb: 32.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
我无意中忘记放 sdb1
sudo parted /dev/sdb print free
得到:
Model: ATA LITEONIT LMS-32L (scsi)
Disk /dev/sdb: 32.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
32.3kB 32.0GB 32.0GB Free Space
gparted 显示 29 gb 未分配
答案1
好的,你的dd
命令已经覆盖了你的分区表。当你指定一个没有数字的 dev 名称(例如/dev/sdb
)时,它指的是全部的磁盘,而不是特定分区。因此,当您运行 时dd if=path_to_iso of=/dev/sdb
,您会将映像直接复制到磁盘并破坏 GPT 头文件。
你通缉运行是:
dd if=path_to_iso of=/dev/sdb2
您可能能够从中恢复,但不能保证。如果您幸运的话,您将存储一个备份 GPT 表。如果是这样,gdisk
也许可以拯救您。尝试
gdisk /dev/sdb
你应该看到类似这样的行
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.
****************************************************************************
细节会有所不同,但应该会出现类似的消息。如果你幸运的话,gdisk
会自动修复所有问题。如果没有,请参阅这里了解更多信息。