1 (edited by 2by 2011-02-18 21:45:58)

Topic: [SOLVED] Cant boot to Win7 after Ubuntu install

Hey!

I re-formatted my Linux partition and installed it again, i re-formatted from Mac OS X. I have Windows 7 installed via Boot-camp.

Now, after installing Linux for the 2. time, I cant access Windows7 partition sad I could easily install it again, but I got some important files I want to rescue.

I got this report from partition inspector:

*** Report for internal hard disk ***

Current GPT partition table:
# Start LBA End LBA Type
1 40 409639 EFI System (FAT)
2 409640 1407600639 Mac OS X HFS+
3 1407862784 1608794111 Basic Data
4 1608794112 1620512767 Linux Swap
5 1620512768 1718169599 Basic Data
6 1718169600 1815826431 Basic Data

Current MBR partition table:
# A Start LBA End LBA Type
1 1 409639 ee EFI Protective
2 409640 1407600639 af Mac OS X HFS+
3 * 1407862784 1608794111 07 NTFS/HPFS
4 1608794112 1620512767 82 Linux swap / Solaris

MBR contents:
Boot Code: GRUB

Partition at LBA 40:
Boot Code: None (Non-system disk message)
File System: FAT32
Listed in GPT as partition 1, type EFI System (FAT)

Partition at LBA 409640:
Boot Code: None
File System: HFS Extended (HFS+)
Listed in GPT as partition 2, type Mac OS X HFS+
Listed in MBR as partition 2, type af Mac OS X HFS+

Partition at LBA 1407862784:
Boot Code: Windows BOOTMGR (Vista)
File System: NTFS
Listed in GPT as partition 3, type Basic Data
Listed in MBR as partition 3, type 07 NTFS/HPFS, active

Partition at LBA 1608794112:
Boot Code: None
File System: Unknown
Listed in GPT as partition 4, type Linux Swap
Listed in MBR as partition 4, type 82 Linux swap / Solaris

Partition at LBA 1620512768:
Boot Code: GRUB
File System: ext4
Listed in GPT as partition 5, type Basic Data

Partition at LBA 1718169600:
Boot Code: None
File System: ext4
Listed in GPT as partition 6, type Basic Data

============================================

As you can see I triple-boot, Mac OS X, Win7 (via Boot-camp) and Ubuntu Linux.

Now the trouble comes... I used GParted to check my win7 partition, this is what it says:

GParted 0.6.2

Libparted 2.3
Check and repair file system (ntfs) on /dev/sda3 00:00:00 ( ERROR )

calibrate /dev/sda3 00:00:00 ( SUCCESS )

path: /dev/sda3
start: 1407862784
end: 1608794111
size: 200931328 (95.81 GiB)
check file system on /dev/sda3 for errors and (if possible) fix them 00:00:00 ( ERROR )

ntfsresize -P -i -f -v /dev/sda3

ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda3
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 279378391552 bytes (279379 MB)
Current device size: 102876839936 bytes (102877 MB)
ERROR: Current NTFS volume size is bigger than the device size!
Corrupt partition table or incorrect device partitioning?

========================================


Can someone please help me here?

2

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

It would appear that you chose to shrink the NTFS (sda3) partition, perhaps while installing Ubuntu.

To fix the problem we will need some information:

Would you be able to provide the output from the following two commands?

fdisk -l -u

where one of the options is a lower case "L" and not the number one.

parted /path-to-your-device unit s print

where /path-to-your-device is something like /dev/sda.


Next we will need copies of the Master Boot Record and the NTFS Partition Boot Record.

You can capture the Master Boot Record in a file with the following command:

NOTE:  Be extra careful to type this command in properly, otherwise loss of data could result.

dd if=/dev/sda of=sda-2by.mbr bs=512 count=1

where sda-2by.mbr is the name of the file that will need to be uploaded.


You can capture the NTFS Partition Boot Record in a file with the following command:

NOTE:  Be extra careful to type this command in properly, otherwise loss of data could result.

dd if=/dev/sda of=sda3-2by.pbr bs=512 count=1 skip=1407862784

where sda3=2by.pbr is the name of the file that will need to be uploaded.


Then upload these files to a media sharing site, such as mediafire or filefactory, and post the link to these files in this forum post.

3

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

Thanks man, sure! Here it goes

fdisk -l -u

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      409639      204819+  ee  GPT
/dev/sda2          409640  1407600639   703595500   af  HFS / HFS+
/dev/sda3   *  1407862784  1608794111   100465664    7  HPFS/NTFS
/dev/sda4      1608794112  1620512767     5859328   82  Linux swap / Solaris

parted /dev/sda unit s print

Model: ATA ST31000528AS (scsi)
Disk /dev/sda: 1953525168s
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start        End          Size         File system     Name                  Flags
 1      40s          409639s      409600s      fat32           EFI system partition  boot
 2      409640s      1407600639s  1407191000s  hfs+            Customer
 3      1407862784s  1608794111s  200931328s   ntfs            BOOTCAMP
 4      1608794112s  1620512767s  11718656s    linux-swap(v1)
 5      1620512768s  1718169599s  97656832s    ext4
 6      1718169600s  1815826431s  97656832s    ext4

sudo dd if=/dev/sda of=sda-2by.mbr bs=512 count=1

1+0 records in
1+0 records out
512 bytes (512 B) copied, 5,5443e-05 s, 9,2 MB/s

sudo dd if=/dev/sda of=sda3-2by.pbr bs=512 count=1 skip=1407862784

1+0 records in
1+0 records out
512 bytes (512 B) copied, 5,2482e-05 s, 9,8 MB/s

4

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

I will need the files sda3-2by.pbr and sda-2by.mbr uploaded so that I can binary edit the file to fix the problem.

You can upload these files to a media sharing site, such as mediafire or filefactory, and post the link to these files in this forum post.

5

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

Ah okay, can you tell me where can I find the files? :-)

Also, this error comes when I click on bootcamp harddrive in Ubunu, dont know if it helps in some way:

Error mounting: mount exited with exit code 12: Failed to read last sector (545660927): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
   or it was not setup correctly (e.g. by not using mdadm --build ...),
   or a wrong device is tried to be mounted,
   or the partition table is corrupt (partition is smaller than NTFS),
   or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/sda3': Invalid argument
The device '/dev/sda3' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

6

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

If you booted from GParted Live, then the files would be stored in RAM in the folder from which you ran the "sudo dd..." command.  You would need to copy these files to more permanent media, such as a USB flash drive.  Then when you reboot into another OS, you can then upload the files from your USB flash drive.

7

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

I just boot into Ubuntu and use the terminal ? :-)

8

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

Yes, that will work.

9

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

Yea but thats what i do, where do the files get saved, or how do I save the file?

Sorry if this is newbie questions, but I'm new to Linux :-)

10

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

The file is saved in the directory that you type the command.

If you want to specify a directory, you could add the full path to the name, such as /tmp/sda-2by.mbr.

11

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

Ah all right, I found them :-)

sda3
http://gupl.dk/56353/

sda
http://gupl.dk/56354/

12

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

Since you were trying to shrink the partition, we will decrease the NTFS volume size to fit within the partition.

The change I have made to the file is from a length of 545,660,927 sectors:
00000020   00 00 00 00  80 00 80 00  FF 1F 86 20  00 00 00 00
To a new length of 200,931,927 sectors:
00000020   00 00 00 00  80 00 80 00  FF F7 F9 0B  00 00 00 00

Note:  The NTFS volume size is always 1 sector less than the total number of sectors in the partition table entry because the NTFS backup sector is not considered part of the NTFS volume.

To apply this change:

1) Download the new NTFS PBR: sda3-2by_new.pbr

2) Load the new NTFS PBR on your hard disk.
NOTE:  Be extra careful when entering the commands.  Data loss could result otherwise.

dd if=sda3-2by_new.pbr of=/dev/sda bs=512 count=1 seek=1407862784

3) Reboot the computer

4) Check that the file system is recognized in GParted

5) If all seems fine then I would advise booting into Windows and running "chkdsk /f /r" multiple times, until there are no more faults.

Please note that if there are any mismatches between the GPT and MBR partition tables on your MAC, you might need to use a tool such as rEFIt to fix these problems.

13

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

Thank you gedakc, I have made the changes now but the size is the same.

In GParted I still get error when checking the disk:

GParted 0.6.2

Libparted 2.3
Check and repair file system (ntfs) on /dev/sda3  00:00:02    ( ERROR )
         
calibrate /dev/sda3  00:00:00    ( SUCCESS )
         
path: /dev/sda3
start: 1407862784
end: 1608794111
size: 200931328 (95.81 GiB)
check file system on /dev/sda3 for errors and (if possible) fix them  00:00:02    ( ERROR )
         
ntfsresize -P -i -f -v /dev/sda3
         
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda3
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 102876836352 bytes (102877 MB)
Current device size: 102876839936 bytes (102877 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Outside of the volume reference for inode 517 at 35944491:8192
Outside of the volume reference for inode 1672 at 35355490:64
Outside of the volume reference for inode 1754 at 34575520:6
Outside of the volume reference for inode 1754 at 35355560:8
Outside of the volume reference for inode 2218 at 35355122:37
Outside of the volume reference for inode 4470 at 35356295:9
Outside of the volume reference for inode 37171 at 34463448:65536
Outside of the volume reference for inode 37171 at 35826816:70876
Outside of the volume reference for inode 37171 at 34865356:28192
Outside of the volume reference for inode 37171 at 35553280:32152
Outside of the volume reference for inode 40032 at 35356672:19
Outside of the volume reference for inode 41347 at 34182305:64
Outside of the volume reference for inode 48773 at 35979256:59396
Outside of the volume reference for inode 59685 at 35356491:6
Outside of the volume reference for inode 59746 at 35356518:4
Outside of the volume reference for inode 60432 at 35355570:37
Outside of the volume reference for inode 60433 at 35355735:37
Outside of the volume reference for inode 63426 at 35335159:19636
Outside of the volume reference for inode 64858 at 34226220:44692
Outside of the volume reference for inode 67864 at 35354795:1
Outside of the volume reference for inode 67890 at 35356453:1
Outside of the volume reference for inode 69370 at 36129684:9620
Outside of the volume reference for inode 70509 at 36237496:218940
Outside of the volume reference for inode 78664 at 37004676:210644
Outside of the volume reference for inode 110161 at 34575503:17
Outside of the volume reference for inode 114246 at 36569672:9
Outside of the volume reference for inode 116775 at 35356570:72
Outside of the volume reference for inode 117667 at 35354924:5
Outside of the volume reference for inode 117952 at 34575572:7
Outside of the volume reference for inode 118066 at 37517672:82088
Outside of the volume reference for inode 118069 at 35354796:128
Outside of the volume reference for inode 118138 at 34575362:6
Outside of the volume reference for inode 118155 at 34575527:9
Outside of the volume reference for inode 118214 at 36139304:636
Outside of the volume reference for inode 118232 at 34575526:1
Outside of the volume reference for inode 118307 at 35355162:15
Outside of the volume reference for inode 118309 at 35355177:15
Outside of the volume reference for inode 118310 at 35355192:14
Outside of the volume reference for inode 118337 at 35355206:6
Outside of the volume reference for inode 118509 at 34575579:1
Outside of the volume reference for inode 118510 at 35355049:1
Outside of the volume reference for inode 118511 at 35355716:1
Outside of the volume reference for inode 118512 at 35356497:1
Outside of the volume reference for inode 118553 at 34575349:12
Outside of the volume reference for inode 118561 at 35355300:129
Outside of the volume reference for inode 118651 at 35355226:1
Outside of the volume reference for inode 118652 at 35355227:1
Outside of the volume reference for inode 118654 at 35355568:1
Outside of the volume reference for inode 118655 at 35355569:1
Outside of the volume reference for inode 118658 at 35355554:6
Outside of the volume reference for inode 118660 at 35355616:8
Outside of the volume reference for inode 118661 at 35355624:5
Outside of the volume reference for inode 118759 at 35356484:6
Outside of the volume reference for inode 118768 at 35356459:10
Outside of the volume reference for inode 118776 at 35356469:5
Outside of the volume reference for inode 118785 at 35356454:5
Outside of the volume reference for inode 118794 at 35356474:10
Outside of the volume reference for inode 118861 at 35355717:18
Outside of the volume reference for inode 118871 at 35355701:6
Outside of the volume reference for inode 118872 at 35355707:8
Outside of the volume reference for inode 119099 at 35355669:30
Outside of the volume reference for inode 119229 at 35355212:7
Outside of the volume reference for inode 119538 at 35355050:72
Outside of the volume reference for inode 119564 at 34575268:24
Outside of the volume reference for inode 119979 at 34575361:1
Outside of the volume reference for inode 119986 at 34575368:1
Outside of the volume reference for inode 119988 at 35355219:1
Outside of the volume reference for inode 119990 at 35355668:1
Outside of the volume reference for inode 119993 at 35355700:1
Outside of the volume reference for inode 120005 at 35356327:1
Outside of the volume reference for inode 120007 at 35356671:1
Outside of the volume reference for inode 120258 at 34575386:1
Outside of the volume reference for inode 120291 at 35355781:1
Outside of the volume reference for inode 120533 at 37296488:108744
Outside of the volume reference for inode 120569 at 35356527:18
Outside of the volume reference for inode 120579 at 35356561:6
Outside of the volume reference for inode 120823 at 35354929:64
Outside of the volume reference for inode 120935 at 34575292:15
Outside of the volume reference for inode 120999 at 35355715:1
Outside of the volume reference for inode 121088 at 35355782:460
Outside of the volume reference for inode 121316 at 34626568:131072
Outside of the volume reference for inode 121382 at 35355220:3
Outside of the volume reference for inode 121471 at 35355429:61
Outside of the volume reference for inode 121480 at 35356498:7
Outside of the volume reference for inode 121480 at 35356505:7
Outside of the volume reference for inode 121480 at 35356512:6
Outside of the volume reference for inode 121492 at 35356658:13
Outside of the volume reference for inode 121496 at 35356691:12
Outside of the volume reference for inode 121549 at 35355772:9
Outside of the volume reference for inode 121565 at 35355607:9
Outside of the volume reference for inode 126420 at 34893548:164448
Outside of the volume reference for inode 126635 at 35356776:73640
Outside of the volume reference for inode 127135 at 35057996:236224
Outside of the volume reference for inode 127135 at 34820760:44392
Outside of the volume reference for inode 127135 at 35430416:69820
Outside of the volume reference for inode 127135 at 35534076:19204
Outside of the volume reference for inode 127135 at 35304112:22920
Outside of the volume reference for inode 127135 at 36139940:97556
Outside of the volume reference for inode 127135 at 34609872:16696
Outside of the volume reference for inode 132749 at 35610348:216468
Outside of the volume reference for inode 132754 at 34353124:1
Outside of the volume reference for inode 132754 at 34316134:2
Outside of the volume reference for inode 132755 at 36569715:1
Outside of the volume reference for inode 133383 at 34575319:6
Outside of the volume reference for inode 133384 at 34575327:6
Outside of the volume reference for inode 133717 at 34575325:1
ERROR: Filesystem check failed!
ERROR: 2053467 clusters are referenced outside of the volume.
NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!
The usage of the /f parameter is very IMPORTANT! No modification was
and will be made to NTFS by this software until it gets repaired.

========================================

14

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

The log file contains the instructions on how to resolve the problem:

Run chkdsk /f on Windows then reboot it TWICE!

This is step 5 listed in the instructions above in comment #12.

15

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

The problem is that when I choose to boot from windows in rEFit, the Grub boot loader doesnt give me the opportunity to select Windows partition. Only Ubuntu and Mac OS X is displayed in the Grub menu sad

16

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

You can add entries to your grub menu.  Try searching for tutorials on GRUB or GRUB2 (depending on which you are using).

17

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

I just used update-grub, doh... But now I bot it booted to Win7 and ran chkdsk twice and there are no errors!! big_smile:D

Thank you so much man!! thank you and thank you! smile

18

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

And once again, THANKS big_smile

19

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

'Glad to hear you are up and running again.

To help others searching for similar problems, you can edit your initial post and prefix "SOLVED" in the title.

20

Re: [SOLVED] Cant boot to Win7 after Ubuntu install

Sure:)