LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   unformat a harddrive (https://www.linuxquestions.org/questions/linux-newbie-8/unformat-a-harddrive-687809/)

millsrobert 12-02-2008 02:12 PM

unformat a harddrive
 
I have just installed Linux on a 60GB hard drive that was partioned into three drives C,D,E I thought that when I was installing Linux it was just going to format C: the whole Hard Drive was formatteted Is there any way to recover files lost
robert

Quakeboy02 12-02-2008 02:37 PM

Is this a class assignment or something? :) It seems like we're getting a lot of these lately.

But to address your question quite brutally: Yes, there is a way that *some* of your data *might* be retrieved, if it was worth your time to spend hours on the process of running the program and identifying the lost files based on their content. But, given whole your implied experience, I'd say the data is gone, and just move on.

mazhar_theone 12-02-2008 02:46 PM

It is possible to recover data if the partition is (only)formatted. But as you have re-partitioned the hard drive and file system is also changed from fat / NTFS to ext3 / swap etc... and some space (on HD plotters) may have been overwritten by Linux files / folder on your Hard drive, it is quite difficult recover old data.

pixellany 12-02-2008 02:54 PM

I do not think this sounds like homework. Further, at least some of the data is probably recoverable.

First, don't do anything that could cause writing to the disk. The ideal way to proceed would be to boot from "Live CD" Linux or maybe put the drive into another computer and access it from there.

Next, we need to know the layout of the disk. It sounds like you selected automatic partitioning and let Ubuntu have the whole disk. This means that you no longer have the partitions you mention....but **some** data is still recoverable. Run "fdisk -l" and post the results here (In spite of my admonition, this can be done safely from your current linux setup.)

Some basics:
In the typical PC, a harddrive is set up with one or more partitions. The Windows culture mistakenly names these "drives"--eg the "C drive".

Partioning does not alter data--it only changes the addressing contained in the partition table.

Creating a filesystem on a partition WILL alter some data, and of course installing the new OS will overwrite a lot more data


I have little personal experience, but the tool most often recommended is "testdisk". Again, the ideal would be to run this from a different physical drive--or from live CD. (I don't know if testdisk is available on live CD.)

jschiwal 12-02-2008 03:23 PM

Check if the MBR was backed up (in the /boot directory).
Code:

:/boot> sudo file backup_mbr
backup_mbr: x86 boot sector;
partition 1: ID=0x7,          starthead  32, startsector      2048,  3072000 sectors;
partition 2: ID=0x7,  active, starthead  0, startsector  3084480, 147492765 sectors;
partition 3: ID=0xf,          starthead 254, startsector 150577245, 222082560 sectors;
partition 4: ID=0x17,        starthead 254, startsector 372666368,  18055168 sectors

You didn't indicate which distro you installed. SuSE's repair option can try to undelete a partition.

Look for a file in /boot that is 512 bytes long. You could use fdisk or sfdisk to repartiton the drive. This may ruin your linux install, but if all of the files are located before the ressurected second partition, running fsck may fix it. The partitions D: and E: may be recoverable. Use "fdisk -u" so that you use 512 byte sectors.

It would be safer if you worked from a live distro, or the rescue mode of your install disc.

Duck2006 12-02-2008 04:46 PM

Knoppix you may be able to recover some of your data.

http://www.shockfamily.net/cedric/knoppix/

millsrobert 12-03-2008 01:33 PM

unformat a harddrive
 
thanks for the usefull information
some of us are not experts at everything

regards
robert

Quakeboy02 12-03-2008 04:33 PM

Quote:

Originally Posted by millsrobert (Post 3363345)
thanks for the usefull information
some of us are not experts at everything

regards
robert

Robert,
I didn't quite mean to put you off; just to give you some idea of the task ahead of you. If it's important information that's not backed up, then there are several things you can do; beginning with making a byte-for-byte copy of the disk to a spare and then working with the spare to try to retrieve it. It's possible that if you can simply repartition the drive to what it was before you did this then the wiped partitions will magically reappear. It all depends on how much effort you want to put into it. If it's critical data and you're willing to learn and work, say so, and someone will go all out to help you with it.


All times are GMT -5. The time now is 09:55 AM.