My *nix world

Oops, I did it again!

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 alerted me that my target partition was 4 cylinders 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 cylinders larger.

Recover deleted partition

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:

recover deleted partition

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:

  1. fdisk (run the utility)
  2. n (create a new partition)
  3. 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)
  4. 2111 (when asked specify the starting sector of partition, as it was originally)
  5. 104859710 (when asked specify the ending sector of partition, as it was originally)
  6. 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).

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.

 
The following two tabs change content below.
Oops, I did it again!

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: