I had installed opensuse in UEFI mode in my computer but having a legacy Windows so it did not appear in boot menu. Following a weird tutorial on the internet I dd the Windows partition of my sda.

I used

dd if="some img" of=/dev/sdaX bs=4m

with X being the partition. The img was just some KB. I am aware, don't know whether it is true or not, that dd starts writing from the first block of the device and therefore I think it just overwrote the partition information of the first KB of the partition block and therefore the system doesn't know what file system it is and therefore cannot mount it. But I don't know if dd has wiped all the remaining data. Hence my question is whether there is a way to recover my data from that particular partition.

  • If you did not poweroff or reboot your computer, there is a chance that you can get things correctly according to the accepted answer to this question at AskUbuntu: Accidentally did dd /dev/sda. Otherwise (if you have powered off or rebooted the computer) some other answer over there can be useful. – sudodus Feb 24 at 19:02

If your img was of a partition/file-system then sdaX is now a functioning copy.

If your IMG was something else "just some KB" (do you mean is was less than 1MB in size?) then you likely don't have your data anymore.

You can check if IMG is a valid file-system by mounting it with a loopback device.

You can use PhotoRec to attempt recover of data from sdaX (assuming you did not zero it)


Thedd program starts to write at the start of the partition, unless you specify otherwise. It also just writes the data from the source to the destination, it does't fill the destination partition if it is larger than the source.

So if your source file was just a few kB, than most or all of your data should still be present. The problem is to find out where on the partition it is.

First you should make a backup of the whole partition.

If those few kB were really just a few kB, it should be possible to create a new file system of exactly the same type in this partition and then restore the rest after those few kB from the backup. The start of a filesystem often contains general information about the filesystem and is mostly constant. Many filesystems also have backup blocks of important data structures. You may be able to recover most of your data.

  • If there is a backup there is no need to attempt to connect just the start of the file system with the data. It would result in an unclean FS anyway. – user1133275 Feb 24 at 18:20
  • @user1133275 If there is a backup then it would have been used, so no need for a question here. What I suggested will not lead to a clean filesystem, but depending on how much was left intact might enable the retrieval of most of the data, including file names and directory structure. – RalfFriedl Feb 24 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.