Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 03-12-2004, 10:58 PM   #1
LQ Newbie
Registered: Aug 2003
Posts: 24

Rep: Reputation: 15
"Undeleting" data using grep, but get "grep: memory exhausted" error

So I have done all sorts of research into recovering files on an ext3 file system, and since ext3 actually zeros-out inodes instead of flagging them like in ext2, the old undelete software is useless. Thus, I am turning to good ole grep to help me. I am doing the whole:

grep -a -B50 -A50 "search string" /dev/sda3

thing, and my problem is that grep takes up so much memory over time that it pukes. I can run top while running that grep command and see the available memory get smaller and smaller until there is virtually none left and grep pukes.

So, I have 256MB RAM and an 18GB HD. Is there a fix for this? Can I get grep to write it's temp data to another hard drive instead of the memory?
Old 03-13-2004, 04:31 AM   #2
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
I think you answered your own question - a delete in ext3 zeroes out the markers instead of inactivating them, and as a result, that more or less kills any opportunity for an undelete. The grep option is basically a last resort, but perhaps you can boost your memory? I don't know if your budget/interest would validate going to 512Mg RAM or 1G RAM, but if the data is that important, you may be able to cost-justify the expense. Good luck with recovering the data. -- J.W.
Old 03-13-2004, 03:11 PM   #3
Registered: Aug 2003
Location: Akron, OH
Distribution: Fedora Core 3
Posts: 185

Rep: Reputation: 30
you could try searching the disk in parts, something like the following to search 500M at a time:

dd if=/dev/sda3 bs=1048576 count=500 | grep ...
dd if=/dev/sda3 bs=1048576 skip=500 count=500 | grep ...


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
"grep" Command (SystemV/68 system) xtremexp Other *NIX 3 05-28-2005 07:25 PM
How to use "OR" option in a grep command. sumitarun Programming 3 04-18-2005 01:44 AM
"grep" and "tcpdump" Magsol Linux - Newbie 2 03-25-2005 11:56 PM
"grep: /etc/issue: No such file or directory" hunter_one Linux - Software 6 10-15-2003 03:27 PM
"pipe: memory exhausted" problem nixie Linux - Software 1 09-02-2003 01:56 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:50 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
Open Source Consulting | Domain Registration