“缓冲区 I/O 错误”中的逻辑块号

“缓冲区 I/O 错误”中的逻辑块号

我试图确定导致 LV 报告缓冲区 I/O 错误的坏 PV,并在“缓冲区 I/O 错误”消息中发现了这种有趣的行为。

在映射到不同 PV 的 Large LV 上,我尝试使用错误中报告的“逻辑块”与 dmsetup 表匹配以找出它在哪个目标设备上。但是这种方法似乎不太可靠。

我使用 dmsetup 创建了一个设备映射器设备,其中有一个或多个漏洞。错误消息非常有趣,我无法理解其中的规律。

错误消息中的“逻辑块”编号似乎取决于洞的大小及其位置。有没有确定的方法来定位实际的坏块?

以下是我做的测试

+++测试 1 错误块位于 8,缓冲区 i/o 错误位于 LB 8

root@ubuntu:~# dmsetup create test x.tab
root@ubuntu:~# dmsetup table test
0 8 linear 8:16 0
8 1 error 
9 1000 linear 8:16 8
root@ubuntu:~# dd if=/dev/mapper/test of=/dev/null bs=512 count=1000
dd: error reading ‘/dev/mapper/test’: Input/output error
8+0 records in
8+0 records out
4096 bytes (4.1 kB) copied, 0.000977434 s, 4.2 MB/s
root@ubuntu:~# 

Sep  5 17:21:07 ubuntu kernel: [ 1358.811671] bio: create slab <bio-1> at 1
Sep  5 17:21:07 ubuntu kernel: [ 1358.817045] Buffer I/O error on device dm-0, logical block 8
Sep  5 17:21:07 ubuntu kernel: [ 1358.817192] Buffer I/O error on device dm-0, logical block 8
Sep  5 17:21:07 ubuntu kernel: [ 1358.817199] Buffer I/O error on device dm-0, logical block 8
Sep  5 17:21:07 ubuntu kernel: [ 1358.817201] Buffer I/O error on device dm-0, logical block 8
Sep  5 17:21:07 ubuntu kernel: [ 1358.817203] Buffer I/O error on device dm-0, logical block 8
Sep  5 17:21:07 ubuntu kernel: [ 1358.817629] Buffer I/O error on device dm-0, logical block 8
Sep  5 17:21:07 ubuntu kernel: [ 1358.817633] Buffer I/O error on device dm-0, logical block 8
Sep  5 17:21:07 ubuntu kernel: [ 1358.818649] Buffer I/O error on device dm-0, logical block 8
Sep  5 17:21:19 ubuntu kernel: [ 1370.324905] Buffer I/O error on device dm-0, logical block 8
Sep  5 17:21:19 ubuntu kernel: [ 1370.325245] Buffer I/O error on device dm-0, logical block 8

+++ TEST 2 错误块位于 9,缓冲区 i/o 位于 LB 4 错误

root@ubuntu:~# dmsetup create test x.tab
root@ubuntu:~# dmsetup table test
0 9 linear 8:16 0
9 1 error 
10 1000 linear 8:16 9
root@ubuntu:~# dd if=/dev/mapper/test of=/dev/null bs=512 count=1000
dd: error reading ‘/dev/mapper/test’: Input/output error
8+0 records in
8+0 records out
4096 bytes (4.1 kB) copied, 0.000630946 s, 6.5 MB/s
root@ubuntu:~# 

Sep  5 17:23:28 ubuntu kernel: [ 1499.435904] bio: create slab <bio-1> at 1
Sep  5 17:23:28 ubuntu kernel: [ 1499.440980] Buffer I/O error on device dm-0, logical block 4
Sep  5 17:23:28 ubuntu kernel: [ 1499.441010] Buffer I/O error on device dm-0, logical block 4
Sep  5 17:23:28 ubuntu kernel: [ 1499.441037] Buffer I/O error on device dm-0, logical block 4
Sep  5 17:23:28 ubuntu kernel: [ 1499.441062] Buffer I/O error on device dm-0, logical block 4
Sep  5 17:23:28 ubuntu kernel: [ 1499.441087] Buffer I/O error on device dm-0, logical block 4
Sep  5 17:23:28 ubuntu kernel: [ 1499.441314] Buffer I/O error on device dm-0, logical block 4
Sep  5 17:23:28 ubuntu kernel: [ 1499.441340] Buffer I/O error on device dm-0, logical block 4
Sep  5 17:23:28 ubuntu kernel: [ 1499.441805] Buffer I/O error on device dm-0, logical block 4
Sep  5 17:23:53 ubuntu kernel: [ 1524.710414] Buffer I/O error on device dm-0, logical block 4
Sep  5 17:23:53 ubuntu kernel: [ 1524.710572] Buffer I/O error on device dm-0, logical block 4

+++ 测试 3 错误块从 1000 开始,共 10 个块,缓冲区 i/o 错误在 LB 500

root@ubuntu:~# dmsetup create test x.tab
root@ubuntu:~# dmsetup table test
0 1000 linear 8:17 0
1000 10 error 
1010 1000 linear 8:17 1010
root@ubuntu:~# dd if=/dev/mapper/test of=/dev/null bs=512 count=12000
dd: error reading ‘/dev/mapper/test’: Input/output error
1000+0 records in
1000+0 records out
512000 bytes (512 kB) copied, 0.00278218 s, 184 MB/s
root@ubuntu:~# 

Sep  5 17:37:04 ubuntu kernel: [ 2314.961989] bio: create slab <bio-1> at 1
Sep  5 17:37:12 ubuntu kernel: [ 2322.956596] Buffer I/O error on device dm-0, logical block 500
Sep  5 17:37:12 ubuntu kernel: [ 2322.956600] Buffer I/O error on device dm-0, logical block 501
Sep  5 17:37:12 ubuntu kernel: [ 2322.956602] Buffer I/O error on device dm-0, logical block 502
Sep  5 17:37:12 ubuntu kernel: [ 2322.956603] Buffer I/O error on device dm-0, logical block 503
Sep  5 17:37:12 ubuntu kernel: [ 2322.956605] Buffer I/O error on device dm-0, logical block 504
Sep  5 17:37:12 ubuntu kernel: [ 2322.957147] Buffer I/O error on device dm-0, logical block 500
Sep  5 17:37:12 ubuntu kernel: [ 2322.957149] Buffer I/O error on device dm-0, logical block 501
Sep  5 17:37:12 ubuntu kernel: [ 2322.957151] Buffer I/O error on device dm-0, logical block 502
Sep  5 17:37:12 ubuntu kernel: [ 2322.957152] Buffer I/O error on device dm-0, logical block 503

+++ 测试 4 在 1000 处发生错误块,在 LB 1000 处发生缓冲区 i/o 错误

root@ubuntu:~# dmsetup create test x.tab
root@ubuntu:~# dmsetup table test
0 1000 linear 8:17 0
1000 1 error 
1001 1000 linear 8:17 1010
root@ubuntu:~# dd if=/dev/mapper/test of=/dev/null bs=512 count=12000
dd: error reading ‘/dev/mapper/test’: Input/output error
1000+0 records in
1000+0 records out
512000 bytes (512 kB) copied, 0.00379868 s, 135 MB/s
root@ubuntu:~# 

Sep  5 17:38:48 ubuntu kernel: [ 2419.516088] bio: create slab <bio-1> at 1
Sep  5 17:38:54 ubuntu kernel: [ 2425.506135] Buffer I/O error on device dm-0, logical block 1000
Sep  5 17:38:54 ubuntu kernel: [ 2425.506953] Buffer I/O error on device dm-0, logical block 1000

+++ 测试 5 个错误块从 1001 开始,共 2 个块,缓冲区 i/o 错误在 LB 1001

root@ubuntu:~# dmsetup create test x.tab
root@ubuntu:~# dmsetup table test
0 1001 linear 8:17 0
1001 2 error 
1003 1000 linear 8:17 1010
root@ubuntu:~# dd if=/dev/mapper/test of=/dev/null bs=512 count=12000
dd: error reading ‘/dev/mapper/test’: Input/output error
1000+0 records in
1000+0 records out
512000 bytes (512 kB) copied, 0.00362554 s, 141 MB/s
root@ubuntu:~# 

Sep  5 17:42:16 ubuntu kernel: [ 2627.373744] bio: create slab <bio-1> at 1
Sep  5 17:42:24 ubuntu kernel: [ 2635.080482] Buffer I/O error on device dm-0, logical block 1001
Sep  5 17:42:24 ubuntu kernel: [ 2635.080486] Buffer I/O error on device dm-0, logical block 1002
Sep  5 17:42:24 ubuntu kernel: [ 2635.081327] Buffer I/O error on device dm-0, logical block 1001
Sep  5 17:42:24 ubuntu kernel: [ 2635.081329] Buffer I/O error on device dm-0, logical block 1002

相关内容