When you work with several disks is easy to get confused and to delete a partition that you don't really want.
First advice: DO NOT PANIC! In fact STOP doing anything!
Try to figure out what went wrong, what you have done, then try to understand how to undone the last operation(s).
We should know from the beginning that a partition and belonging to the partition are two different things. Whenever you delete a partition the partition's data is not removed automatically. The partition table is only adjusted accordingly. That's all. If we could redefine the partition table as it was initially then the whole situation would looks like nothing was happened (meaning: you don't deleted the partition).
Rescue a deleted partition
Because sometimes you will find yourself in the worst possible situation ever (not in the most favorable one) we should analyze few real-life situations:
- you deleted accidentally the partition
- (1) + you have created one or more additional partitions
- (1) or (2) + you have written some data on the disk
- you have formatted the disk and furthermore you have created a one or more partitions
- (4) + you have written some data on the disk
In the first situation (1) all you need is a tool named TestDisk. You could use also a LiveCD that might include the TestDisk utility. The tool is very handy, the most appropriate way of learning "how to use it" should be its web page "Test Disk Step By Step".
Tips: whenever TestDisk finds one or more deleted partitions and you want to select it(them) in order to recover it(them), you should press
key. In the online guide (see above, section "Quick Search for partition") they are saying "Highlight this partition and press p to list your files" but they hadn't defined what means "highlight". So, now you know...
In the second situation (2) mentioned above you might Â use the same tool but just remember that then you will have two (or more) partitions that overlap on each other. In that case you should first delete the newly created partition (which should contains neither filesystem nor files) and later, when you highlight the old deleted partition that have to be recovered, you should choose your old partition and not the new created one (which you deleted one second earlier).
More than this, in all the situations mentioned above, when you are selecting a partition just press p key to list the files that might appear in the partition's filesystem. If you get a message like "No file found, filesystem may be damaged" then it means exactly what the message is saying. So maybe that is not the partition you are looking for. This tip will help you to choose between two partitions which overlap each other. If you know already the filesystem structure (or the path to a particular file which should reside on the deleted partition) then you might search for it by listing the partition file (see the p key). If you found it then it means that that is your partition. You can even copy a particular file to a local folder without restoring the old deleted partition, if you want too.
In the third (3) situation mentioned above you might recover your deleted partition exactly like you did in the second (2) situation. Because you had created a new partition and you had written some file(s) to the disk, it might happen that some files had been overwriting so it will be little bit difficult to recover the whole content. Anyway, if you are lucky enough then they might still be intact so your life will be easier.
To recover a particular (damaged) file from the recovered partition I would recommend you the PhotoRec utility. It knows the pattern of few files (like zip, office, pdf, html, jpeg and many others) and based on these it knows how to read recreate the file content by reading the physical sectors. Anyway, if using PartedMagic LiveCD then you might use many other tools/utilities which will assist/help you to recover your partition and/or data.
For the forth (4) and the fifth (5) situation mentioned above see the solution described for (3).
Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.
Latest posts by Eugen Mihailescu (see all)
- Symfony authentication redirect after each request - January 22, 2018
- Emerging Perl without Perl in Gentoo - September 26, 2017
- How to choose your decoupling capacitor - September 9, 2017