Fix dual boot laptop

How to use TestDisk to recover lost partition
Post Reply
Message
Author
sesykes71
Posts: 3
Joined: 05 Oct 2014, 19:02

Fix dual boot laptop

#1 Post by sesykes71 » 05 Oct 2014, 19:11

My Dell laptop has a 160GB hard drive on it. I was trying to use TestDisk to repair booting of an SD card for a Raspberry Pi. By mistake I managed to mess up my grub bootloader instead of fixing the SD card. I have managed to get Ubuntu 14.04 to boot but it doesn't see the Windows 7 drive, nor does it boot windows.

When running TestDisk I see this:
***********************************************************************************
TestDisk 7.0-WIP, Data Recovery Utility, October 2014
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 160 GB / 149 GiB - CHS 19457 255 63
Partition Start End Size in sectors
D HPFS - NTFS 0 32 33 12 223 19 204800
>D HPFS - NTFS 12 223 20 10634 207 5 170641408
D Linux 10634 239 38 18413 1 20 124954624
D Linux Swap 18413 1 21 19457 53 52 16775168


Structure: Ok. Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
*=Primary bootable P=Primary L=Logical E=Extended D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
Enter: to continue
NTFS, blocksize=4096, 87 GB / 81 GiB
*********************************************************************************************

I have checked and still have all my files. How do I undelete the NTFS partitions and get the dual boot to work?


Thanks for any help.

Regards,
Steve Sykes

Sponsored links

User avatar
Fiona
Posts: 2836
Joined: 18 Feb 2012, 17:19
Location: Ludwigsburg/Stuttgart - Germany

Re: Fix dual boot laptop

#2 Post by Fiona » 06 Oct 2014, 07:20

I'd need info from testdisk Analyse and your current partition structure (partition table).
Can you copy and paste the content of your testdisk.log containing the info mentioned above?

sesykes71
Posts: 3
Joined: 05 Oct 2014, 19:02

Re: Fix dual boot laptop

#3 Post by sesykes71 » 06 Oct 2014, 13:48

Here it is. Thank you.


Sun Oct 5 13:46:06 2014
Command line: TestDisk

TestDisk 7.0-WIP, Data Recovery Utility, October 2014
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
OS: Linux, kernel 3.13.0-36-generic (#63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014) x86_64
Compiler: GCC 4.4
Compilation date: 2014-10-04T15:02:31
ext2fs lib: 1.42.8, ntfs lib: libntfs-3g, reiserfs lib: 0.3.1-rc8, ewf lib: 20120504
/dev/sda: LBA, HPA, LBA48, DCO support
/dev/sda: size 312581808 sectors
/dev/sda: user_max 312581808 sectors
/dev/sda: native_max 312581808 sectors
/dev/sda: dco 312581808 sectors
Warning: can't get size for Disk /dev/mapper/control - 0 B - 0 sectors, sector size=512
Hard disk list
Disk /dev/sda - 160 GB / 149 GiB - CHS 19457 255 63, sector size=512 - WDC WD1600BJKT-75F4T0, S/N:WD-WXG1C3072588, FW:11.01A11

Partition table type (auto): Intel
Disk /dev/sda - 160 GB / 149 GiB - WDC WD1600BJKT-75F4T0
Partition table type: Intel

Analyse Disk /dev/sda - 160 GB / 149 GiB - CHS 19457 255 63
Geometry from i386 MBR: head=255 sector=63
Current partition structure:
1 * Linux 10634 239 38 18413 1 20 124954624

search_part()
Disk /dev/sda - 160 GB / 149 GiB - CHS 19457 255 63
NTFS at 0/32/33
filesystem size 204800
sectors_per_cluster 8
mft_lcn 8533
mftmirr_lcn 2
clusters_per_mft_record -10
clusters_per_index_record 1
HPFS - NTFS 0 32 33 12 223 19 204800
NTFS, blocksize=4096, 104 MB / 100 MiB
NTFS at 12/223/20
filesystem size 170641408
sectors_per_cluster 8
mft_lcn 786432
mftmirr_lcn 2
clusters_per_mft_record -10
clusters_per_index_record 1
HPFS - NTFS 12 223 20 10634 207 5 170641408
NTFS, blocksize=4096, 87 GB / 81 GiB

recover_EXT2: s_block_group_nr=0/476, s_mnt_count=1446/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8192
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15619328
recover_EXT2: part_size 124954624
Linux 10634 239 38 18413 1 20 124954624
ext4 blocksize=4096 Large file Sparse superblock Recover, 63 GB / 59 GiB
Linux Swap 18413 1 21 19457 53 36 16775152
SWAP2 version 1, pagesize=4096, 8588 MB / 8190 MiB

Results
HPFS - NTFS 0 32 33 12 223 19 204800
NTFS, blocksize=4096, 104 MB / 100 MiB
HPFS - NTFS 12 223 20 10634 207 5 170641408
NTFS, blocksize=4096, 87 GB / 81 GiB
Linux 10634 239 38 18413 1 20 124954624
ext4 blocksize=4096 Large file Sparse superblock Recover, 63 GB / 59 GiB
Linux Swap 18413 1 21 19457 53 52 16775168
SWAP2 version 1, pagesize=4096, 8588 MB / 8191 MiB

Hint for advanced users. dmsetup may be used if you prefer to avoid to rewrite the partition table for the moment:
echo "0 204800 linear /dev/sda 2048" | dmsetup create test0
echo "0 170641408 linear /dev/sda 206848" | dmsetup create test1
echo "0 124954624 linear /dev/sda 170850304" | dmsetup create test2
echo "0 16775168 linear /dev/sda 295804928" | dmsetup create test3
ntfs_device_testdisk_io_ioctl() unimplemented
ntfs_ucstoutf8: iconv_open failed


dir_partition inode=5
HPFS - NTFS 12 223 20 10634 207 5 170641408
NTFS, blocksize=4096, 87 GB / 81 GiB
Directory /
5 dr-xr-xr-x 0 0 0 3-Oct-2014 21:14 .
5 dr-xr-xr-x 0 0 0 3-Oct-2014 21:14 ..
13608 dr-xr-xr-x 0 0 0 20-Jan-2014 15:08 $RECYCLE.BIN
159425 dr-xr-xr-x 0 0 0 3-Sep-2014 23:51 Arcom
41088 dr-xr-xr-x 0 0 0 25-Jul-2012 18:21 Brother's Keeper 6
88885 dr-xr-xr-x 0 0 0 3-Oct-2014 21:24 Config.Msi
21600 dr-xr-xr-x 0 0 0 27-Feb-2014 13:43 Image Scan Tool
57672 dr-xr-xr-x 0 0 0 18-Jun-2014 20:58 Intel
69548 dr-xr-xr-x 0 0 0 28-Jul-2012 11:58 Logger32
67278 dr-xr-xr-x 0 0 0 26-Apr-2012 17:23 MSOCache
58 dr-xr-xr-x 0 0 0 13-Jul-2009 23:20 PerfLogs
60 dr-xr-xr-x 0 0 0 14-Sep-2014 12:46 Program Files
273 dr-xr-xr-x 0 0 0 30-Sep-2014 23:27 Program Files (x86)
389 dr-xr-xr-x 0 0 0 19-Sep-2014 01:59 ProgramData
198739 dr-xr-xr-x 0 0 0 22-May-2013 17:49 Qoobox
57874 dr-xr-xr-x 0 0 0 26-Apr-2012 14:31 Recovery
70527 dr-xr-xr-x 0 0 0 9-Aug-2014 17:59 Spectrum
57583 dr-xr-xr-x 0 0 0 3-Oct-2014 21:13 System Volume Information
483 dr-xr-xr-x 0 0 0 7-Feb-2014 18:14 Users
21825 dr-xr-xr-x 0 0 0 4-Mar-2014 17:08 Video
645 dr-xr-xr-x 0 0 0 4-Oct-2014 02:16 Windows
60955 dr-xr-xr-x 0 0 0 25-Aug-2014 10:35 dell
84756 dr-xr-xr-x 0 0 0 10-Feb-2014 16:44 requiem
115063 dr-xr-xr-x 0 0 0 16-Sep-2014 21:49 usb_driver
96317 -r--r--r-- 0 0 186 18-Sep-2014 13:10 .CAC
77383 -r--r--r-- 0 0 17255 22-May-2013 17:49 ComboFix.txt
53870 -r--r--r-- 0 0 2 19-Feb-2014 16:04 NQVMCLTINST.INI
25448 -r--r--r-- 0 0 282 30-Nov-2013 11:39 SSUUpdater.log
15896 -r--r--r-- 0 0 3183398912 3-Oct-2014 21:24 hiberfil.sys
5668 -r--r--r-- 0 0 4244533248 3-Oct-2014 21:24 pagefile.sys
5668 -r--r--r-- 0 0 0 3-Oct-2014 21:24 pagefile.sys
5668 -r--r--r-- 0 0 0 3-Oct-2014 21:24 pagefile.sys
5668 -r--r--r-- 0 0 0 3-Oct-2014 21:24 pagefile.sys
5668 -r--r--r-- 0 0 0 3-Oct-2014 21:24 pagefile.sys
5668 -r--r--r-- 0 0 0 3-Oct-2014 21:24 pagefile.sys
SIGINT detected! TestDisk has been killed.

User avatar
Fiona
Posts: 2836
Joined: 18 Feb 2012, 17:19
Location: Ludwigsburg/Stuttgart - Germany

Re: Fix dual boot laptop

#4 Post by Fiona » 08 Oct 2014, 06:13

Your current partition table only contain your single linux partition.
Nothing else.
Current partition structure:
1 * Linux 10634 239 38 18413 1 20 124954624
That's why it's recommended to recover your missing partitions first.
Instructions:
Results
HPFS - NTFS 0 32 33 12 223 19 204800
NTFS, blocksize=4096, 104 MB / 100 MiB
HPFS - NTFS 12 223 20 10634 207 5 170641408
NTFS, blocksize=4096, 87 GB / 81 GiB
Linux 10634 239 38 18413 1 20 124954624
ext4 blocksize=4096 Large file Sparse superblock Recover, 63 GB / 59 GiB
Linux Swap 18413 1 21 19457 53 52 16775168
SWAP2 version 1, pagesize=4096, 8588 MB / 8191 MiB
The first NTFS partition is normally your boot partition for windows.
You can mark it and using the left or right arrow key on your keyboard to set it to * (star for primary active and bootable).
You'll see it at the left side.
The second NTFS-partition should be set to P for primary only.
It's your windows and data partition.
Your third partition is you Linux partition you can set it to p for primary only.
Please note, only one partition can be active and bootable.
Same procedure for your linux swap partition to set it up to P for primary.

If you were setting up all you partitions for recovery, you can press enter and confirm at the menu Write to register all your partitions into your partition table.

This procedure tries to boot windows.
If you experience any problems, you should run a windows startup repair.
http://windows.microsoft.com/en-us/wind ... =windows-7

TestDisk only works standard and overwrites bootmanager settings like Grub to allow multiboot.
That's why you must repair or reinstall Grub to get multiboot working again.
http://askubuntu.com/questions/83771/re ... -windows-7

Also, it's up to you to decide which OS you want to start.
If you prefer to boot Linux instead of Windows, you must set your Linux partition to * (star as active and bootable).

To boot a computer is a sensitive case, that's why it's always recommended to have a Live-CD available.

sesykes71
Posts: 3
Joined: 05 Oct 2014, 19:02

Re: Fix dual boot laptop

#5 Post by sesykes71 » 08 Oct 2014, 14:17

Thank you Fiona, I marked the partitions as you suggested and rebooted. It came up in grub-rescue. I inserted my "boot-repair-disk" usb stick and rebooted. Now everything works again and with no data loss!
I really appreciate your help.

Thanks, again
Steve

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests