Fixing misaligned Windows partition without affecting Ubuntu

2

I have dual boot setup with my partitions set up like so:

  • /dev/sda1 - DellUtility (FAT)
  • /dev/sda2 - RECOVERY (NTFS)
  • /dev/sda3 - OS (Windows 7 NTFS)
  • /dev/sda4 - Extended
    • /dev/sda5 - swap
    • /dev/sda6 - ext4 (Ubuntu OS)
    • /dev/sda7 - ext4 (Ubuntu home)

I used Clonezilla to clone my hard drive and clearly screwed up something since now Ubuntu's Disk Utility reports that my partitions are misaligned. I can boot and use Ubuntu with no problems but Windows refuses to boot and shows a Windows Boot Manager error screen with status code 0xc000000e: http://blogs.technet.com/blogfiles/deploymentguys/WindowsLiveWriter/Backtobasics2Brandingthedeployment_84EB/clip_image001_2.jpg

I have a Windows installation disc but I'm worried that "Repairing my computer" could affect either grub or my Ubuntu partition. What's the best way to recover?

windows-7
ubuntu
partitioning
grub
multi-boot
asked on Super User Oct 28, 2011 by Patrick Marchwiak • edited Oct 30, 2011 by Journeyman Geek

2 Answers

1

This is nothing to do with partition alignment.

Windows isn't complaining about misaligned partitions. It's complaining that it cannot find the Windows boot loader, winload. The reason that it cannot find it is that you've switched hard discs. Microsoft's Boot Manager locates winload, and other so-called boot applications, by a combination of a hard disc ID, partition ID, and pathname within the partition. It's looking for winload on a hard disc and partition combination that is no longer present on your system.

Presuming that your copy is otherwise — apart from the IDs — identical to the original: one workaround for this is, as Alan Adams found, to alter the BCD database entry for the Windows Boot Loader — which is where Microsoft's Boot Manager stores all of this information — to not use specific partition IDs but to use the generic "boot" identifier, using the bcdedit tool from the recovery command line:

BCDEDIT /set {bootmgr} device boot
BCDEDIT /set {default} device boot
BCDEDIT /set {default} osdevice boot

This sets the device and osdevice fields of the {bootmgr} (Microsoft's Boot Manager itself) and {default} (default selection — usually the Windows Boot Loader) entries in the database to "boot". As M. Adams said, one will have to adjust {memdiag} and other entries if they exist and one wants to use them. Multibooters has a whole article on this.

answered on Super User Oct 28, 2011 by JdeBP
1

I followed the instructions on the error screen. That is, I inserted my OS disk then ran "Repair your computer". It worked like a charm. I can boot Windows and Ubuntu with no issues.

answered on Super User Oct 31, 2011 by Patrick Marchwiak

User contributions licensed under CC BY-SA 3.0