LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-17-2008, 12:33 PM   #1
bcrozier
LQ Newbie
 
Registered: Jan 2008
Posts: 3

Rep: Reputation: 0
How to diagnose cause of grep returning "sense key Medium Error" on a particular file


Running Monta Vista Linux, I want to learn how to determine what might have caused a particular (log) file to get into a state such that grep returns "sense key Medium Error" and "input/output" error, but cat works fine. Note - the file is located on a local hard disk, and all the other files in the same directory are OK. There is no removable media involved.

# grep -Ri extno *
SCSI error : <4 0 1 0> return code = 0x8000002
Info fld=0x2504ed6, Current sda: sense key Medium Error
Additional sense: Read retries exhausted
end_request: I/O error, dev sda, sector 38817488
grep: ex289224.log: Input/output error

But,

# cat ex289224.log

works fine.

Both grep and cat presumably open and read the whole file, so I don't understand what could be wrong with a file where grep would consistently fail but cat would work. Root has write read & write permissions:

ls -latr ex289224.log
-rw-r--r-- 1 root root 7968450 Oct 7 19:46 ex289224.log


I know that e2fsck might fix the problem, but I'm trying first to determine exactly what the problem was and how it might have occurred.
 
Old 11-17-2008, 05:29 PM   #2
yowi
Member
 
Registered: Dec 2002
Location: Au
Distribution: Debian
Posts: 209

Rep: Reputation: 55
Could be something to do with the difference being grep is trawling through whatever file/directories you have there, while cat is just looking at one file.
 
Old 11-17-2008, 08:24 PM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Do you get any error if you cat the log into grep via a pipe? (You shouldn't, but it's a quick check.)

The error is, quite explicitly, telling you that the system was unable to read sector 38817488 of /dev/sda, and that that sector contains data from ex289224.log. So the cause of the error is that the sector could not be read.

All that's fairly clear. If you're asking why the sector was unreadable, consider consulting any omnipotent god to which you have access.
 
Old 11-18-2008, 09:58 AM   #4
bcrozier
LQ Newbie
 
Registered: Jan 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Any way to determine what is stored at a given sector ?

Thank you for the information.

The problem is repeatable, and although that particular file is listed in the error message, it is apparently not the source of the problem - because running grep on the cat'd file is ok.


Is there any simple way to determine what is stored at the problem sector ?

In other words, knowing that sector 38817488 has a problem, and that grep -R * has problems trying to access that sector as it progresses - I would like to be able to find out what file or directory structure actually contains that sector. Is that doable ?
 
Old 11-19-2008, 08:53 AM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
If you've got the resources, you could image the drive (using dd) to preserve it in case it's ailing, and see if the image has the same problem. Since the message does seem to relate to a hardware issue, you should - of course - keep your backup current.

That being said, there are several tools you could use to look at what's readable on a specific drive. (I've only used a few of them, mostly for recovery of inadvertently erased files when the backups were not current, so I can't offer specific advice.) Try "Google" for suggestions.
 
Old 11-20-2008, 09:54 AM   #6
bcrozier
LQ Newbie
 
Registered: Jan 2008
Posts: 3

Original Poster
Rep: Reputation: 0
smartmon tool smartctl

Thanks for the information and advice.

One suggested tool to do what I want is 'smartctl' from the smartmon tool kit at http://smartmontools.sourceforge.net/
 
  


Reply


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
how can I "cat" or "grep" a file to ignore lines starting with "#" ??? callagga Linux - Newbie 7 08-16-2013 06:58 AM
Adding a directory returns "no medium found" error JcN Linux - Newbie 7 02-01-2006 08:40 PM
Current sda: Sense Key Medium Error keekee Linux - Hardware 3 11-19-2004 12:06 PM
Hard drive failure error? (sense key Medium error) Arodef Linux - Hardware 2 11-02-2004 12:39 PM
"Undeleting" data using grep, but get "grep: memory exhausted" error SammyK Linux - Software 2 03-13-2004 03:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:31 PM.

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