将部分格式化的硬盘从 FAT 恢复为 NTFS

将部分格式化的硬盘从 FAT 恢复为 NTFS

我对新磁盘(2TB Buffalo)进行了部分格式化,我打算将其从 FAT 格式化为 NTFS(很可能是新磁盘的文件格式)。然而,我不小心拔掉了电缆。自新磁盘以来,那里没有重要文件。我只能看到磁盘连接 /dev/disk/ 但在系统 GUI 中看不到。

我知道这个回答。我跑

ls -la /dev/disk/by-id/usb-BUFFALO_HD-PNFU3_0000000300001199-0\:0
lrwxrwxrwx 1 root root 9 Jul 10 22:59 /dev/disk/by-id/usb-BUFFALO_HD-PNFU3_0000000300001199-0:0 -> ../../sdb

testdisk /debug /dev/disk/by-id/usb-BUFFALO_HD-PNFU3_0000000300001199-0\:0

photorec /debug /dev/sdb

并没有得到任何相关的结果。

运行 Jodka 的命令

/dev/sdb是正确的位置,因为 Buffalo 磁盘为 2TB:

lsblk /dev/sdb
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb    8:16   0  1.8T  0 disk 

并运行wipefs命令但发现选项不存在:

$ wipefs -fv /dev/sdb 
wipefs: invalid option -- 'v'

Usage:
 wipefs [options] <device>

Options:
 -a, --all           wipe all magic strings (BE CAREFUL!)
 -b, --backup        create a signature backup in $HOME
 -f, --force         force erasure
 -h, --help          show this help text
 -n, --no-act        do everything except the actual write() call
 -o, --offset <num>  offset to erase, in bytes
 -p, --parsable      print out in parsable instead of printable format
 -q, --quiet         suppress output messages
 -t, --types <list>  limit the set of filesystem, RAIDs or partition tables
 -V, --version       output version information and exit

版本是wipefs from util-linux 2.25.2.

运行最后两个命令

$ sudo mkfs.ntfs -f /dev/sdb
/dev/sdb is entire device, not just one partition.
Refusing to make a filesystem here!
$ sudo mkfs.ntfs -f /dev/sdb1
Failed to access '/dev/sdb1': No such file or directory
The device doesn't exist; did you specify it correctly?

我仍然看不到任何内容,ls /media/masi/因此磁盘无法使用。

运行 Jodka 的补充

我没有看到磁盘/媒体/马西/在这些命令之后:

$ sudo wipefs -fa /dev/sdb
$ ls /media/masi/

$sudo wipefs -fa /dev/sdb1
wipefs: error: /dev/sdb1: probing initialization failed: No such file or directory

为什么要在 /dev/sdb1 中运行最后一个命令?我没有这样的光盘。该命令ls /dev/sd*仅给出/dev/sda /dev/sda1 /dev/sda2 /dev/sda5 /dev/sdb.

再次运行最后的命令

sudo gdisk /dev/sdb 
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): x

Expert command (? for help): z
About to wipe out GPT on /dev/sdb. Proceed? (Y/N): Y
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): Y
$ sudo dd if=/dev/zero of=/dev/sdb bs=4M count=10
10+0 records in
10+0 records out
41943040 bytes (42 MB) copied, 1.62512 s, 25.8 MB/s
$ sudo gdisk /dev/sdb 
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): n
Partition number (1-128, default 1): 
First sector (34-3907029134, default = 2048) or {+-}size{KMGTP}: 
Last sector (2048-3907029134, default = 3907029134) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

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/sdb.
The operation has completed successfully.
$ ls /media/masi/
$ mkfs.ntfs -f /dev/sdb
sdb   sdb1  
$ sudo mkfs.ntfs -f /dev/sdb
/dev/sdb is entire device, not just one partition.
Refusing to make a filesystem here!
$ sudo mkfs.ntfs -f /dev/sdb1
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
$ ls /media/masi/

我终于通过运行最后让光盘工作了

$sync
// disconnect the cable and put back
$ls /media/masi/
7935137E18608463

如何恢复NTFS部分格式化的磁盘?

答案1

我了解,您没有想要保留的文件。

可以肯定的是,您正在运行正确的硬盘lsblk来列出所有连接的驱动器。

我会首先使用wipefs:

wipefs -a /dev/sdb1wipefs -a /dev/sdb

然后启动gdisk /dev/sdb并按x然后z擦除 mbr 和 gpt。

也许将第一个兆字节归零:

dd if=/dev/zero of=/dev/sdb bs=4M count=10

然后根据大小启动 fdisk(对于旧的 mbr)或 gdisk(对于现代的 gpt)并创建新分区。

gdisk /dev/sdb-> n-> ENTER -> ENTER -> ENTER ->0700对于类型 0x0700(Microsoft 基本数据) ->w写入磁盘

或者

fdisk /dev/sdb-> n-> p-> 1-> 输入 -> 输入;t->7对于类型 0700 Microsoft 基本数据 ->w写入磁盘

然后格式化它

mkfs.ntfs -f /dev/sdb1

答案2

您可以将驱动器清零

dd if=/dev/zero of=/dev/sdb bs=1M

确保/dev/sdb确实是正确的设备名称!

相关内容