ZFS가 부패하지 않은 데이터를 전달할 수없는 시점은 무엇을 볼 수 있습니까?

StackOverflow https://stackoverflow.com/questions/1725171

문제

내 프로그램이 ZFS 파일 시스템의 파일에서 바이트를 읽으려고한다고 가정 해 봅시다. ZFS는 필요한 블록의 사본을 찾을 수 있지만 유효한 체크섬이있는 사본을 찾을 수는 없습니다 (모두 손상되었거나 존재하는 유일한 디스크가 사본이 손상된 유일한 디스크). 내 프로그램은 읽기의 반환 값과 읽기를 시도한 바이트의 관점에서 무엇을 보십니까? 그리고 잠재적으로 손상된 데이터와 함께 행동 (Solaris 또는 기타 ZFS 구현 OS), 즉 힘 실패 또는 힘의 성공에 영향을 줄 수있는 방법이 있습니까?

도움이 되었습니까?

해결책

EIO는 실제로 현재 ZFS 구현의 유일한 답변입니다.

열린 ZFS "버그"는 손상된 데이터를 읽는 방법을 요구합니다.http://bugs.opensolaris.org/bugdatabase/printabase.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, [...]

파일이 여전히 OS 메모리에 캐시되기 때문에 직접 덮어 쓰기 (풀 손상)가 누락되기 때문에 테스트 풀을 내보내거나 가져와야합니다.

그리고 현재 ZFS는 손상된 데이터를 제공하지 않을 것입니다. 그대로.

어떻게 돌아가는가 EIO 오류 read() 파일 시스템 외부에서 특정 저급 데이터 구조 유틸리티 외부에 적합합니까?

낮은 수준의 데이터 구조 유틸리티는 파일에 액세스하려면 Open/Read/Write/Close 이외의 OS 및 FS 특정 API를 사용해야합니다. 필요한 의미는 일반 파일을 읽는 것과 근본적으로 다르므로 특수 API가 필요합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top