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.

Apparently the partition table still seems to be somewhere in tact, as well as all the files. Debian is able to mount the ntfs partitions, I can read/write and I am using dd to image the data onto an external HDD at the moment.

fdisk:

# fdisk -l /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x17557a4b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sdb2          206848   251903999   125848576    7  HPFS/NTFS/exFAT
/dev/sdb3       251906048   503603199   125848576    7  HPFS/NTFS/exFAT
/dev/sdb4       503605620   976784129   236589255    f  W95 Ext'd (LBA)
Partition 4 does not start on physical sector boundary.
/dev/sdb5       503607296   557346815    26869760    7  HPFS/NTFS/exFAT
/dev/sdb6       557348864   976769023   209710080    7  HPFS/NTFS/exFAT

ms-sys:

ms-sys /dev/sdb
/dev/sdb has an x86 boot sector,
it is an unknown boot record

parted:

# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print list                                                       
Error: Can't have a partition outside the disk!     

gparted shows unallocated partition of unallocated file system. Going on partition information shows same error as parted.

# gpart /dev/sdb

*** Fatal error: dev(/dev/sdb): seek failure.

MBR dump:

# dd if=/dev/sdb of=/media/seagate-a/mbr.bin bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 9.4563e-05 s, 5.4 MB/s
root@carbon:/home/martin# hexdump -C -s 512 /media/seagate-a/mbr.bin
00000200  fc 31 c0 8e d0 31 e4 8e  d8 8e c0 be 00 7c bf 00  |.1...1.......|..|
00000210  06 b9 00 01 f3 a5 be ee  07 b0 08 ea 20 06 00 00  |............ ...|
00000220  80 3e b3 07 ff 75 04 88  16 b3 07 80 3c 00 74 04  |.>...u......<.t.|
00000230  08 06 af 07 83 ee 10 d0  e8 73 f0 90 90 90 90 90  |.........s......|
00000240  90 90 90 90 90 90 90 90  90 90 90 90 90 90 90 90  |................|
*
00000270  90 90 90 90 90 90 90 90  90 90 90 90 90 90 be be  |................|
00000280  07 b0 00 b9 04 00 80 3c  00 75 6e fe c0 83 c6 10  |.......<.un.....|
00000290  e2 f4 31 db b4 0e be 9d  07 8a 0e af 07 ac d0 e9  |..1.............|
000002a0  73 02 cd 10 08 c9 75 f5  b0 3a cd 10 31 c0 cd 16  |s.....u..:..1...|
000002b0  3c 00 74 f8 be 8b 07 b9  02 00 e8 ba 00 3c 0d 74  |<.t..........<.t|
000002c0  b4 3c 61 72 06 3c 7a 77  02 2c 20 88 c3 be 9d 07  |.<ar.<zw., .....|
000002d0  8a 0e af 07 ac d0 e9 73  04 38 c3 74 06 08 c9 75  |.......s.8.t...u|
000002e0  f3 eb af b8 0d 0e 31 db  cd 10 8d 84 62 00 3c 07  |......1.....b.<.|
000002f0  75 07 b0 1f a2 af 07 eb  99 31 d2 b9 01 00 3c 04  |u........1....<.|
00000300  74 11 73 f3 30 e4 b1 04  d2 e0 be be 07 01 c6 8a  |t.s.0...........|
00000310  16 b3 07 bf 05 00 56 f6  c2 80 74 31 b4 41 bb aa  |......V...t1.A..|
00000320  55 52 cd 13 5a 5e 56 72  1e 81 fb 55 aa 75 18 f6  |UR..Z^Vr...U.u..|
00000330  c1 01 74 13 8b 44 08 8b  5c 0a be 8d 07 89 44 08  |..t..D..\.....D.|
00000340  89 5c 0a b4 42 eb 0c 8a  74 01 8b 4c 02 b8 01 02  |.\..B...t..L....|
00000350  bb 00 7c 50 c6 06 8f 07  01 cd 13 58 5e 73 05 4f  |..|P.......X^s.O|
00000360  75 b4 eb 93 81 3e fe 7d  55 aa 75 f6 ea 00 7c 00  |u....>.}U.u...|.|
00000370  00 be 83 07 b9 0a 00 50  b4 0e 31 db ac cd 10 e2  |.......P..1.....|
00000380  fb 58 c3 54 65 73 74 44  69 73 6b 0d 0a 10 00 01  |.X.TestDisk.....|
00000390  00 00 7c 00 00 00 00 00  00 00 00 00 00 31 32 33  |..|..........123|
000003a0  34 46 00 00 41 4e 44 54  6d 62 72 00 02 02 02 1f  |4F..ANDTmbr.....|
000003b0  c7 00 00 80 00 00 00 00  4b 7a 55 17 cf c9 80 20  |........KzU.... |
000003c0  21 00 07 df 13 0c 00 08  00 00 00 20 03 00 00 df  |!.......... ....|
000003d0  14 0c 07 fe ff ff 00 28  03 00 00 98 00 0f 00 fe  |.......(........|
000003e0  ff ff 07 fe ff ff 00 c8  03 0f 00 98 00 0f 00 fe  |................|
000003f0  ff ff 0f fe ff ff 74 69  04 1e 8e 21 34 1c 55 aa  |......ti...!4.U.|
00000400
# file /media/seagate-a/mbr.bin 
/media/seagate-a/mbr.bin: x86 boot sector; partition 1: ID=0x7, active, starthead 32, startsector 2048, 204800 sectors; partition 2: ID=0x7, starthead 223, startsector 206848, 251697152 sectors; partition 3: ID=0x7, starthead 254, startsector 251906048, 251697152 sectors; partition 4: ID=0xf, starthead 254, startsector 503605620, 473178510 sectors, code offset 0x31

The windows 7 installation resides on /dev/sdb2. /dev/sdb1 used to be System Reserved.

I've tried to 'regenerate' the MBR using ms-sys --mbr7 /dev/sdb and testdisk so I believe I have completely mangled the MBR and anything that is dependent on it to the point where the whole thing has to be 'regenerated' - MBR and partition table. Miraculously Debian is still able to operate the partitions so not all hope is lost - right?

I would like to 'regenerate' the MBR as such that I can boot from this drive into my windows 7 installation. Are there tools that can help me in this situation?

share|improve this question
    
What's your question? –  MariusMatutiae Nov 15 '13 at 9:27
    
I would like to regenerate the MBR so that I may boot into w7 from this drive. –  Ploo Nov 15 '13 at 9:29
add comment

2 Answers

Here's at least part of your problem:

255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
...
   Device Boot      Start         End      Blocks   Id  System
...
/dev/sdb4       503605620   976784129   236589255    f  W95 Ext'd (LBA)

Note that your extended partition end point (sector 976,784,129) is after the end of the disk (which has 976,773,168 sectors). This is of course illegal, and libparted (upon which both parted and GParted are based) doesn't react well to this. Old versions of TestDisk were known to create this problem, but I haven't followed it to know if TestDisk still has this bug. Some other tools might do the same thing.

The easiest solution is to run my FixParts program on the disk. It will throw away the overly-large extended partition and create one that's both big enough to hold your logical partitions and that's small enough to fit on your disk. Read the FixParts documentation for details on how to use it.

That said, if you're having problems booting Windows, I'm not sure if this solution will fix that problem. You haven't fully described the symptoms of your Windows boot failure, so if fixing the bogus extended partition doesn't help, I recommend you edit your original post to include more details of how you're trying to boot Windows and how it's failing. For instance, are you trying to boot directly or via GRUB? If the latter, what's your grub.cfg entry for booting Windows? Do you see a Windows splash screen? Do you see any error messages? Does the computer hang, reboot, or misbehave in some other notable way?

share|improve this answer
add comment

Easiest way to go is to use a Ubuntu live distro. Download Ubuntu's installation .iso file, install it on a USB stick via a utility like unetbootin or a command like

sudo dd if=/path/to/isofile.iso of=/dev/sdb bs=1M

where you have to absolutely, positively make sure that your USB stick is /dev/sdb. Then boot from USB stick, choose "Try Ubuntu without installing", open a terminal, install Boot-Repair following instructions from this Web page, which also contains information on how to use it. These simple instructions are sufficient to solve this problem in nearly all cases I heard of.

share|improve this answer
    
Make that /dev/sdc (or higher)! Ploo's description clearly indicates that /dev/sdb is the disk that's experiencing troubles, so using that as a target will just make matters worse -- much worse! –  Rod Smith Nov 15 '13 at 17:48
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.