LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-29-2008, 08:51 AM   #1
jsstevenson
LQ Newbie
 
Registered: Jul 2006
Location: Scotland
Distribution: Gentoo
Posts: 21

Rep: Reputation: 0
If I know the sector position and file size, is this sufficient to recover a file?


Hello...

I am in the process of recovering my brother's 200GB harddrive which is formatted as NTFS. The need for recovery has developed as a result of a corrupted MFT.

Initially I backed up the drive using a a RAW read under linux. Now though, using Windows XP, I have nearly identified all of the MFT entries that are recoverable on the drive via a sector level scan of the drive which produces a report detailing all the recoverable files and sector position they start at, their size, name, etc...

On looking at the report it has raised my interest as to whether I could take the report and use the comma de-limited information contained within to recover the files using linux, more out of academic interest than anything else!

So for example imagine I had a hard drive and it contained 2 files. Assume also that I know the starting sector position on the drive that each file begins, say sector 246,519 and sector 2,952,055. Also assume that I know the size of each file, say 157,775 bytes and 203,488 bytes respectively. Could I use, for example, the dd command to successfully retrieve the missing files that I have start sector and file size details for? If I could, how would I structure the command using a starting sector and file size? Or are there alternative methods?

I am unsure whether this would work in practice as I am unsure whether a file that starts in a given sector will necessarily be stored sequentially based on the file size or whether in reality it is much more likely that the file will be fragmented across non-sequential sectors with the only know sector being the starting sector!

Any comments would be very welcome.

Thanks
Jamie.
 
Old 09-29-2008, 09:26 AM   #2
mk27
Member
 
Registered: Sep 2008
Distribution: fedora, gentoo, ubuntu
Posts: 148

Rep: Reputation: 23
I have never tried doing this altho I believe it will work if the file exists sequentially. The format for dd would be

dd if=/dev/hda1 of="filename" bs=1024? seek=a multiple of bs into device count=a multiple of bs equal to filesize

Probably use an extra block or two since getting too much won't hurt, and sometimes files have little 32 byte things on the end that you might need.
 
Old 09-29-2008, 10:35 AM   #3
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by jsstevenson View Post
If I know the sector position and file size, is this sufficient to recover a file?
Files are often fragmented, so this will work
only if you are lucky and file contents are stored in sequental order.
I'd look for some ntfs recovery tools/articles.
 
  


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
Need help to recover Deleted file - (file was saved in doc) Pravab Ubuntu 2 08-17-2008 10:57 AM
Display by File Name, File Size, and File Owner using ls akeenabawa Linux - Newbie 9 08-15-2008 02:21 PM
any ideas to reduce log file size or make log file size managed? George2 Programming 2 08-13-2006 06:55 AM
LXer: Cluster File Systems Attains World Leadership Position In High Performance File System LXer Syndicated Linux News 0 07-14-2006 06:21 AM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 03:15 AM

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

All times are GMT -5. The time now is 03:47 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