Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running Debian Squeeze in my laptop. I did a big mistake. Instead of doing fdisk /dev/sdb (which is my usb pendrive), I fdisk-ed /dev/sda, which is my primary hdd. When prompted, I chose options o and w and the reboot my machine.

Now, I cannot start my machine as it says no OS found.

Is it that, all my data is lost or only the partition table? How do we recover the data?

Edit:- Initially I had 5 partitions. The partitions are as follows:- A 105 GB for Windows installation, a 170 GB for storing data (possible NTFS), another 170 GB (possibly NTFS), a 1 GB (swap space) and 20 GB (ext4 partition). I was having a debian squeeze and win 7 dual boot.

105 GB 170 GB 170 GB 1 GB 20 GB

After loading an Ubuntu live cd, when I tried to see whether any partition structure exist using the Gpart command like,

sudo gpart /dev/sda

I got the following output:

ubuntu@ubuntu:~$ sudo gpart /dev/sda

Begin scan...
Possible partition(Windows NT/W2K FS), size(107419mb), offset(59139mb)
Possible partition(DOS FAT), size(2mb), offset(187738mb)
End scan.

Checking partitions...
Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): primary 
Partition(Primary DOS with 12 bit FAT): primary 
Ok.

Guessed primary partition table:
Primary partition(1)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 107419mb #s(219996159) s(121117248-341113406)
   chs:  (1023/254/63)-(1023/254/63)d (7539/51/1)-(21233/83/33)r

Primary partition(2)
   type: 001(0x01)(Primary DOS with 12 bit FAT)
   size: 2mb #s(4544) s(384488496-384493039)
   chs:  (1023/254/63)-(1023/254/63)d (23933/77/1)-(23933/149/8)r

Primary partition(3)
   type: 000(0x00)(unused)
   size: 0mb #s(0) s(0-0)
   chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

Primary partition(4)
   type: 000(0x00)(unused)
   size: 0mb #s(0) s(0-0)
   chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

ubuntu@ubuntu:~$

The screenshot is at enter image description here

Shall I continue to write to the disk ? Does the partitions shown match my previous partitions as I mentioned ?

share|improve this question

migrated from serverfault.com May 20 '13 at 10:13

This question came from our site for professional system and network administrators.

    
As per the faq, this site is not about anything in a home setting –  dawud May 20 '13 at 7:46
2  
Time to pull out your backups –  Mark Henderson May 20 '13 at 7:47
    
@MarkHenderson inb4 "backups? what backups?" –  tombull89 May 20 '13 at 7:58

2 Answers 2

up vote 0 down vote accepted

Boot from a Live CD and try using testdisk or gpart utilities, which can in many cases find lost partitions automatically. One popular Live CD distribution suited for such recovery tasks is SystemRescueCd.

share|improve this answer
    
Please see the edits in my question. –  Roshan George May 20 '13 at 11:49
    
Try sudo gpart -k 2048 -n 2048 /dev/sda — Microsoft operating systems since Windows Vista and recent Linux distributions usually align partitions to 1 MiB boundaries, which does not match the default gpart assumptions. If gpart still does not find your partitions, you can also try sudo gpart -k 1 -n s /dev/sda, but this can take a very long time. –  Sergey Vlasov May 20 '13 at 12:05
    
Thanks for the suggestio. Can you look at the scrrenshot and the partitions I specified. Does that match ? –  Roshan George May 20 '13 at 13:48
    
Also, I am using Ubuntu 10.10 live cd. –  Roshan George May 20 '13 at 13:55
    
Your partition definitely were not found correctly — try adding -k 2048 -n 2048 as suggested. Using Ubuntu 10.10 might be OK — gpart is not updated very often. –  Sergey Vlasov May 20 '13 at 14:05

If the old table is recoverable testdisk should find it. If not - you may be able to get the data by using testdisk's data recovery option or try dd or ddrecscue to get a copy of the hard-drive on disk (assuming you create a scenario where you have a free hard-drive to rescue the data to). If you can get the data you can re-create the partiontion table and then put your data back on. The good news is that most-likely your data is still on that drive.

share|improve this answer
    
I tried using test-disk, but i'm unsure how to use it. –  Roshan George May 22 '13 at 3:21

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.