I did dual boot with Windows 7 & Ubuntu 14.04. I get both in boot menu but can't boot into Windows 7. The primary drive where Windows 7 was configured now shows to be logical drive with all files in it. How to resolve it ?

This is what it shows:

irshad@irshad-desktop:~$ lsblk
sda      8:0    0 465.8G  0 disk     
├─sda1   8:1    0  58.6G  0 part /media/irshad/B2E08E69E08E339F    
├─sda2   8:2    0     1K  0 part     
├─sda5   8:5    0 195.3G  0 part /media/irshad/8E90A6A690A6946D    
├─sda6   8:6    0 182.8G  0 part /media/irshad/7650B08250B04B1F   
├─sda7   8:7    0    25G  0 part /   
└─sda8   8:8    0     4G  0 part     
sr0     11:0    1  1024M  0 rom  

I tried to run update-grub but I get the following result.

$ sudo update-grub 
Generating grub configuration file ... 
/etc/grub.d/06_custom: 31: /etc/grub.d/06_custom: function: not found 
/etc/grub.d/06_custom: 34: /etc/grub.d/06_custom: save_env: not found 
/etc/grub.d/06_custom: 36: /etc/grub.d/06_custom: Syntax error: "}" unexpected
  • 1
    Please run lsblk command inside Ubuntu and edit your question including it's output.
    – Danatela
    Commented Oct 9, 2014 at 8:41
  • 1
    @KasiyA: no errors.........when i try to boot win 7, it just goes black and again returns to boot menu. That sda1 is considered to be media.........how to change it to primary drive ?
    – gambler420
    Commented Oct 9, 2014 at 8:58
  • No no wait..... Did you install windows7 after ubuntu? or not Commented Oct 9, 2014 at 9:04
  • @KasiyA: no i dint. I installed ubuntu from win 7.now ubuntu works but not win 7
    – gambler420
    Commented Oct 9, 2014 at 9:08
  • @kasiya: its exactly as you edited.
    – gambler420
    Commented Oct 9, 2014 at 9:17

2 Answers 2


At last I booted win 7 by using Testdisk. Link to solution if anyone has problem in booting windows even thought all the files are present/intact.

If you have damaged the boot sector of one of your partitions (e.g. by installing GRUB in it by mistake), you may have troubles. For example, if it is a Windows partition, you will not be able to boot into Windows any more.

Remark: if you have this problem, Boot-Repair should automatically warn and tell you the name (eg sda2) of the broken partition.

Here is how to repair it:

Via an Ubuntu disc

Step 1 - Boot on a liveCD or liveUSB

Boot your computer on a Ubuntu live-CD or live-USB, then choose "Try Ubuntu".

Step 2 - Install TestDisk in the live-session

Once in the Ubuntu live session, install TestDisk this way:

  1. Connect internet
  2. Open the Software Center, in the top bar click Edit -> Software Sources -> enable the Universe repository
  3. Open a terminal (Ctrl+Alt+T) and type :

    sudo apt-get update
    sudo apt-get install -y testdisk && sudo testdisk

Step 3 - Use TestDisk

  1. Via the arrows and the Enter key, go to the [No log] menu,
  2. then select the disk where the broken partition is,
  3. then select [Proceed],
  4. then choose the type of partition (generally [Intel]),
  5. then[Advanced],
  6. then select the broken partition with [Boot], it will display something like :

    Boot sector
    Status: Bad
    Backup boot sector
    Status: OK
    Sectors are not identical.
    A valid NTFS Boot sector must be present in order to access
    any data; even if the partition is not bootable.
    [  List  ]  [Backup BS]  [Rebuild BS]  [  Dump  ]
  7. Check that you have "Status ok" below "Backup boot sector"

  8. select [Backup BS].


Via a Windows disc

This method is only able to fix the bootsector of a Windows partition.

  1. Get a Windows recovery disk, as explained on this page

  2. Boot on it, and use the 'fixboot' command (not the 'fixmbr' one). This should fix the bootsector of Windows.

source: Ubuntu official documentation


Boot your system using windows 7 installation CD to fix your Windows boot first.

Go to "repair your system" after selecting your language from first dialog.
use command prompt (Troubleshoot ► Advanced Options ► Command Prompt)
type bootrec /fixboot then hit enter
type bootrec /fixmbr then hit enter

THEN boot from Ubuntu live CD/USB and do below steps to restore your grub:

  1. Open a Terminal (use Ctlr+Alt+T)
  2. Mount /dev/sda7 (this one you can get from lsblk where root / partition mounted in) by the following commands: (run one by one)

    sudo mount /dev/sda7 /mnt
    for i in /sys /proc /run /dev;do sudo mount --bind "$i" "/mnt$i";done
    sudo chroot /mnt
  3. And run below command to install grub to main partition /dev/sda:

    grub-install /dev/sda
  4. Update grub and exit and reboot your system.

    sudo reboot
  • my win 7 files are in "dev/sda1 /".......should i still continue to as "dev/sda 7/ mnt" ? and sda 7 is where ubuntu is installed. and i dont think it will have enough space.
    – gambler420
    Commented Oct 9, 2014 at 9:42
  • @gambler420 yes Of course! but you need fix your windows first then try to restore grub Commented Oct 9, 2014 at 9:44
  • so with your method i will uninstall ubuntu and restore with win 7 ?
    – gambler420
    Commented Oct 9, 2014 at 9:46
  • @gambler420 NOooooo I said Use windows 7 installation CD and repair its boot then use Ubuntu installation cd(Select "Try Ubuntu without installation") and restore your Ubuntu Grub boot loader. you don't need to unistall Ubuntu Commented Oct 9, 2014 at 9:48
  • will either of these torrent files help me as win 7 recovery disc ? kickass.to/… kickass.to/…
    – gambler420
    Commented Oct 9, 2014 at 9:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .