从 USB 外壳移至内部时无法安装 SATA 驱动器

从 USB 外壳移至内部时无法安装 SATA 驱动器

我已经将 4 个外部驱动器通过 USB 连接到我的 Dell Precision 490 工作站。

它们位于 /etc/fstab 中,以 uuid 形式存在,并且格式化为 UUID。

UUID=04c37bff-b93e-440e-acd0-3d984ddb2ec3 /mnt/drive0 ext4 defaults,nobootwait 0 2
UUID=210765f4-30e5-4863-a40b-aa1fffefe5ca /mnt/drive1 ext4 defaults,nobootwait 0 2
UUID=b981c5e7-249e-4430-9887-96ca674e0733 /mnt/drive2 ext4 defaults,nobootwait 0 2
UUID=22c8a274-3cf9-403f-9558-feb531e407c7 /mnt/drive3 ext4 defaults,nobootwait 0 2

我把三个驱动器放进去,但只有一个自动安装(驱动器 3,驱动器 2 仍然外部连接)

$ mount | grep /dev/sd
/dev/sdc1 on /boot type ext2 (rw)
/dev/sdb1 on /mnt/drive3 type ext4 (rw)
/dev/sdf1 on /mnt/drive2 type ext4 (rw)

但它们都出现了:

$ 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: 120.0 GB, 120034123776 bytes
<snip>

Disk /dev/sdb: 5001.0 GB, 5000981078016 bytes
255 heads, 63 sectors/track, 608001 cylinders, total 9767541168 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: 0xdd494cbf

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdd: 5001.0 GB, 5000981078016 bytes
42 heads, 62 sectors/track, 3750975 cylinders, total 9767541168 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: 0xec15dda8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1             256  1220942644   610471194+  83  Linux

Disk /dev/sde: 5001.0 GB, 5000981078016 bytes
255 heads, 63 sectors/track, 608001 cylinders, total 9767541168 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: 0x4cd5215a

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1              63  1220942644   610471291   83  Linux
Partition 1 does not start on physical sector boundary.

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
<snip>

Disk /dev/sdf: 5001.0 GB, 5000981073920 bytes
255 heads, 63 sectors/track, 76000 cylinders, total 1220942645 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x6b6805d9

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1              63  1220942644   588803032   83  Linux

$ ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1  /dev/sdc2  /dev/sdc5  /dev/sdd  /dev/sdd1  /dev/sde  /dev/sde1  /dev/sdf  /dev/sdf1

如果我尝试正常挂载:

$ sudo mkdir /mnt/temp
$ sudo mount -t ext4 /dev/sde1 /mnt/temp                                                                                                    
  mount: wrong fs type, bad option, bad superblock on /dev/sde1,
   missing codepage or helper program, or other error
   In some cases useful info is found in syslog - try
   dmesg | tail  or so
$ dmesg | tail
[87143.301150] EXT4-fs (sde1): VFS: Can't find ext4 filesystem
[87295.537835] EXT4-fs (sde1): VFS: Can't find ext4 filesystem
[87315.780147] EXT4-fs (sde1): VFS: Can't find ext4 filesystem
[87315.780290] EXT4-fs (sde1): VFS: Can't find ext4 filesystem
[87315.780421] EXT4-fs (sde1): VFS: Can't find ext4 filesystem

该机器有 5 个 SATA 端口,我还买了一个 PCIe SATA 控制器并尝试了它。没有区别。在端口之间移动设备仍然没有区别。另外两个驱动器始终安装。

我将它们放回带有 USB 控制器的相应外部外壳中,它们就可以正常工作了。尽管当我尝试使用其中一个直接连接的驱动器的外壳时,它无法被识别。

谢谢!

编辑:添加来自 gdisk 的输出

$ sudo gdisk /dev/sde
GPT fdisk (gdisk) version 0.8.8

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/sde: 9767541168 sectors, 4.5 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 00C22148-8C82-4062-BEC5-6759E7E23856
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 9767541134
Partitions will be aligned on 8-sector boundaries
Total free space is 8546598519 sectors (4.0 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              63      1220942644   582.2 GiB   8300  Linux filesystem

$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8

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 /dev/sdb: 9767541168 sectors, 4.5 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): E76C335B-FBA1-4FE0-9DC2-C5CADBECA6B0
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 9767541133
Partitions will be aligned on 8-sector boundaries
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34      9767541133   4.5 TiB     8300  disk4

有趣的是,看起来未安装的磁盘使用 MBR 而不是 GPT?

答案1

这听起来像是https://superuser.com/questions/679725/how-to-correct-512-byte-sector-mbr-on-a-4096-byte-sector-disk:USB 外壳报告的扇区大小与主板不同,因此分区表的解释不同。

我曾遇到过类似的问题,当时我将一个 4TB 磁盘从 USB 外壳移到了内部 SATA 端口。显然,USB 外壳报告了 4k 扇区,因此我能够使用老式的 MBR 分区表来创建 4TB ext4 分区。通过 SATA 连接磁盘后,ext4 分区再也找不到了,显然是因为现在磁盘的访问扇区为 512B。

我通过以下步骤解决了这个问题,使用测试盘Ubuntu 中可用的数据恢复工具:

  • 为安全起见,创建了原始分区表的备份(sfdisk -d /dev/sdb > sfdisk-sdb.txt
  • 用于testdisk /dev/sdb查找原始 ext4 文件系统
  • 让 testdisk 将新的 MBR 分区表写入磁盘
  • 由于 MBR 表不支持 4TB 分区,因此 ext4 分区仍然无法挂载,并出现错误EXT4-fs (sdb1): bad geometry: block count 976751744 exceeds size of device (536870911 blocks)
  • 用于gdisk /dev/sdb将MBR转换为GPT格式,并将GPT写入磁盘
  • 再次用于testdisk /dev/sdb查找原始的 ext4 文件系统(它检测到了错误的文件系统类型,但这并不重要),并让它将新的 GPT 表写入磁盘
  • 用于gdisk /dev/sdb将错误检测的文件系统类型更改为8300

也许我只是运气好,但经过此过程后,ext4 文件系统可以照常挂载。fsck -f /dev/sdb1没有检测到任何错误,并且blkid /dev/sdb1给出tune2fs /dev/sdb1与使用 USB 外壳时相同的结果。

相关内容