LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-21-2004, 10:07 AM   #1
codedv
Member
 
Registered: Nov 2003
Location: Slough, UK
Distribution: Debian
Posts: 146

Rep: Reputation: 15
Recovering vfat file system


Does anyone have any tips on recovering a vfat filesystem? The problem is with a 32MB usb device. Windows says it hasn't been formatted so my guess is a corrupt FAT table.

I plugged the device into my linux box and executed the following command:
#dd if=/dev/sda of=backup

I now have a 32MB file but not sure what the next course of action is I should take to recover the data.

Last edited by codedv; 01-21-2004 at 11:00 AM.
 
Old 01-21-2004, 04:03 PM   #2
MartinN
Member
 
Registered: Nov 2003
Location: Ronneby, Sweden
Posts: 555

Rep: Reputation: 30
I guess you can't mount the file (since it's corrupt)?

mount -o loop -t vfat filename somedir/

Regards
Martin
 
Old 01-21-2004, 04:15 PM   #3
codedv
Member
 
Registered: Nov 2003
Location: Slough, UK
Distribution: Debian
Posts: 146

Original Poster
Rep: Reputation: 15
I didn't compile loop support into my kernel
 
Old 01-22-2004, 02:24 AM   #4
MartinN
Member
 
Registered: Nov 2003
Location: Ronneby, Sweden
Posts: 555

Rep: Reputation: 30
Hi again

Haven't tried this myself, just a hint at a direction...
man dosfsck
Since you have made a backup file I suppose that you could try this directly on /dev/sda

Please, let me know if that command really helps.

Good luck!
Martin
 
Old 01-22-2004, 03:34 AM   #5
codedv
Member
 
Registered: Nov 2003
Location: Slough, UK
Distribution: Debian
Posts: 146

Original Poster
Rep: Reputation: 15
I have tried to mount /dev/sda with no success.

On attempting to use dosfsck I got an I/O error on the device - The question is I have managed to copy the entire device file to my local filesystem and it has clearly retireved some data as I did a hexdump of it, but how do I get it back?
 
Old 01-23-2004, 06:09 AM   #6
MartinN
Member
 
Registered: Nov 2003
Location: Ronneby, Sweden
Posts: 555

Rep: Reputation: 30
Ok. Sorry for this late response. I've been playing around a little with fat file systems and dosfsck. This is (in short) what I did:

o I created a 1MB (1024 blocks) vfat file system as a file:
~> /sbin/mkdosfs -C fatfile 1024

o Then I could mount this in the file system:
~> mount -o loop -t vfat fatfile fatsys/

o Then I could copy some small text files in to the file system. After unmounting I had a 1MB file containing some text files.

o In an attempt to break stuff, I opened the file in an emacs hex-buffer, located the file system table and entered a few random characters

o I could still mount and umount the file system (as above) but the file sizes and names were now corrupted.

o The trick was to run dosfsck on the file and answer the questions correctly:
~> /sbin/dosfsck -r fatfile
Note here that I ran dosfsck on the file, not the mounted file system.

I hope that this helps. Make a few backup copies of your file before running dosfsck on it, since dosfsck asks you questions about how to repair that are non-trivial.

Good luck!
Martin
 
  


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
Recovering Filesystem aig Linux - General 3 06-21-2004 11:41 PM
Recovering data CatSC Linux - Newbie 3 12-31-2003 11:25 PM
Recovering eggoz Linux - Newbie 1 06-13-2003 11:38 AM
help recovering HD bobsmith Linux - General 6 01-11-2003 12:47 AM
copy files from vfat to vfat from linux? purpleburple Linux - General 2 12-11-2002 03:24 PM

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

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