Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 11-02-2012, 01:59 AM   #1
LQ Newbie
Registered: Aug 2009
Location: China
Distribution: ubuntu
Posts: 11

Rep: Reputation: 2
USB hard drive writes corrupt data under linux


I have a SATA hard drive in a USB HDD enclosure, which works well with Windows. Recently I started using it in Linux and something went wrong.

When I write a huge block of data into that drive, the writing process will report that everything is fine. But when I read it back, there is a data corruption about every several GBs, and sometimes even more. The kernel will report an I/O error and a USB disconnected event. The USB HDD enclosure then reconnects again, looks like it has restarted.

If I connect the hard drive to a internal SATA port and do the same read operation, I see a lot of SATA UNC errors.

I've done a lot of tests and here are my results:
-- If data is written while the hard drive is directly connected to an internal SATA port, there will be no data corruption.
-- If data is written while the hard drive is in the HDD enclosure, but under Windows, there will be no data corruption either.
-- Those sectors are not really physically broken. A correct overwrite operation (either with an internal SATA port, or under windows) will fix them.
-- This error is reproducible, although actual positions of broken sectors will be different. I can reproduce it with my debian laptop and Raspberry Pi. And data corruption happens regardless of whether writing is performed in a mounted ext4/NTFS filesystem or directly to the raw device.

I have no other HDD enclosures to test, and I'm not sure if it's a hardware problem or a driver bug.

Does anyone have experience with such problems before? What can I do to fix the problem? Or do I have to buy a new HDD enclosure?
Old 11-03-2012, 05:04 AM   #2
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
I would mount it internally using a SATA port and run a SMART long test.

smartctl -t long /dev/sda
Then wait and check it with:

smartctl -a /dev/sda
Also make sure to plug the drive in externally using the USB cable that it comes with, which is usually a Y-cable with one connector for data and the other for power.


harddrive, sata, usb

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible corrupt files when installing linux off a USB drive wdhpr Linux - Newbie 2 06-18-2012 07:08 PM
Backup of data to both networked desktop and USB Hard Drive Rescuetheperishing Linux - Software 4 03-04-2010 02:27 AM
Booting Linux on an external USB hard drive (not a memory stick, a hard drive) comcastuser Linux - Hardware 4 01-13-2010 06:59 PM
Could Linux corrupt usb drive??? melinda_sayang Linux - Hardware 5 12-07-2004 11:58 AM
best hard drive for dvr that constantly writes to disk? Incanus Linux - Hardware 9 12-30-2003 08:23 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration