Oops, I did it again!

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:

  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).


About Eugen Mihailescu

Always looking to learn more about *nix world, about the fundamental concepts of arithmetic, algebra and geometry. I am also passionate about programming, database and systems administration.
This entry was posted in Hardware, linux, shell and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s