当传统工具无法工作时如何修复分区(MBR/DOS)的对齐方式?

当传统工具无法工作时如何修复分区(MBR/DOS)的对齐方式?

注意:下面的一些输出来自 Windows 10,但问题仍然是如何纠正阻止 Linux 挂载所述分区的问题。

问:当传统的 Linux 工具无法工作时如何修复分区的对齐问题?

我遇到了一个有趣的问题。我可以从 Windows 10(1903 和 1809)轻松访问的磁盘无法被 Linux Mint(19.2)、另一个 Ubuntu 18.04 或从 CD 启动的 PartedMagic 识别。

相应的软件包已安装,我从其他驱动器挂载 NTFS 分区。然而,自动安装程序和我明确尝试时都无法识别这一点mount

同样奇怪的是,Paragon Hard Disk Manager 15(基于 Linux 的救援介质)和 16(从 Windows 运行)以及 PartedMagic(即:gparted)等工具无法正确识别分区。

diskpart在 Windows 10 上向我展示:

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary            931 GB  1024 KB

该磁盘使用 MBR/DOS 分区表进行初始化,因为我想我想要最好的兼容性,并且它足够小,可以不用 GPT。

这个偏移对我来说似乎有点奇怪,但据我所知,在尝试挂载卷(分区)时,这通常是 Windows 的问题,而不是 Linux 的问题。

但是Paragon Hard Disk Manager 16,从Windows 10运行报告此事

Paragon Hard Disk Manager™ 发现此分区存在问题。它一定是由不正确的几何形状引起的。为了解决问题,请收集日志文件并将其发送给我们的支持团队

它还报告(与上一条消息结合):

Invalid partition

HDD number: 2
Partition number: 0

                               Sector No:        | Cyl:   | Hd: | Sec:
-------------------------------------------------|--------|-----|-----
First physical sector: | 0x800 (2048)            | 0      | 32  | 33
Last physical sector:  | 0x74705FFF (1953521663) | 121601 | 25  | 24
Hard disk geometry:    |                         | 121597 | 255 | 63

因此,对齐或与其相关的东西可能是这里的一个问题。

DISKPART> detail disk

ZALMAN ZM-VE500 USB Device
Disk ID: XXXXXXXX
Type   : USB
Status : Online
Path   : 0
Target : 0
LUN ID : 0
Location Path : UNAVAILABLE
Current Read-only State : No
Read-only  : No
Boot Disk  : No
Pagefile Disk  : No
Hibernation File Disk  : No
Crashdump Disk  : No
Clustered Disk  : No

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 1     D   XXXXXX.1TB   NTFS   Partition    931 GB  Healthy
DISKPART> select volume=1

Volume 1 is the selected volume.

DISKPART> detail volume

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
* Disk 2    Online          931 GB      0 B

Read-only              : No
Hidden                 : No
No Default Drive Letter: No
Shadow Copy            : No
Offline                : No
BitLocker Encrypted    : No
Installable            : Yes

Volume Capacity        :  931 GB
Volume Free Space      :   58 GB

因此,我还可以从安装情况看出,Windows 10 似乎对分区的现状非常满意。

那么,当我尝试过的基于 Linux 的工具失败时,我该如何修复与 Linux 更容易理解的东西的一致性呢?

这似乎是第 22 条军规的情况,因为到目前为止我尝试过的工具(gdisk、gparted/parted、sfdisk/cfdisk、fdisk)在各个阶段都失败了。有些报告损坏的 GPT,其他则没有指出任何问题,但不提供在不丢失数据(或无关复制)的情况下移动/调整分区大小所需的操作。

请注意:这里的重点不是避免由于没有(其他)备份而导致的数据丢失,而是避免长时间复制已存在的数据。是的,我认为等待答案可能比复制到临时存储、修复分区然后将内容复制回来要花更长的时间。然而,在分区和分区对齐方面,我从来没有遇到过像这样让我失望的 Linux 工具,所以我很好奇如何纠正这个问题,而不必诉诸无关的复制。


下面是各种工具的输出。的输出ntfsinfo与尝试挂载所述分区时的输出相同:

$ sudo fdisk -l /dev/sdc
Disk /dev/sdc: 931.5 GiB, 1000172421120 bytes, 1953461760 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
Disklabel type: dos
Disk identifier: 0x5c742dd9

Device     Boot Start        End    Sectors   Size Id Type
/dev/sdc1        2048 1953521663 1953519616 931.5G  7 HPFS/NTFS/exFAT


$ sudo sfdisk -X dos /dev/sdc

Welcome to sfdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Checking that no-one is using this disk right now ... OK

Disk /dev/sdc: 931.5 GiB, 1000172421120 bytes, 1953461760 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
Disklabel type: dos
Disk identifier: 0x5c742dd9

Old situation:

Device     Boot Start        End    Sectors   Size Id Type
/dev/sdc1        2048 1953521663 1953519616 931.5G  7 HPFS/NTFS/exFAT

Type 'help' to get more information.

$ sudo ntfsinfo -m /dev/sdc1
Failed to read last sector (1953519614): 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/sdc1': Invalid argument
The device '/dev/sdc1' 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/sdc1'.

$ sudo gdisk /dev/sdc
GPT fdisk (gdisk) version 1.0.3

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


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************


Command (? for help): p
Disk /dev/sdc: 1953525168 sectors, 931.5 GiB
Model: USB3.0          
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): DCB1968C-54AE-4EBB-9FD8-3899FAF16767
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 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 5485 sectors (2.7 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      1953521663   931.5 GiB   0700  Microsoft basic data

相关内容