LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 01-04-2004, 11:37 AM   #1
PsychoFarmer
Member
 
Registered: Feb 2003
Location: Kenyon College
Distribution: Fedora Core 3
Posts: 39

Rep: Reputation: 15
How do I recover old partition tables in linux?


I recently accidently formatted and repartitioned over a fat32 drive, and now really really really need to recover the information on it. I tried using Norton unformat, but it doesn't work on anything non-dos.

Any suggestions on what program I should use to restore the partition table?
 
Old 01-04-2004, 12:16 PM   #2
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
if you formatted it, you're mostly hosed.
if you used windows fdisk to create a partition on it and deleted the
partition with windows fdisk, it overwrote a bunch of stuff at the beginning
of the disk.

if you want to recover some stuff, your best bet is to use some professional
recovery tools. don't partition, format or anything else the drive.
you can use a disk editor or dd or cat to search the drive for certain text
as it is if you wish. you may be able to recover some unfragmented
files.

but for practical purposes, everything is already lost, unless you want to
spend big bucks for some pro data recovery place to restore it for you.
 
Old 01-04-2004, 12:29 PM   #3
PsychoFarmer
Member
 
Registered: Feb 2003
Location: Kenyon College
Distribution: Fedora Core 3
Posts: 39

Original Poster
Rep: Reputation: 15
the drive was repartioned during the fedora core 1 install... doubt that helps me much more though...

what recovery tools do you recommend to use?
 
Old 01-04-2004, 01:25 PM   #4
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 46
A search on this site will bring up some useful threads.
A google search for:
Code:
linux partition table recovery
returns the following page as a link in the first hit:
http://bmrc.berkeley.edu/people/chaffee/fat32.html
GNU's parted would probably be useful too.

There is also a free (as in beer; also only runs on a windows machine) recovery program here:
http://www.data-recovery-software.ne...Recovery.shtml
I've never used it so can't vouch for it (I found it using a google search: linux unformat).

The very first thing you should do is back up your entire disk using dd (a linux utility--if you want to back it up using some non-linux utility, I can't help with that). Apparently the r_linux software knows how to back up the disk so what comes next may not be useful to you if you go with their software. . .

To do this backup with dd, you need to have anywhere from 10-30% (depending on your usage of the disk) of the entire (damaged) disk capacity as free space available on another drive, as well as a linux system that has dd and gzip installed (could be as simple as an install CD/floppy).
For a 20 GB hard drive, you can do the following:
Code:
set 0 1950000 3900000 5850000 7800000 9750000 11700000 \
13650000 15600000 17550000 19500000; for i; do /bin/dd \
if=/dev/hdb bs=1024 count=1950000 skip=$i | gzip > \
/backup/backup_$i.gz; echo $i; done
This will take 11 ~1.95 GB chunks from the disk and compress them using gzip before writing to the backup disk. You want to use less than 2 GB because of file size limitations that may exist.
For a drive of a different size, you'll have to change the numbers so you cover the entire drive and don't try to skip past the end of the drive. /dev/hdb is the device name of the bad drive. bs=1024 is the block size and should be left alone.
/backup is the directory to which the chunks of the drive will be saved.

Once you've made a backup of the drive, you can try to fix it without worrying about completely losing any chance you had before you started trying to fix it. To recover the data back to the drive, you can do:
Code:
set 0 1950000 3900000 5850000 7800000 9750000 11700000 \
13650000 15600000 17550000 19500000; for i; do gzip -d -c \
/backup/backup_$i.gz | dd of=/dev/hdb bs=1024 \
count=1950000 skip=$i; echo $i; done
I don't do unformat or partition recovery, but the seaches suggested above will probably help you in finding information. . .
 
Old 01-04-2004, 01:42 PM   #5
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
if the drive was just one big fat32 partition, you can recreate a big fat32
partition with linux's fdisk. linux's fdisk only overwrites the partition table.
the windows fdisk zero's out some data at the beginning of the drive, so
don't use that.
anyway, making one big fat32 partition, using the whole drive, will be like
"recovering" the partition, if that's the way it was before. you can then
have norton try to recover files on the drive after that.

like moses said, if you backup the whole drive with dd first, you can
try whatever you want to try, and just keep restoring it when you want
to try something else.

what all has been written to the drive? was it partitioned as one big
linux partition, and formatted, or was there more than one partition?
was anything written to the the formatted drive?

specifically what are you trying to recover? if you are hoping to get
everything back, give up now. if you just need some text or data files
back, you may be able to get them.

if it's worth it. (thousands of dollars) a profession recovery pplace has
equipment sensitive enough to recover data that has been overwritten
a few times.
 
Old 01-04-2004, 05:14 PM   #6
ac1980
Member
 
Registered: Aug 2003
Location: Trento, Italy
Distribution: Debian testing
Posts: 394

Rep: Reputation: 30
Just to make you understand, here is the point: on fat32 files and dirs are written in blocks (tipically 4-32K). There is a table that, for each cluster, says if it is empty, if it's the last one of a file, or tells the number of the logically subsequent cluster. There are generally 2 or 3 copies of this table, one at the beginning of the partition, and this is almost surely gone, and one or two more immedately after (I think). Bad choice, since this is the place were all FS write their own data. If all the tables are gone, you can't simply know where a file begins or ends, or if it's fragmented. If you manage to recover that table, still you may get wrong data since some sectors of the disk have been overwritten by mke2fs.
If you actually INSTALLED fedora on top of your disk, you probably won't get any useful data out of it with software tools!
However if you only changed the partition table without actually creating new filesystems, you'll likely be able to recover a full working system via whansard's advice.

If you formatted but didn't install, try posting your partition table as it is now, we can tell you if it's worth keeping trying...

best wishes
Alessandro
 
  


Reply


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
Partition tables, multiboot and Linux javier030664 Linux - General 1 06-15-2005 06:22 PM
Fedora 3/winXP corrupted partition tables frankinmerth Linux - Newbie 4 04-13-2005 04:06 PM
Filesystems and Partition Tables blkmage Linux - Hardware 0 09-10-2004 04:15 PM
Recover deleted files from a Win partition in Linux? PenguinPwrdBox Linux - General 3 08-03-2004 04:05 AM
Using Linux to recover data on a damaged Windows partition? Korff Linux - General 5 12-29-2003 11:35 AM


All times are GMT -5. The time now is 06:38 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration