Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed Ubuntu 12.04 but my Windows 7 partition seems to have been lost. It is in sda2.

Can anyone help me how to get this Windows 7 partition back without having to reinstall Windows 7?

Disk /dev/sda: 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 / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd45cd45c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    61433855    30715904   83  Linux
/dev/sda2   *    61433856   122873855    30720000    7  HPFS/NTFS/exFAT
/dev/sda3       122873856   976769023   426947584    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders, total 398297088 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x03ee03ee

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63    20482874    10241406    c  W95 FAT32 (LBA)
/dev/sdb2        20482875    40965749    10241437+  1c  Hidden W95 FAT32 (LBA)
/dev/sdb3        40965750   398283479   178658865    f  W95 Ext'd (LBA)
/dev/sdb5        40965813    76694309    17864248+   7  HPFS/NTFS/exFAT
/dev/sdb6        76694373   108856439    16081033+   7  HPFS/NTFS/exFAT
/dev/sdb7       108856503   398283479   144713488+   7  HPFS/NTFS/exFAT

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
240 heads, 63 sectors/track, 129201 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000001

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *          63    20480543    10240240+  82  Linux swap / Solaris
/dev/sdc2        20480605  1953519119   966519257+   f  W95 Ext'd (LBA)
/dev/sdc5        20480607  1953519119   966519256+   7  HPFS/NTFS/exFAT
share|improve this question

Try running update-grub in a terminal. It should show something like...

using custom appearance settings  
Found linux image: /boot/vmlinuz-3.2.0-24-generic  
Found initrd image: /boot/initrd.img-3.2.0-24-generic  
Found memtest86+ image: /boot/memtest86+.bin  
Found Windows 7 (loader) on /dev/sda1  

Another option to try is to download and install grub-customizer from the software centre and see if it's detected in there.

Here's my GRUB windows 7 config

Maybe... Here's a copy of my Windows 7 Partition GRUB config.

### BEGIN /etc/grub.d/30_os-prober ###  
menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {  
        insmod part_msdos  
        insmod ntfs  
        set root='(hd0,msdos1)'  
        search --no-floppy --fs-uuid --set=root 165A6AB45A6A9073  
        chainloader +1  
### END /etc/grub.d/30_os-prober ###

Perhapse this will help you know what needs to be in the config file /boot/grub/grub.gfg. of course, yours would be sda2. Also, I'm not sure what the search line represents. The number at the end may not be what is required? Hope this helps.

share|improve this answer
thanks for that - but 'fraid update-grub did not find the Win7 partition either. I can see the Win7 files in the mounted sda2 partition but somehow grub can't. I couldn't just add an entry manually ? – Michael Jun 6 '12 at 22:22
adjusted my answer to hopfully help a little more. the config code would go under the end line for the memtest option. – Frantumn Jun 7 '12 at 2:05

ok managed to fix it. Unfortunately I changed many things in one go so I am not sure exactly what exactly fixed it. But here is a list of things I did anyway:

  1. Booted of the Win7 CD, recovery console, bootrec / fixmbr then bootrec / fixboot
  2. then used Win7 fix boot errors tool also while in recovery mode (forgot the exact name of the tool)
  3. rebooted - now I had Win7 back but lost Ubuntu
  4. reinstalled Ubuntu - putting the MBR partition into sda (as opposed to sdb like before)
  5. Now grub saw Win7 and Win XP

All working fine now. Hope it helps the next person.

Thanks everyone for all your help.

share|improve this answer
You can accept your answer later on. By the way, why do you have 2 accounts? – Emerson Hsieh Jun 9 '12 at 6:13

I had lost Ubuntu after installing Windows on the free space, I got them both working by using Boot Repair. You may have to try a couple times to install it if using the livecd method.

share|improve this answer

Try running sudo update-grub2 in the terminal, since you're running 12.04. I would have put this as a comment on Frantumn's question, but I can't yet. In addition, it's a bit late to suggest an edit. Am I doing this right?

share|improve this answer

Use any partition tool. Find boot Windows 7 partition and set it as active partition (# generally 100 MB partition or the partition where Windows 7 is installed).

share|improve this answer

It seems, Window 7 Bootmanager is no longer working. And Boot is using Grub.

Try this: You must be having window 7 disk. Boot from it. Select Repair Console.

Type in Console(CMD)


Hope, it get fixed.

share|improve this answer
if it works, you will be able to boot, your windows from boot menu – BigSack Jun 7 '12 at 8:10

Your Answer


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.