My computer(asus N76VM 64 bit) with windows 7 (64 bit home professional) pre-installed got in a bad state while partitioning from a later installed Ubuntu environment. This had lead me to run testdisk
and copy every seperate partition onto a backup HDD.
I managed to get it al back onto the original hard drive in a state that resembles the state before things went bad.
****I was able to boot into both operating systems before all the hassle started!****
Since "repairing" the HDD the computer still doesn't want to start windows 7. It's got Grub 1.99
installed and (hoping this would help me) rEFInd
but they both don't work. I must note that Grub
does display entries for both Windows 7 and Ubuntu. Ubuntu starts like it should, but when I choose for Windows the screen tells me: Invalid EFI filepath.
Another step I tried was running a Windows 7 repair cd, enter command prompt, reassign drive letters (they were C:\ for [OS] and D:\ for [DATA]) so they fitted the original state and then the following commands:
Bootrec.exe /FixMbr
Bootrec.exe /FixBoot
Bootrec.exe /ScanOs
Bootrec.exe /RebuildBcd
Rebooted
But they did not help, so I tried the following:
bootsect /nt60 c: /force /mbr
bcdboot c:\windows /s c:
Again, no sigar. So I started looking further and ran into this website which gave advice I am a bit concerned about trying, for I don't know the possible outcomes and I don't want to be loosing anything all over again.
Running boot info script
gives me the following output (the order of the partitions might seem weird, I know that, but I don't think it is of any concern:
Boot Info Script 0.61 [1 April 2012]
============================= Boot Info Summary: ===============================
=> Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector
1880670208 of the same hard drive for core.img. core.img is at this
location and looks for (,gpt2)/boot/grub on this drive.
sda1: __________________________________________________________________________
File system: vfat
Boot sector type: FAT32
Boot sector info: According to the info in the boot sector, sda1 starts
at sector 0. But according to the info from fdisk,
sda1 starts at sector 2048.
Operating System:
Boot files: /efi/refind/refind_x64.efi /efi/ubuntu/grubx64.efi
/efi/ubuntu/shimx64.efi
sda2: __________________________________________________________________________
File system: ext4
Boot sector type: Grub2 (v1.99)
Boot sector info: Grub2 (v1.99) is installed in the boot sector of sda2
and looks at sector 1569963600 of the same hard drive
for core.img. core.img is at this location and looks
for (,gpt2)/boot/grub on this drive.
Operating System: Ubuntu 12.04.4 LTS
Boot files: /boot/grub/grub.cfg /etc/fstab
sda3: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files:
sda4: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 7
Boot files: /NST/menu.lst /bootmgr /Boot/BCD
/Windows/System32/winload.exe
sda5: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files: /bootmgr /boot/bcd
sda6: __________________________________________________________________________
File system: swap
Boot sector type: -
Boot sector info:
sda7: __________________________________________________________________________
File system: BIOS Boot partition
Boot sector type: Grub2's core.img
Boot sector info:
============================ Drive/Partition Info: =============================
Drive: sda _____________________________________________________________________
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
Partition Boot Start Sector End Sector # of Sectors Id System
/dev/sda1 1 1,953,525,167 1,953,525,167 ee GPT
GUID Partition Table detected.
Partition Start Sector End Sector # of Sectors System
/dev/sda1 2,048 194,559 192,512 EFI System partition
/dev/sda2 1,556,162,560 1,864,286,207 308,123,648 EFI System partition
/dev/sda3 1,233,352,704 1,556,162,559 322,809,856 Data partition (Windows/Linux)
/dev/sda4 194,560 1,233,352,703 1,233,158,144 Data partition (Windows/Linux)
/dev/sda5 1,880,690,688 1,936,979,967 56,289,280 Windows Recovery Environment (Windows)
/dev/sda6 1,864,286,208 1,880,670,207 16,384,000 Swap partition (Linux)
/dev/sda7 1,880,670,208 1,880,690,687 20,480 BIOS Boot partition
"blkid" output: ________________________________________________________________
Device UUID TYPE LABEL
/dev/sda1 E138-2A7D vfat
/dev/sda2 598ab3d1-e1aa-4041-ba78-1de8c6762331 ext4
/dev/sda3 4DFF26211F14E609 ntfs DATA
/dev/sda4 4A814AE3556AE075 ntfs OS
/dev/sda5 1B1666970F6A4336 ntfs Recovery
/dev/sda6 03dc7be8-7682-4219-8ab0-ae5d09caa1b1 swap
================================ Mount points: =================================
Device Mount_Point Type Options
/dev/sda1 /boot/efi vfat (rw)
/dev/sda2 / ext4 (rw,errors=remount-ro)
=========================== sda2/boot/grub/grub.cfg: ===========================
--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
}
insmod part_gpt
insmod ext2
set root='(hd0,gpt2)'
search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
insmod part_gpt
insmod ext2
set root='(hd0,gpt2)'
search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
set locale_dir=($root)/boot/grub/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30; then
clear
fi
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="${1}"
if [ "${1}" = "keep" ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
}
if [ "${recordfail}" != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "${linux_gfx_mode}" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 3.8.0-35-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_gpt
insmod ext2
set root='(hd0,gpt2)'
search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
linux /boot/vmlinuz-3.8.0-35-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.8.0-35-generic
}
menuentry 'Ubuntu, with Linux 3.8.0-35-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_gpt
insmod ext2
set root='(hd0,gpt2)'
search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
echo 'Loading Linux 3.8.0-35-generic ...'
linux /boot/vmlinuz-3.8.0-35-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.8.0-35-generic
}
submenu "Previous Linux versions" {
menuentry 'Ubuntu, with Linux 3.8.0-29-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_gpt
insmod ext2
set root='(hd0,gpt2)'
search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
linux /boot/vmlinuz-3.8.0-29-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.8.0-29-generic
}
menuentry 'Ubuntu, with Linux 3.8.0-29-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_gpt
insmod ext2
set root='(hd0,gpt2)'
search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
echo 'Loading Linux 3.8.0-29-generic ...'
linux /boot/vmlinuz-3.8.0-29-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.8.0-29-generic
}
menuentry 'Ubuntu, with Linux 3.5.0-18-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_gpt
insmod ext2
set root='(hd0,gpt2)'
search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
linux /boot/vmlinuz-3.5.0-18-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.5.0-18-generic
}
menuentry 'Ubuntu, with Linux 3.5.0-18-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_gpt
insmod ext2
set root='(hd0,gpt2)'
search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
echo 'Loading Linux 3.5.0-18-generic ...'
linux /boot/vmlinuz-3.5.0-18-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.5.0-18-generic
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda4)" --class windows --class os {
insmod part_gpt
insmod ntfs
set root='(hd0,gpt4)'
search --no-floppy --fs-uuid --set=root 4A814AE3556AE075
chainloader +1
}
menuentry "Windows Recovery Environment (loader) (on /dev/sda5)" --class windows --class os {
insmod part_gpt
insmod ntfs
set root='(hd0,gpt5)'
search --no-floppy --fs-uuid --set=root 1B1666970F6A4336
drivemap -s (hd0) ${root}
chainloader +1
}
set timeout_style=menu
if [ "${timeout}" = 0 ]; then
set timeout=10
fi
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Windows 7" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set=root 4A814AE3556AE075
chainloader +1
}
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------
=============================== sda2/etc/fstab: ================================
--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#
proc /proc proc nodev,noexec,nosuid 0 0
tmpfs /tmp tmpfs optional,nodev,noexec,nosuid 0 0
# / was on /dev/sda2 during installation
UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
#UUID=E138-2A7D /boot/efi vfat defaults 0 1
# swap was on /dev/sda3 during installation
UUID=03dc7be8-7682-4219-8ab0-ae5d09caa1b1 none swap sw 0 0
#/dev/sda7 none swap sw,noauto 0 0
#UUID=E138-2A7D /boot/efi vfat defaults 0 1
#UUID=E138-2A7D /boot/efi vfat defaults 0 1
UUID=E138-2A7D /boot/efi vfat defaults 0 1
--------------------------------------------------------------------------------
=================== sda2: Location of files loaded by Grub: ====================
GiB - GB File Fragment(s)
814.208938599 = 874.250190848 boot/grub/grub.cfg 1
765.658302307 = 822.119342080 boot/initrd.img-3.5.0-18-generic 1
743.588668823 = 798.422253568 boot/initrd.img-3.8.0-29-generic 2
769.143566132 = 825.861615616 boot/initrd.img-3.8.0-35-generic 1
765.462841034 = 821.909467136 boot/vmlinuz-3.5.0-18-generic 2
742.506031036 = 797.259780096 boot/vmlinuz-3.8.0-29-generic 2
769.006057739 = 825.713967104 boot/vmlinuz-3.8.0-35-generic 1
765.658302307 = 822.119342080 initrd.img 1
765.658302307 = 822.119342080 initrd.img.old 1
765.462841034 = 821.909467136 vmlinuz 2
765.462841034 = 821.909467136 vmlinuz.old 2
============================== sda4/NST/menu.lst: ==============================
--------------------------------------------------------------------------------
# NeoSmart NeoGrub Bootloader Configuration File
#
# This is the NeoGrub configuration file, and should be located at C:\NST\menu.lst
# Please see the EasyBCD Documentation for information on how to create/modify entries:
# http://neosmart.net/wiki/display/EBCD/
--------------------------------------------------------------------------------
=================== sda4: Location of files loaded by Grub: ====================
GiB - GB File Fragment(s)
?? = ?? NST/menu.lst 0
=============================== StdErr Messages: ===============================
xz: (stdin): Compressed data is corrupt
xz: (stdin): Compressed data is corrupt
Boot flag removed from the EXT4 partition. Now the next step is to get the windows partition that needs to be booted at C:\ instead of the EXT4 partition. I tried a couple of times with 'diskpart' on a windows live cd recovery environment within 'cmd'. However, at each reboot the drive letters get reassigned.
My setup from before everything went haywire
Edit:
Replaced the bootmgfw.efi file with a copy from the original OS partition. Now when booting windows 7 from rEFInd I get the following screen:
Windows failed to start. A recent hardware or software change might be the cause. To fix the problem:
1. Insert your Windows installation disc and restart your computer.
2. Choose your language settings, and click "Next."
3. Click "Repair your computer."
If you do not have this disc, contact your system administrator or computer manufacturer for assistance.
File: \EFI\Microsoft\Boot\BCD
Status: 0xc000000f
Info: An error occurred while attempting to read the boot configuration data.
EDIT 19 feb '14
I found on the site of Microsoft a Windows 8.1 trial iso. Downloaded it, installed in virtual machine 64-bit. Copied the iso to the virtual disk and used some instructions I found for making the USB recognized on the VM. Then with other instructions I found the way of making it EUFI boot able and it worked.
Now I'm waiting for the repair to be done. It's taking half an hour now and I don't know when it will be done. For the sake of reference I will be adding the sources of the information when/if this operation will be done
/dev/sda
{1,4,3,2,6,7,5}. Of course, your partition numbering has also changed through all of this: please upload updated versions of image and boot info script output