说我的程序试图在对某文件系统ZFS的文件的字节的读取。 ZFS可以找到所需的块的副本,但无法找到一个有效的校验和任何副本(他们都遭到了损坏,或仅存在的磁盘已损坏副本)。什么是我的程序看,从读的返回值,并试图读取字节的条款?并且是有办法来影响行为(在Solaris下,或任何其他ZFS-执行OS),即,迫使失败,或强制的成功,具有潜在的损坏的数据?

有帮助吗?

解决方案

EIO确实与当前ZFS实现唯一的答案。

这是开放ZFS“错误”请求某种方式来读损坏的数据: http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6186106

相信这使用无证但开源ZDB效用已经是可行的。 看看 http://www.cuddletech.com/blog/pivot /entry.php?id=980 有关如何使用ZDB -R选项和“r”的标志。

转储文件内容的解释

其他提示

<强>的Solaris 10:

# Create a test pool
[root@tesalia z]# cd /tmp
[root@tesalia tmp]# mkfile 100M zz
[root@tesalia tmp]# zpool create prueba /tmp/zz

# Fill the pool
[root@tesalia /]# dd if=/dev/zero of=/prueba/dummy_file
dd: writing to `/prueba/dummy_file': No space left on device
129537+0 records in
129536+0 records out
66322432 bytes (66 MB) copied, 1.6093 s, 41.2 MB/s

# Umount the pool
[root@tesalia /]# zpool export prueba

# Corrupt the pool on purpose
[root@tesalia /]# dd if=/dev/urandom of=/tmp/zz seek=100000 count=1 conv=notrunc
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.0715209 s, 7.2 kB/s

# Mount the pool again
zpool import -d /tmp prueba

# Try to read the corrupted data
[root@tesalia tmp]# md5sum /prueba/dummy_file 
md5sum: /prueba/dummy_file: I/O error

# Read the manual
[root@tesalia tmp]# man -s2 read
[...]
RETURN VALUES
     Upon successful completion,  read()  and  readv()  return  a
     non-negative integer indicating the number of bytes actually
     read. Otherwise, the functions return -1 and  set  errno  to
     indicate the error.

ERRORS
     The read(), readv(), and pread() functions will fail if:
[...]
     EIO        A physical I/O error has occurred, [...]

您必须导出/导入测试池,因为,如果没有,直接重写(池损坏)将被错过,因为该文件将仍然是操作系统内存中缓存。

不,目前ZFS会拒绝给您损坏的数据。因为它应该。

如何将文件系统特定低级数据救援工具外返回任何东西,但是从EIO有意义的read()错误?

在低级数据救援工具将需要使用OS和比开放其他FS特定API /读/写/接近访问该文件。它需要的语义是从阅读普通文件根本上不同的,因此它需要一个专门的API。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top