Please note that this blog has been moved.
Now it has its own domain: mynixworld.info🙂
If you want to read the latest version of this article (recommended) please click here and I open the page for you.
Those who are playing with fire sometimes they just get burned.
I was trying to create a backup for one of my HDD partition, some kind of partition-to-partition backup. After playing a while with dd and experimenting different CLI options I decide to try Clonezilla which basically do the same things but faster (well, there are some differences but I’m not going to get into this right now).
When you want to clone a source partition to a target destination (partition), the destination partition should be at least as large as the source partition. Clonezilla allerted me that my target partition was 4 cilinders smaller (that’s about 255 x 63 x 512 x 4 bytes) than the source partition. So I decide to delete the target partition and to create it 4 cilinders larger.
BUT instead of deleting the destination I’ve deleted the source partition!
Because I had (on the screen) all the deleted partition information it was piece of cake to recover it:
In such kind of situations the simples, fastest and (I guest) safest way of recovering is the same fdisk (or parted) utility. All you have to do is to create a partition with exactly the same parameters. At prompter run the following commands:
- fdisk (run the utility)
- n (create a new partition)
- l (when asked specify the l=logical partition type; in my case it was logical, in your case could be primary, depending of your particular partitioning scheme)
- 2111 (when asked specify the starting sector of partition, as it was originally)
- 104859710 (when asked specify the ending sector of partition, as it was originally)
- w (after creating don’t forget to write the new partition table to the physical disk)
That’s all folks!
Note: You could also try TestDisk (I was tempted to gave it a try but in my case it was easier/faster with fdisk).