Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,302
Rep:
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.
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:
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,302
Rep:
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.
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...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.