我在 IT 部门工作。有时我们被要求从发生故障的驱动器中获取数据。我们有各种 SATA-to-USB、ATA-to-USB 等用于此任务的适配器。但是,有时他们会向计算机报告错误的块大小(或者他们根本没有报告任何块大小,而我的 Linux 笔记本电脑只是假设了错误的大小)。当内核想要使用 4096 字节的块大小时,我如何告诉内核使用 512 字节的块大小,反之亦然?
我正在运行 Fedora,内核版本 5.2.11-100.fc29.x86_64,如果这有什么不同的话。
这是我被要求提供的一些额外数据(设备 16(sdb)是 Coolmax,19(sdd)是 StarTech):
$ sudo lsusb | grep JMicron
Bus 001 Device 016: ID 152d:2338 JMicron Technology Corp. / JMicron USA Technology Corp. JM20337 Hi-Speed USB to SATA & PATA Combo Bridge
Bus 001 Device 019: ID 152d:2338 JMicron Technology Corp. / JMicron USA Technology Corp. JM20337 Hi-Speed USB to SATA & PATA Combo Bridge
$ cat /sys/block/sdb/queue/logical_block_size
4096
$ cat /sys/block/sdd/queue/logical_block_size
4096
$ cat /sys/block/sdb/queue/physical_block_size
4096
$ cat /sys/block/sdd/queue/physical_block_size
4096
$ sudo sg_readcap /dev/sdb
Read Capacity results:
Last logical block address=366284645 (0x15d50f65), Number of blocks=366284646
Logical block length=4096 bytes
Hence:
Device size: 1500301910016 bytes, 1430799.4 MiB, 1500.30 GB
$ sudo sg_readcap /dev/sdd
Read Capacity results:
Last logical block address=122096645 (0x7470c05), Number of blocks=122096646
Logical block length=4096 bytes
Hence:
Device size: 500107862016 bytes, 476940.0 MiB, 500.11 GB
$ sudo sg_readcap -16 /dev/sdb
Read Capacity results:
Protection: prot_en=0, p_type=0, p_i_exponent=0
Logical block provisioning: lbpme=0, lbprz=0
Last logical block address=2930277167 (0xaea87b2f), Number of logical blocks=2930277168
Logical block length=512 bytes
Logical blocks per physical block exponent=0
Lowest aligned logical block address=0
Hence:
Device size: 1500301910016 bytes, 1430799.4 MiB, 1500.30 GB
$ sudo sg_readcap -16 /dev/sdd
Read Capacity results:
Protection: prot_en=0, p_type=0, p_i_exponent=0
Logical block provisioning: lbpme=0, lbprz=0
Last logical block address=976773167 (0x3a38602f), Number of logical blocks=976773168
Logical block length=512 bytes
Logical blocks per physical block exponent=0
Lowest aligned logical block address=0
Hence:
Device size: 500107862016 bytes, 476940.0 MiB, 500.11 GB