linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: kernel list <linux-kernel@vger.kernel.org>, linux-ide@vger.kernel.org
Cc: tj@kernel.org
Subject: Re: SATA hdd refuses to reallocate a sector?
Date: Sun, 23 Jun 2013 13:21:33 +0200	[thread overview]
Message-ID: <20130623112133.GA4837@amd.pavel.ucw.cz> (raw)
In-Reply-To: <20130623101940.GA4448@amd.pavel.ucw.cz>

On Sun 2013-06-23 12:19:40, Pavel Machek wrote:
> Hi!
> 
> This may very well be hw problem, but...
> 
> I have error on sda4. I tried to make hdd reallocate it by writing
> zeros there, but it will not. Is there special kind of write that
> needs to be done to force reallocation?
> 
> Would it be possible to indicate errors when writing to known-bad
> sector?

Uhuh. Seems like I have few consecutive bad sectors, and kernel is not
willing to overwrite them in one pass...?

root@amd:~# time cat /dev/zero > /dev/sda4
cat: write error: No space left on device

real 9m47.083s
user 0m0.264s
sys  1m24.424s
root@amd:~# time cat /dev/sda4  | wc -c
cat: /dev/sda4: Input/output error
8959361024

real	5m9.784s
user	0m0.544s
sys	2m11.620s
root@amd:~# time cat /dev/sda1  | wc -c
797852160

real	0m23.479s
user	0m0.040s
sys	0m5.492s
root@amd:~# time cat /dev/zero > /dev/sda4
cat: write error: No space left on device

real 7m51.619s
user 0m0.460s
sys  1m23.280s
root@amd:~# time cat /dev/sda4  | wc -c
cat: /dev/sda4: Input/output error
8958947328

real	5m25.973s
user	0m0.564s
sys	2m6.508s
root@amd:~# 

...Ok, lets try with dd.

root@amd:~# dd if=/dev/sda4 of=/dev/zero bs=1 skip=8958947328
dd: reading `/dev/sda4': Input/output error
0+0 records in
0+0 records out
0 bytes (0 B) copied, 5.05805 s, 0.0 kB/s
root@amd:~# dd if=/dev/sda4 of=/dev/zero bs=1 skip=8958947328
dd: reading `/dev/sda4': Input/output error
0+0 records in
0+0 records out
0 bytes (0 B) copied, 5.1051 s, 0.0 kB/s
root@amd:~# dd if=/dev/zero of=/dev/sda4 bs=1 seek=8958947328
dd: writing `/dev/sda4': Input/output error
3585+0 records in
3584+0 records out
3584 bytes (3.6 kB) copied, 2.63182 s, 1.4 kB/s
root@amd:~# 

...at least errors are propagated to dd. Aha, bad idea, I need to do
bigger block size so that I don't force reads...?

Better, but still not good:

root@amd:~# dd if=/dev/sda4 of=/dev/zero bs=4096
skip=$[8958947328/4096]
dd: reading `/dev/sda4': Input/output error
0+0 records in
0+0 records out
0 bytes (0 B) copied, 5.12378 s, 0.0 kB/s
root@amd:~# dd if=/dev/zero of=/dev/sda4 bs=4096
seek=$[8958947328/4096]
dd: writing `/dev/sda4': No space left on device
1746674+0 records in
1746673+0 records out
7154376192 bytes (7.2 GB) copied, 219.494 s, 32.6 MB/s
root@amd:~# dd if=/dev/sda4 of=/dev/zero bs=4096
skip=$[8958947328/4096]
dd: reading `/dev/sda4': Input/output error
101+0 records in
101+0 records out
413696 bytes (414 kB) copied, 4.94643 s, 83.6 kB/s
root@amd:~# 

Next try...

root@amd:~# dd if=/dev/zero of=/dev/sda4 bs=4096
seek=$[8958947328/4096]
dd: writing `/dev/sda4': No space left on device
1746674+0 records in
1746673+0 records out
7154376192 bytes (7.2 GB) copied, 241.291 s, 29.7 MB/s
root@amd:~# sync
root@amd:~# dd if=/dev/sda4 of=/dev/zero bs=4096
skip=$[8958947328/4096]
dd: reading `/dev/sda4': Input/output error
102+0 records in
102+0 records out
417792 bytes (418 kB) copied, 12.4968 s, 33.4 kB/s
root@amd:~# 

I don't think badblocks utility does what I need...?

I tried re-running dd few time, even with conf=fsync; but 

1) errors during write do not get reported

2) no more sectors are reallocated

root@amd:~# dd if=/dev/zero of=/dev/sda4 bs=4096
seek=$[8958947328/4096] conv=fsync
dd: writing `/dev/sda4': No space left on device
1746674+0 records in
1746673+0 records out
7154376192 bytes (7.2 GB) copied, 188.11 s, 38.0 MB/s
root@amd:~# dd if=/dev/sda4 of=/dev/zero bs=4096
skip=$[8958947328/4096]
dd: reading `/dev/sda4': Input/output error
102+0 records in
102+0 records out
417792 bytes (418 kB) copied, 6.20669 s, 67.3 kB/s
root@amd:~# 

Any ideas? Thanks,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2013-06-23 11:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-23 10:19 SATA hdd refuses to reallocate a sector? Pavel Machek
2013-06-23 11:21 ` Pavel Machek [this message]
2013-06-23 13:16   ` Marcus Overhagen
2013-06-23 19:00     ` Pavel Machek
2013-06-23 21:27       ` Mark Lord
2013-06-23 21:51         ` Pavel Machek
2013-06-23 22:35           ` Mark Lord
2013-06-24  6:19             ` Marcus Overhagen
2013-06-24 12:28               ` Pavel Machek
2013-06-24  7:14           ` Ondrej Zary
2013-06-24 11:06             ` Pavel Machek
2013-06-24 12:18             ` Mark Lord
2013-06-26  3:04               ` James Bottomley
2013-06-26  6:11                 ` Ondrej Zary
2013-06-29 18:47             ` Henrique de Moraes Holschuh
2013-06-29 23:02               ` Mark Lord
2013-06-30 14:34                 ` Henrique de Moraes Holschuh
2013-06-30 16:49                   ` Pavel Machek
2013-07-01 13:28                     ` Henrique de Moraes Holschuh
2015-04-30 19:01         ` Pavel Machek
2013-06-24 12:48 ` Zdenek Kaspar
2013-06-24 13:08   ` Ondrej Zary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130623112133.GA4837@amd.pavel.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).