Most popular tags

Welcome to Earthwithsun.com, where you can ask questions and receive answers from other members of the community.

Repair Windows 7 Partition from Puppy Linux

On my Windows 7 PC I booted Browser Linux from USB, ran GParted to create a new partition in order to install Linux. GRUB is also installed and offers:

  1. Windows 7 /dev/sda1
  2. Browser Linux /dev/sda2

Linux boots but Win7 won't.

The boot selection failed because a required device is inacessible (0xc0000225)

Everything I've read suggests using the Win7 CD to repair -> not an option currently. Surely there is a way from inside Linux to fix the partition table. Since this is Browser Linux (Puppy Linux - not Ubuntu) I have no apt-get and precious few tools installed.

Running ntfsfix /dev/sda2 did nothing to help.

Here is the fdisk output indicate something that is wrong - apparently "does not end on a cylinder" is moot:

#fdisk -l
Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       14539   116779288+   7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2           14540       15566     8249377+  83  Linux

How can I fix it so Win7 boots again? I am wary about reconstructing the table by hand.

1 Answer

Solved using a Windows 7 recovery disk. Trying to make a Windows 7 boot disk from Linux proved impossible for mere mortals.

You need to use dd to take a snapshot of the MBR after partition editing but before installing GRUB to the MBR:

dd if=/dev/sda bs=512 count=1 of=/boot/win7.mbr

Then make a Grub menu item for Windows 7 that will load this as a boot sector image. Windows 7 contains some code in the Win7 MBR that Win7 looks for the results of, and that may be the source of your trouble.

Edit: I also noticed that you have your Linux installation listed as /dev/sda2 which seems incorrect for a Windows 7 installation. Windows 7 sets up a boot partition /dev/sda1 and a system partition /dev/sda2 by default. You need to set up Linux as /dev/sda3 to avoid re-ordering the partition table and causing Windows 7 to freak out when it looks for itself on partition 2 and it's not there. Additionally, you seem to be using fdisk in cylinder-head-sector compatibility mode and that's a big no-no for Vista/7. Use the u command in fdisk to switch to sector units instead of cylinder units.

When you use ntfsresize to shrink partition 2, you need to make sure that the replacement partition table entry starts on the exact same sector of the drive or Windows won't boot.