无法在来自 USB 硬盘盒的硬盘上安装分区

无法在来自 USB 硬盘盒的硬盘上安装分区

我将 Linux Centos 客户机和 ESXI 5 上运行的 Windows 客户机的大量数据备份到安装在 USB 外壳内的 1TB 硬盘。 USB 外壳通过 ESXI 5 虚拟机管理程序直接连接到来宾。
完成数据复制后,我正确地断开了 USB 磁盘的连接,重新格式化了服务器并升级到在 Centos 发行版上运行的 KVM 管理程序。
然后,我创建了一个 Linux Centos 客户机,并通过 KVM 管理程序将 USB 磁盘直接连接到它。将数据从 linux 分区复制回 guest 虚拟机没有问题。复制后我正确地断开了磁盘连接。

现在,过了一段时间,我将同一个磁盘原封不动地放入带有 LSI raid 控制器的 IBM x3200 M3 服务器中,以便从原始 Linux 备份中检索一些数据。磁盘配置为单个设备,无 RAID。
IBM 上运行的 Centos Linux 可以正确地看到该磁盘。
fdisk 正确显示 2 个分区:

 fdisk -l /dev/sda

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 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 label type: dos
Disk identifier: 0x7ca397d5

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63   128005919    64002928+   7  HPFS/NTFS/exFAT
/dev/sda2       128006144   244190645    58092251   83  Linux

gdisk 也是如此:

gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.10

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.
***************************************************************

Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 8AE1EC87-71EF-4340-8D94-E0EFC30FB4E4
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 8-sector boundaries
Total free space is 1709334742 sectors (815.1 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              63       128005919   61.0 GiB    0700  Microsoft basic data
   2       128006144       244190645   55.4 GiB    8300  Linux filesystem

尽管如此,我无法安装第二个分区(这里没有 Windows,所以我没有尝试使用第一个分区)。
错误信息是:

mount /dev/sda2 /mnt/usb/
mount: /dev/sda2 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/sda2,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

尝试使用 -o ro 选项挂载只读不会改变结果。

尝试 fsck 会得到以下结果:

[root@localhost ~]# fsck -N /dev/sda2
fsck from util-linux 2.23.2
[/sbin/fsck.ext2 (1) -- /dev/sda2] fsck.ext2 /dev/sda2

[root@localhost ~]# fsck.ext4 -n /dev/sda2
e2fsck 1.42.9 (28-Dec-2013)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/sda2

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>

答案1

这可能几乎是重复的这另一个问题。请阅读我的回答以了解可能发生的情况。几乎,因为我不会怀疑报告物理扇区大小为 512 的磁盘存在类似问题。

因此,RAID 控制器现在可能会扭曲这些值;也许 USB 外壳会像另一个问题一样产生干扰;也许 ESXI 做了一些翻译。我不知道。

无论如何,我怀疑它大约是 512 与 4096。在这种情况下,您应该尝试在 4096 字节扇区中计算时偏移量(起始扇区)是否有效。

在我们开始执行实际命令之前,请注意最后一个分区的结束扇区是一个巨大的线索。磁盘现在报告 1953525168 个 512 字节的逻辑扇区,但如果扇区为 4096 字节,则有 244190646 个(即少 8 倍)扇区,编号从 0 到 244190645。244190645 正是最后一个分区的结束扇区,因此很可能是这个分区表中的条目对于 4096 字节扇区有效。

尝试这个:

mount -o ro,offset=$((128006144*4096)) /dev/sda /some/mountpoint

ro以防万一。

相关内容