I was trying to copy a cross-compile of uboot .img to the sdcard file attached in the ubuntu(running on virtual-box under windows 10 host) but ended leaving the working ubuntu into some undefined state which I want to recover from. In the ubuntu I could see /dev/sda1 that was created using the cmd

createrawvmdk -filename"D:\Virtual_Machines_Hard_Drive_Area\image_linux\sdcard_attachment_file\sdcard.vmdk" -rawdisk "\\.\PHYSICALDRIVE1"

correctly mapping to the 8GB sdcard as attached to laptop. But the command

sudo dd if=sdcard.img of=/dev/sda1 bs=2048

corrupted my working copy of ubuntu that its not booting with an error of unknown file system.

I have lots of dev tools configured in the version of Linux. Please help me to recover the same if possible.

  • 3
    There's no recovery and the command overwrote the vm's main partition. There wasn't any corruption, just a user's tragic mistake. If you don't have a backup - you should and with a virtual drive as easy as copying that file - now you have to reinstall everything. – user931000 Sep 2 '19 at 20:21

Usually, sda1 is the first partition on your first hard-disk. So, you have overwritten the initial sectors of that partition with the img image.

If you are using uefi and you have the efi system on sda1, you can recover by booting with a live-cd and reinstall grub.

But if you are using the legacy boot inside virtualbox and sda1 is the partition with your linux... there is no way to recover the system.

  • Thanks for the response. No unfortunately I was not enabling the elf from virtual box. But the output of the lsblk command was showing sda1 as 7.5GB (Matching the size of the 8GB SDCARD attached). I think I should have confirmed the correct mapping of the SD Card to sda by plugging in and out the SD card or renaming the virtual disk image of SDcard in windows directory. – Gurmeet Singh Sep 3 '19 at 6:28

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.