Page 1 of 1

Device I/O errors and low disk reading speed

Posted: 14 Feb 2016 13:12
by samirg

I am experiencing problems reading a disk volume (logical disk). Please note that I can open the volume just fine in HxD, with admin elevation. The volume is also working as expected in Explorer. I can read and write files to it in Explorer just fine. No other program is actively using it when I open it in HxD. None that I know of anyway, or that I have started myself.

The main problem is the very low reading speed. Which I think results in the device I/O error I see later on.

The volume is 646 GiB and I am using the Find function in HxD to search for a magic number. I manually note down the offsets for each match. But the low reading speed is a big problem for me. Not only because it will take many days to scan the entire volume, but also because HxD sometimes runs into an irrecoverable device I/O error. This means that I can't continue where I left off, but have to start all over again.
The request could not be performed because of an I/O device error.
When I check the disk activity in Task Manager while HxD is doing the Find operation I can see it's 100% active and the read speed shifts from about 250 KB/s to 2.5 KB/s. At best, it reaches 7 or 8 MB/s. It sometimes jumps to about 20 MB/s and that's about it. It never goes above that.

It's very frustrating, as I'm sure you can understand. But there is more to it. It's a cascading problem where one problem leads to another, as often is the case with computers. I must use a disk editor in order to recover some very important data. I have no other option. And I must recover that data, and I know it can be done because I have already recovered some of it. But I need to recover more, on higher byte addresses. But for that I need a tool that works properly.

I have tested the commercial Hex Editor Neo, the full version, in trial mode. I have discovered one bug in it, several oddities, and it too had reading problems. I actually started out with Neo, before I tested HxD. Or I tested HxD first, found the estimated time remaining and the progress bar too discouraging and moved on to Neo in hopes that it would be faster. I thought that 646 GiB was just asking too much of such a program. I have used both HxD and Neo in the past, and I know they're both good but I never tried working with 646 GiB. So I didn't really know what to expect.

But I ran HxD yesterday, after several hours of frustration with Neo, and that time it reached an average of about 120 MB/s. I ran it for about 2 hours and reached the end of the disk volume. I found several matches. But I didn't start from the beginning. So I have missed some byte addresses. However, I am unable to reach the same read speed today. I don't know what was different with that session.

Any idea why I have this read problem? Could it be Windows 10 specific?

I am running HxD version on Windows 10 Pro x64 (version 1511, build 10586.104). The physical disk is a WD Caviar Red, SATA3 in SATA2 mode. The PC has 8 GB of RAM and the CPU is overclocked at 2.9 GHz. It's a tower PC I built myself.

Re: Device I/O errors and low disk reading speed

Posted: 14 Feb 2016 14:49
by samirg
It appears I can't edit my own post on this forum?
The error message.
hxd_io_error.png (3.01 KiB) Viewed 5890 times
Let me just share some screenshots of the read speed diagram from Task Manager. It will more clearly illustrate the slow read speed.
High sampling rate, 30 second frame.
hxd_low_read_speed_1.png (13.68 KiB) Viewed 5890 times
Low sampling rate, 4 minute frame.
hxd_low_read_speed_2.png (12.43 KiB) Viewed 5890 times

Re: Device I/O errors and low disk reading speed

Posted: 14 Feb 2016 15:27
by samirg
I have tested using HxD Alpha. It did not help increase the reading speed.

I then went on testing the Windows system disk using aforementioned version. It jumped right up to 125 MB/s.
Normal sampling rate, 60 second frame.
hxd_low_read_speed_3.png (12.35 KiB) Viewed 5889 times
This is about as high as it can go in practice on SATA2. Even though the system drive is a Samsung SSD and it can read much faster than that, but not on this system though. But I would be happy if I could reach 100 MB/s on the mechanical WD.

I went on testing stable version again, also on the system disk Samsung SSD, and it easily reached over 100 MB/s speed, i.e. same as with Alpha.

Re: Device I/O errors and low disk reading speed

Posted: 14 Feb 2016 15:53
by samirg
OK, I am confident now that the problem is only related to my WD Caviar Red disk.

With my WD Caviar Black disk, I reached 125 MB/s, also using HxD
hxd_low_read_speed_4.png (12.73 KiB) Viewed 5889 times
But then why is the WD Caviar Red so slow? The Red is a newer addition than the Black. The Red should be able to reach at least 100 MB/s.

Re: Device I/O errors and low disk reading speed

Posted: 15 Feb 2016 23:22
by samirg
Alright, I got it working again. I powered off, disconnected all disks except the SSD and the WD Red. With only these two inside, right now, I have a reading speed of 125 MB/s on the Red.
WD Red is OK now.
hxd_low_read_speed_5.png (13.39 KiB) Viewed 5883 times
No more pesky device I/O errors. I can't say for sure what's causing WD Red to slow down so much. I do know I have an old Seagate drive that's bad. It reads at about 50 MB/s. It may be affecting the reading speed of the WD Red drive somehow. It is disconnected right now. I might do some combinatorics later on to try to figure out if it's that drive that's causing WD Red to slow down so much. I also have another identical Seagate drive that reads at about 130 MB/s. So I know one of them is bad. I have known it for some time now actually but I was too lazy to do some diagnostics on them and pull out at least one of them. But even 50 MB/s is much better than sub 7 MB/s that WD Red manages to put up.

They are all connected to the same Intel SATA controller, even the SSD disk. So I don't know... why wouldn't the Samsung SSD, the WD Black and the healthy Seagate HDD be affected negatively by the bad Seagate HDD?... they are all on the same controller after all. It's very strange problem.

I have not had time to do a read test of the WD Red using GNU Linux, or Windows 7. My gut tells me that Linux will read it without any problem, as might Windows 7 as well.

It's not just the bad Seagate drive that's causing the WD Red to slow down so much. Windows 10 comes with its own set of all kinds of problems. For example, I have seen .NET based programs become almost unresponsive under Windows 10. The only "classic apps" (Microsoft's new term for Win32 and .NET) that work properly under Windows 10 are in fact the Win32 "programs" (as I insist on calling them). Microsoft has a lot of optimization to do before .NET programs can run as smoothly as Win32 programs. The new "modern apps" are also much faster since Threshold 2 milestone. But in my opinion these are just worthless junk. For example they don't respect non-English locales, and non-English keyboard layouts are not working properly in several of Microsoft's own modern apps that come with Windows 10.

Microsoft will need probably another 2 years before they can bring Windows 10 to an acceptable level of quality and overall system integration, stability and unity and make it the "continuum" system that they strive for. They just want too much in very limited time, that's the main problem with Windows 10. They should have done what they did with Windows NT and overhauled it completely. In the mean time, why should we as users, and as professionals and content creators have to suffer while they let us run Windows 10 test labs for "free" for them?

So please Maël, if you read this, don't ever go over to Windows 10 and the crappy new "modern apps" ideology. I know you know better than this Maël. I'm just saying it out loud. But even as a Win32 developer, watch out for Windows 10. Thankfully, HxD is still working well under Windows 10 (only my WD Red isn't). I would hate to see this great little program stop working in later versions of Windows 10. I really hope you will continue working on this program. God knows that disk editors will continue to serve a purpose well into the modern crapps age.

Re: Device I/O errors and low disk reading speed

Posted: 16 Feb 2016 12:25
by Maël
Wow that's a thorough analysis. I like to see all the work you put into this!
It appears I can't edit my own post on this forum?
There is a time-limit for editing posts so that a thread stays meaningful.

Since I can only guess from distance, it would appear to me to be a controller issue/driver issue. It may well be that the faulty disk is confusing the controller (or Windows) and therefore intermittent read errors occurred.

HxD accesses the disk in the most direct (and simple and recommended) way possible under the WinNT line: it uses ReadFile(). Under Win9X this is much more complex including calls to BIOS using thunks to 16-bit code, but this isn't relevant here. So there is not much that can go wrong on HxD's side, besides wrong alignment of disk reads (not following sector alignment) and access rights issues.
Regarding the speed, the read buffer could be too small for newer drives, but since you say it works at top speed with other drives this is unlikely.

The only possible issue I can think of would be that the disk you have problems with has 4K sectors and that it does not emulate 512 byte sectors. HxD is in principle designed to handle any sector size, but Windows/drives sometimes return a fake sectors size (called logical sector size) for compatibility reasons.

Maybe supporting the new Windows functions for querying the real physical sector size could alleviate the problem? But if this drive is really a pure 4K sector drive it shouldn't return a faked 512 byte logical sector size, and otherwise it should be able to handle logical sectors of 512 bytes.

So I guess in the end it's still a controller, disk or driver problem. Maybe always using the physical sector size would just avoid triggering some subtle bugs in the hardware/Windows that only occur in certain constellations.

Oh, another point: If you have read errors due to a faulty drive, you usually get CRC errors, "Device I/O" error is pretty generic and probably more related to the communication stack (those are Windows error messages, not HxD error messages).

Re: Device I/O errors and low disk reading speed

Posted: 16 Feb 2016 12:41
by Maël
A web search for "Device I/O error" suggests that it may be loose cables, wrong transfer mode, or driver issues:

They also have some comments and discussion about it and proposed solutions. You probably know them all, but sometimes they still give useful hints.

Btw, if you think another Windows version will work better for your recovery purposes, you can just use an installation disk of the old Windows version, and run HxD portable from a USB stick when the Install GUI booted up.