如果将 HDD 放置在笔记本电脑硬盘托架中,则无法识别通过 SATA-USB 接口连接的 HDD 创建的分区表

如果将 HDD 放置在笔记本电脑硬盘托架中,则无法识别通过 SATA-USB 接口连接的 HDD 创建的分区表

我使用 gparted 在通过 SATA-USB 接口连接到笔记本电脑的硬盘上创建了一个 dos/mbr 分区表和一些分区。然后,我将硬盘放入系统硬盘托架中,并使用实时 USB 启动系统。当我打开 gparted 时,它无法识别分区表。然后,我使用笔记本电脑硬盘托架中的硬盘创建了另一个分区表。当我从托架中取出硬盘并通过 SATA-USB 接口将其连接到笔记本电脑时,gparted 也无法识别分区表。然而,在这两种情况下,如果我通过创建分区表的同一接口将硬盘连接到笔记本电脑,gparted 都能够识别硬盘上的分区表。

我的问题是系统如何区分在硬盘托架中创建的分区表和通过 SATA-USB 接口创建的分区表?

答案1

想法:USB 设备中的电缆或接口(更有可能)以位或字节为单位交换?(在连接到 USB 时使用 dd 读取磁盘分区数据,并使用 conv=swab 检查字节交换,并与非 USB 读数进行比较?)


示例从中提取前 1024 个字节/dev/sda;比较连接到不同接口的同一磁盘(不要更改分区!)的输出 - 验证磁盘是否可以在两者上工作:

$ sudo dd if=/dev/sda count=2 bs=512 | od -t x1z
2+0 记录
2+0 记录出局
已复制 1024 字节(1.0 kB,1.0 KiB),3.2652e-05 秒,31.4 MB/s
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................<
*
0000660 00 00 00 00 00 00 00 00 f1 bf b3 5a 00 00 00 00 >...........Z....<
0000700 01 00 ee fe ff ff 01 00 00 00 af 6d 70 74 00 00 >...........mpt..<
0000720 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................<
*
0000760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa >..............U.<
0001000 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 >EFI 部分....<
0001020 cd 51 b7 99 00 00 00 00 01 00 00 00 00 00 00 00 >.Q..............<
0001040 af 6d 70 74 00 00 00 00 22 00 00 00 00 00 00 00 >.mpt.....<
0001060 8e 6d 70 74 00 00 00 00 87 5a 9c c6 72 be b1 41 >.mpt.....Z..r..A<
0001100 b4 32 5c c5 c3 a2 93 6c 02 00 00 00 00 00 00 00 >.2\....l........<
0001120 80 00 00 00 80 00 00 00 e6 92 5a ce 00 00 00 00 >..........Z.....<
0001140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................<
*
0002000

$ lsblkdisk会告诉你连接了哪些设备。注意:要读取的行是上面有的行,例如:

$ lsblk -p
...
/dev/sda 8:0 0 931,5G 0 磁盘
└─/dev/sda1 8:1 0 931,5G 0 部分 /DATA
/dev/nvme0n1 259:0 0 238,5G 0 磁盘
─/dev/nvme0n1p1 259:1 0 512M 0 部分 /boot/efi
└─/dev/nvme0n1p2 259:2 0 238G 0 部分 /

比较:同一磁盘conv=swab--即显示错误数据--

$ sudo dd if=/dev/sda count=2 conv=swab bs=512 | od -t x1z
[sudo] hannu 的密码:
2+0 记录
2+0 记录出局
已复制 1024 字节(1.0 kB,1.0 KiB),0.000940358 秒,1.1 MB/s
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................<
*
0000660 00 00 00 00 00 00 00 00 bf f1 5a b3 00 00 00 00 >..........Z.....<
0000700 00 01 fe ee ff ff 00 01 00 00 6d af 74 70 00 00 >..........m.tp..<
0000720 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................<
*
0000760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 aa 55 >...............U<
0001000 46 45 20 49 41 50 54 52 00 00 00 01 00 5c 00 00 >FE IAPTR.....\..<
0001020 51 cd 99 b7 00 00 00 00 00 01 00 00 00 00 00 00 >Q...............<
0001040 6d af 74 70 00 00 00 00 00 22 00 00 00 00 00 00 >m.tp.....“......<
0001060 6d 8e 74 70 00 00 00 00 5a 87 c6 9c be 72 41 b1 >m.tp....Z....rA.<
0001100 32 b4 c5 5c a2 c3 6c 93 00 02 00 00 00 00 00 00 >2..\..l.........<
0001120 00 80 00 00 00 80 00 00 92 e6 ce 5a 00 00 00 00 >...........Z....<
0001140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................<
*
0002000

相关内容