Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Aug 2014 11:20:40 +0100
From:      Martin Simmons <martin@lispworks.com>
To:        Patrick Proniewski <patpro@patpro.net>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: zdb -R question
Message-ID:  <201408131020.s7DAKeCl017621@higson.cam.lispworks.com>
In-Reply-To: <BEC665FB-4F91-400D-BAA2-67D978C7AC66@patpro.net> (message from Patrick Proniewski on Tue, 12 Aug 2014 18:27:06 %2B0200)
References:  <BEC665FB-4F91-400D-BAA2-67D978C7AC66@patpro.net>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> On Tue, 12 Aug 2014 18:27:06 +0200, Patrick Proniewski said:
> 
> Hello,
> 
> I've a hard drive with corrupt blocks. I would like to know if those blocks belong to a real file.
> 
> /var/log/message reads:
> 
> 	smartd[1306]: Device: /dev/ada3, 3 Currently unreadable (pending) sectors
> 
> devices ada2 and ada3 are in ZRAID1 mirror. 

I think you mean just "mirror"? here.  ZRAID1 is not a term used by ZFS -- it
has RAIDZ1, but that requires at least 3 drives.


> zpool scrub won't show any error.

If scrub shows no errors then the blocks are not currently used.


> smartctl full test find errors:
> 
> 	SMART Self-test log structure revision number 1 
> 	Num Test_Description     Status                  Remaining     LifeTime(hours) LBA_of_first_error 
> 	../..
> 	# 2  Extended offline    Completed: read failure       80%     33003         460087328
> 	../..
> 	# 5  Extended offline    Completed: read failure       90%     32936         460087313
> 
> I've made some attempts with zdb -R to read faulted sectors, but I keep receiving errors like these ones: 
> 
> 	Invalid block specifier: gpt/ben: 460087328:512  - offset must be a multiple of sector size
> 	Invalid block specifier: gpt/ben:409600000:512  - size must be a multiple of sector size
> 
> whatever offset and size I try (4096/512), I always receive one of these errors... Any idea?

For a start, you probably have partitions on the disk so that LBA (from the
start of the disk) will not be the offset into the ZFS vdev.  Secondly, the
offset passed to zdb -R should be in bytes, whereas the LBA is in sectors.

Try using dd on the whole disk, something like

dd if=/dev/ada3 of=/dev/null bs=512 count=1 skip=460087328

Use bs=4096 if your drive has 4096 byte sectors.  Don't mix up the if= and of=
arguments or you may lose data.

__Martin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408131020.s7DAKeCl017621>