Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've made a great mistake. I was trying to burn an iso image onto a usb stick with dd. I chose sda8 which appeared to be my USB stick and I ran the command with sudo. Now everything has gone mad and I cannot boot into Ubuntu or Windows that I had installed along it.

When I start my laptop now, it just says: error: unknown filesystem. grub rescue>

I have very important data on my drive and I am going crazy at the moment.

Can somebody please help me. I would appreciate it immensely.

share|improve this question
1  
I think you messed up your stuff. You can't really do much about it, if I understand correctly. Next time use df -h to find the usb drive for sure. –  Yet Another User Sep 19 '13 at 20:01
1  
Take a Live System (obviously made in some other system) boot into it and check what you messed up... if it was /boot or / you pretty much just nuked the system and if you are lucky to have /home apart then the fastest option is to reinstall. –  Braiam Sep 19 '13 at 20:03
    
Hello and thank you all for the help. A bit more info about my situation: I had Ubuntu 12.04 and Windows 7 installed. I used to have one partition for Ubuntu and two NTFS partitions for Win. Using a live USB, I can see the two NTFS drives right now. However, my most important data was in my Home folder in Ubuntu. How can I edit the file options for PhotoRec 6.14 to try and find all the .tex files on my drive? I cant see it in the options but it says on the net that it can do that. –  Shayan Sep 20 '13 at 10:21
add comment

2 Answers 2

up vote 0 down vote accepted

You have effectively erased the first 700MB of your hard drive. So what was in that? I am surprised you get a grub rescue as the MBR should have also been overwritten with syslinux and partition table converted to one entry for the FAT32 installer version.

You may be able to use testdisk to restore old partitions. If your dual booted Windows it has 100MB boot partition which will be gone and the first 600MB of Windows, so it will not boot. If Ubuntu was further into drive you may be able to recover it.

For what testdisk cannot recover with deeper search you can use photorec to scan drive for anything that looks like a file. It does not find file names, just extensions or file type. It is slow and you need lots of room for restored files as it will also find deleted files and some partial files.

https://help.ubuntu.com/community/DataRecovery

http://www.cgsecurity.org/wiki/TestDisk

http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step

http://www.cgsecurity.org/wiki/Menu_Analyse

http://www.cgsecurity.org/wiki/TestDisk:_undelete_file_for_NTFS

http://www.cgsecurity.org/wiki/PhotoRec

share|improve this answer
    
He wrote the data to sda8, not sda. –  Sukarn Sep 19 '13 at 22:12
    
Hello Fred, and thanks for the help! By only checking certain file types in File Options of PhotoRec, would I be able to limit the search and the space needed for the recovery? What I am most desperately searching for is a .tex file. I see that on the net PhotoRec is said to be capable of searching for .tex files, but I cannot find it in the software itself. –  Shayan Sep 20 '13 at 10:46
    
If you wrote to sda8, then only the first 700+GB of that partition should have been overwritten. Photorec has the settings for types under [File opts], I believe. It will not speed anything up as it still searches entire drive, but will then only find those files, so space will be less. You still have to write to another device. cgsecurity.org/wiki/PhotoRec_Step_By_Step –  oldfred Sep 20 '13 at 17:32
add comment

You wrote the data to sda8, which is a partition on your hard drive. A partition is also known as "Disk Drive", such as C:, D:, E:, etc. in windows.

The one you overwrote probably contained GRUB, the software that handles booting into Ubuntu (and Windows as well if you're dual booting).

GRUB resides on "/" or "/boot", depending on whether you made /boot or not when you installed Ubuntu.

You can make a live disk from another computer, use that on your computer to see if your data is still intact or not.

If you do not have a separate /home partition, you should back up your data using the live disk and an external hard drive before you install Ubuntu again.

Chances are, your system will be fine again if you install Ubuntu again and if you do not format /home and Windows partitions when you install Ubuntu. If you don't have a separate /home partition, then I would recommend that you make one this time, to keep your personal data safe from future formats.

share|improve this answer
    
Hello Sukarn and thank you for your answer. It seems that I have overwritten on my Ubuntu installation. But, I am trying to see if the files I need the most to recover resided further ahead in the drive. I am currently running a deep search using TestDisk and here is what I can see so far (57% complete): –  Shayan Sep 20 '13 at 10:54
    
How do I include larger text or attach log files here?! –  Shayan Sep 20 '13 at 10:55
    
Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63 The harddisk (500 GB / 465 GiB) seems too small! (< 2967 GB / 2763 GiB) Check the harddisk size: HD jumpers settings, BIOS detection... The following partitions can't be recovered: Partition Start End Size in sectors > HPFS - NTFS 60799 254 63 76981 253 62 259963767 FAT32 138768 113 19 360734 55 61 3565880179 FAT16 <32M 273162 34 1 330000 179 40 913111645 [ Continue ] NTFS, blocksize=4096, 133 GB / 123 GiB –  Shayan Sep 20 '13 at 12:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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