LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-05-2010, 02:31 PM   #1
JanusPaul
Member
 
Registered: Nov 2004
Location: Houston, Texas
Distribution: Ubuntu, Debian, Solaris, Free BSD
Posts: 82

Rep: Reputation: 15
Question ext3 rm -rf undo


Hello,

Sometime lastweek my Linux Mint 64-bit installation became rootkitted and somebody felt it very kindly to wipe out a 1.5 TB drive that had priceless data on it. I know you're not suppose to put all your eggs in one basket but lets face it, I'm broke. Assuming the data wasn't over written by some dd if=/dev/zero of=(file), there has to be a way to recover some of the files off an ext3 partition.

Any suggestions would be much appreciated.
 
Old 10-05-2010, 03:09 PM   #2
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
First I would mount the partition read only to another system so you can minimize the block over writes and then use something like foremost to scan the partition for identifiable files.

You find some of the tools you need in sleuthkit which is in the ubuntu repos.

http://www.sleuthkit.org/
http://foremost.sourceforge.net/ (is in the sleuthkit)
 
Old 10-05-2010, 03:38 PM   #3
tkoguntebi
LQ Newbie
 
Registered: Feb 2009
Posts: 3

Rep: Reputation: 0
Thanks for the information frndrfoe.

I recently made the same mistake: rm -rf my_dir/
where my_dir contained many large files (movies, etc). I hit CTRL-C but unfortunately many had already been deleted. The drive was an external drive (Seagate Freeagent).

Would these tools work on large files on an external drive?
Any special suggestions for this case?
 
Old 10-05-2010, 04:10 PM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by tkoguntebi View Post
Would these tools work on large files on an external drive?
Any special suggestions for this case?
I doubt that the fact that it's an external drive could make any difference.
 
Old 10-05-2010, 04:13 PM   #5
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
It does not matter how the drive is connected so it should work fine. Foremost looks for file headers and footers in the data blocks, allocated or not, and tries to extract the files based on the headers/footers that match what you have in foremost.conf. It has several pre-configured file types that you can comment/uncomment for your needs. If you don't see a pre cooked configuration for your file type you can do a little leg work and create on by looking at some known good files in a hex editor or by just searching the interwebs.

Always try to get a dd image of the drive in question if you can so if you discover a better method later you can revisit it.
 
Old 10-06-2010, 12:33 PM   #6
JanusPaul
Member
 
Registered: Nov 2004
Location: Houston, Texas
Distribution: Ubuntu, Debian, Solaris, Free BSD
Posts: 82

Original Poster
Rep: Reputation: 15
Thanks for the suggestions guys. I hope you recover what you lost.

What hurts most is all the source code I've written from scratch, from examples, proof of concepts and code from jobs in PHP/VB6/C#.NET/JavaScript/Tcl/Java/Perl, C plugins for The Palace Visual Chat Linux server... just gone...

Somebody has absolutely no honor.
 
Old 10-16-2010, 10:17 PM   #7
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
grep -a -A500 '#!/bin/bash' /dev/[your_partition] > file.txt

Could be used to grep from the raw disk to get 500 lins after finding the grep argument '#!/bin/bash'
 
Old 10-17-2010, 04:01 PM   #8
zhaozhou
LQ Newbie
 
Registered: Oct 2009
Location: Sweden
Distribution: Gentoo
Posts: 23

Rep: Reputation: 1
You should know that ext3 does not just mark file space as unused - something ext2 and NTFS does, it actually overwrites any of your deleted data with zeroes.

Read this;
http://batleth.sapienti-sat.org/proj.../ext3-faq.html


EDIT: I would like to point out that ddrescue is an awesome tool for handling harddrive crashes and the like, could be worth looking into.

Last edited by zhaozhou; 10-17-2010 at 04:03 PM.
 
0 members found this post helpful.
Old 10-17-2010, 08:22 PM   #9
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
Quote:
it actually zeros out the block pointers in the inode
It does not actually zero the sectors that contain the data itself, just the inode pointers.
 
1 members found this post helpful.
Old 10-18-2010, 09:09 AM   #10
zhaozhou
LQ Newbie
 
Registered: Oct 2009
Location: Sweden
Distribution: Gentoo
Posts: 23

Rep: Reputation: 1
Darn! My bad, my bad.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rm -rf * , want to undo this postiwala Linux - General 6 04-21-2007 05:45 PM
Ext3 & tune2fs tweaking question for ext3 experts wrc1944 Linux - General 8 12-11-2005 07:45 AM
How do i undo this?! Jengo Slackware 2 07-13-2004 11:50 AM
How to undo this? latino Linux - Software 4 09-21-2003 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:17 AM.

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