LinuxQuestions.org
Help answer threads with 0 replies.
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-25-2010, 09:24 AM   #1
sux01
LQ Newbie
 
Registered: Oct 2010
Posts: 1

Rep: Reputation: 0
How to recover .sql files in Linux


Well, I had a major problem with my Ubuntu system yesterday and after trying many different things to fix it I have came to the realization that the system, along with all of my data, is lost.

I don't know what happened to the system, it just crashed and now it wont load. I booted up into a Live USB and thought I would be able to get my data back that way, but sadly not. The partition shows up as "unknown filesystem type" when I run the boot-info script. I tried to fix it with TestDisk but with no luck so I have given up on trying to sort it out and now just want some of my most important data back.

The most important of which are two sql dumps, about 2MB each, that I really need to get back. I have found a program called PhotoRec that I think will do the job. I have played about with it and it has succeeded in recovering my images and mp3's, all of which are totally useless to me without the file names.

So, I know the data is all there and I have not written anything to the drive since the problem arose. But the issue I'm having is that I can't see the option to recover the .sql files. I have downloaded PhotoRec 6.12 which the release documentation says has support for ".sql phpMyAdmin, MySQL and postgreSQL dumps".

But I can't find that option. Does anyone know how to recover the .sql dumps in PhotoRec or any other tool?

Thanks for any help.
 
Old 10-26-2010, 05:31 AM   #2
cantab
Member
 
Registered: Oct 2009
Location: England
Distribution: Kubuntu, Ubuntu, Debian, Proxmox.
Posts: 553

Rep: Reputation: 115Reputation: 115
Quote:
Originally Posted by sux01 View Post
I have played about with it and it has succeeded in recovering my images and mp3's, all of which are totally useless to me without the file names.
If your mp3 files were properly tagged, you can automatically rename them based on the tags. There are various tools to do that.

Indeed it looks like despite the documentation, PhotoRec 6.12 isn't offering to recover .sql files. Maybe try compiling from source? (Perhaps it's a configuration option that wasn't used in the provided binary.) If that's no help you could always email the PhotoRec developer.
 
Old 10-26-2010, 11:02 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by sux01 View Post
Well, I had a major problem with my Ubuntu system yesterday and after trying many different things to fix it I have came to the realization that the system, along with all of my data, is lost.
The key phrase "after trying many different things to fix it", if explained, might shed a light on things. That is if you have a list of things you did to (or inflicted upon ;-p) the system after the crash.


Quote:
Originally Posted by sux01 View Post
The partition shows up as "unknown filesystem type"
Could you run 'fdisk -l | tee fdisk.log' and 'testdisk /debug /log /dev/devicename' (where "/dev/devicename" is the device name of the whole hard disk) and attach the "fdisk.log" abd the one from testdisk?


Quote:
Originally Posted by sux01 View Post
(..) I can't see the option to recover the .sql files. I have downloaded PhotoRec 6.12 which the release documentation says has support for ".sql phpMyAdmin, MySQL and postgreSQL dumps". But I can't find that option.
cantab is right: if you build the tools yourself you need to have all the development libraries available at compile time.


Quote:
Originally Posted by sux01 View Post
Does anyone know how to recover the .sql dumps in PhotoRec or any other tool?
The ".sql phpMyAdmin, MySQL" part you mentioned means different things: dot-sql is for SQLite version 3 databases (see the source) and MySQL in the case of Photorec means .frm and .MYI support only.

Photorec tries to find files in all or unallocated space by looking for headers and footers: simply said starting and ending lines of files that are characteristic for a file type. An example would be a static plain text HTML page because it starts and ends with the HTML tag. Some files don't have all required characteristics. For instance a JPEG image starts with "JFIF" but does not end with a specific footer. What a MySQL dump looks like depends on the tool you used. For instance if you used 'mysqldump' then if you used "-x" ("--xml") you got well-formatted XML but phpMyAdmin-driven dumps are plain text files but with a "phpmyadmin version x" header but no particular footer. What's more is that files may occupy space that is "linked" (secondary and tertiary blocks) and in all these cases Photorec will have to guess file boundaries. So the end results can not be guaranteed: for example you may end up with a 50 meg JPEG that on closer inspection also includes a copy of Something Completely Different but if your dumps are plain text it wouldn't be hard to edit them. (I suppose you didn't make any backups?)

Before or while you run 'photorec' to recover plain text files I suggest you recon the disk again, maybe in another machine if you suspect HW problems, because resurrecting the partition might just be the most efficient way.
 
  


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
How to recover the windows files from RedHat LINUX vigneshwaran05 Linux - Newbie 1 06-07-2010 11:55 PM
Using linux to recover windows files doza General 8 07-17-2009 04:19 PM
How to mount/recover files from crashed Linux OS? alar Ubuntu 3 09-14-2006 05:13 PM
recover deleted windows files from linux(help) rkrishna Linux - General 2 06-22-2005 11:32 AM
Recover Files in Linux??? How to??? DeathGoth Linux - Software 1 10-17-2004 03:35 PM

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

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