TestDisk scan: unable to write partition table

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Message
Author
Iceking007
Posts: 15
Joined: 30 Nov 2012, 19:09

TestDisk scan: unable to write partition table

#1 Post by Iceking007 »

Hello fiona, need your help please. My BIOS reset after cleaning my computer and I forgot to check the RAID status. Scanning with TestDisk I found my two partitions but it was too small, so I changed the CHS to a larger size (from 462078 to 463078), now it doesn't say it's too small for my two partitions but when I go to write it fails.

Code: Select all

Fri Jul 08 18:37:59 2016
Command line: TestDisk

TestDisk 6.14, Data Recovery Utility, July 2013
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
OS: Windows 7 (7601) SP1
Compiler: GCC 4.7, MinGW 3.11
Compilation date: Jul 30 2013 14:09:04
ext2fs lib: none, ntfs lib: 10:0:0, reiserfs lib: none, ewf lib: 20120504
disk_get_size_win32 IOCTL_DISK_GET_LENGTH_INFO(\\.\PhysicalDrive0)=3800720998400
disk_get_size_win32 IOCTL_DISK_GET_LENGTH_INFO(\\.\PhysicalDrive1)=480103981056
disk_get_size_win32 IOCTL_DISK_GET_LENGTH_INFO(\\.\PhysicalDrive2)=240057409536
filewin32_getfilesize(\\.\PhysicalDrive3) GetFileSize err Incorrect function.


filewin32_setfilepointer(\\.\PhysicalDrive3) SetFilePointer err Incorrect function.


Warning: can't get size for \\.\PhysicalDrive3
disk_get_size_win32 IOCTL_DISK_GET_LENGTH_INFO(\\.\PhysicalDrive4)=120034123776
disk_get_size_win32 IOCTL_DISK_GET_LENGTH_INFO(\\.\C:)=480101007360
disk_get_size_win32 IOCTL_DISK_GET_LENGTH_INFO(\\.\D:)=0
Warning: can't get size for \\.\D:
disk_get_size_win32 IOCTL_DISK_GET_LENGTH_INFO(\\.\I:)=240053649408
disk_get_size_win32 IOCTL_DISK_GET_LENGTH_INFO(\\.\Y:)=120030494720
Hard disk list
Disk \\.\PhysicalDrive0 - 3800 GB / 3539 GiB - CHS 462078 255 63, sector size=512
Disk \\.\PhysicalDrive1 - 480 GB / 447 GiB - CHS 58369 255 63, sector size=512
Disk \\.\PhysicalDrive2 - 240 GB / 223 GiB - CHS 29185 255 63, sector size=512
Disk \\.\PhysicalDrive4 - 120 GB / 111 GiB - CHS 14593 255 63, sector size=512
Drive C: - 480 GB / 447 GiB - CHS 58368 255 63, sector size=512
Drive I: - 240 GB / 223 GiB - CHS 29184 255 63, sector size=512
Drive Y: - 120 GB / 111 GiB - CHS 14592 255 63, sector size=512

Partition table type (auto): EFI GPT
Disk \\.\PhysicalDrive0 - 3800 GB / 3539 GiB
Partition table type: EFI GPT
New geometry
Disk \\.\PhysicalDrive0 - 3808 GB / 3547 GiB - CHS 463078 255 63 sector_size=512

Analyse Disk \\.\PhysicalDrive0 - 3808 GB / 3547 GiB - CHS 463078 255 63
hdr_size=92
hdr_lba_self=1
hdr_lba_alt=7439348069 (expected 7439348069)
hdr_lba_start=34
hdr_lba_end=7439348036
hdr_lba_table=2
hdr_entries=128
hdr_entsz=128
Current partition structure:
 1 P MS Data                     2304  980830456  980828153 [Local Files]
 2 P MS Data                980832256 7423391736 6442559481 [Storage Data A]

search_part()
Disk \\.\PhysicalDrive0 - 3808 GB / 3547 GiB - CHS 463078 255 63
NTFS at 0/36/37
filesystem size           980828153
sectors_per_cluster       8
mft_lcn                   32771
mftmirr_lcn               32817
clusters_per_mft_record   -10
clusters_per_index_record 1
NTFS part_offset=1179648, part_size=502184014336, sector_size=512
NTFS partition cannot be added (part_offset<part_size).
NTFS at 0/36/37
filesystem size           980828153
sectors_per_cluster       8
mft_lcn                   32771
mftmirr_lcn               32817
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                     2304  980830456  980828153 [Local Files]
     NTFS, blocksize=4096, 502 GB / 467 GiB
NTFS at 61053/250/62
filesystem size           6442559481
sectors_per_cluster       8
mft_lcn                   2
mftmirr_lcn               48
clusters_per_mft_record   -10
clusters_per_index_record 1
NTFS part_offset=502186115072, part_size=3298590454272, sector_size=512
NTFS partition cannot be added (part_offset<part_size).
NTFS at 61053/250/62
filesystem size           6442559481
sectors_per_cluster       8
mft_lcn                   2
mftmirr_lcn               48
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                980832256 7423391736 6442559481 [Storage Data A]
     NTFS, blocksize=4096, 3298 GB / 3072 GiB
file_win32_pread(280,1,buffer,3128424441(462084/194/56)) read err: read after end of file
file_win32_pread(280,1,buffer,3128424442(462084/194/57)) read err: read after end of file
file_win32_pread(280,14,buffer,3128424443(462084/194/58)) read err: read after end of file
file_win32_pread(280,3,buffer,3128424457(462084/195/9)) read err: read after end of file
file_win32_pread(280,3,buffer,3128424504(462084/195/56)) read err: read after end of file
file_win32_pread(280,8,buffer,3128424520(462084/196/9)) read err: read after end of file
file_win32_pread(280,11,buffer,3128424567(462084/196/56)) read err: read after end of file
file_win32_pread(280,2,buffer,3128426489(462084/227/25)) read err: read after end of file

Results
   P MS Data                     2304  980830456  980828153 [Local Files]
     NTFS, blocksize=4096, 502 GB / 467 GiB
   P MS Data                980832256 7423391736 6442559481 [Storage Data A]
     NTFS, blocksize=4096, 3298 GB / 3072 GiB

interface_write()
 1 P MS Data                     2304  980830456  980828153 [Local Files]
 2 P MS Data                980832256 7423391736 6442559481 [Storage Data A]
write!
file_win32_pwrite(280,32,buffer,3144380741(463077/254/31)) write err

Partition: Write error

TestDisk exited normally.

Iceking007
Posts: 15
Joined: 30 Nov 2012, 19:09

Re: TestDisk scan: unable to write partition table

#2 Post by Iceking007 »

I just finished a full scan, hopefully this helps more?
testdisk.zip
(16.94 KiB) Downloaded 447 times

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: TestDisk scan: unable to write partition table

#3 Post by cgrenier »

The current partition table already lists the two partitions. I don't understand why you try to rewrite the partition table.
Note that using TestDisk 7.1-WIP is probably a better idea than using the old 6.14.

Iceking007
Posts: 15
Joined: 30 Nov 2012, 19:09

Re: TestDisk scan: unable to write partition table

#4 Post by Iceking007 »

Hello cgreiner,

Yes I just updated versions hoping it would write it correctly.

I think you probably got that information from the log file? Perhaps it's just a virtual partition, every time I went to write the partition it failed. It's possible on that log file I analyzed a few times and attempted writing a few times so perhaps it logs that it did write the two partitions but it actually didn't?

(This was a RAID 0 array that was deleted and rebuilt the same, I don't have any active partitions on it in 'Windows' eyes')

Thank you for your help and input.

Edit: Windows management wants me to initialize the disk array, should I do that? I was able to copy all my files from both partitions without any errors and have confirmed they are safely on another drive.
Attachments
testdisk.zip
New Log File
(6.8 KiB) Downloaded 332 times

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: TestDisk scan: unable to write partition table

#5 Post by cgrenier »

Your partition table is EFI GPT. The backup of the table is at the end of the disk.
Because you have used the Geometry menu to alter artificially its size, it's not possible to write this backup partition table as its location is after the real end of the disk.

There are 2 possibilities:
- backup your data (what you have already done I think), recreate the partition table, recreate the partitions, restore the files
- run testdisk, analyse, Quick Search, Stop, use 'a' to manually add the second partition with a smaller size, set the added partition as P(rimary), on next screen, there should be the 2 partitions, write the partition table, in Advanced, select the second partition, choose Boot, RebuildBS, List, if you can see your files, choose Write, confirm, Quit and restart your computer

Iceking007
Posts: 15
Joined: 30 Nov 2012, 19:09

Re: TestDisk scan: unable to write partition table

#6 Post by Iceking007 »

Okay I'm not quite sure how to do that; I can't recall what size they were to begin with in order to reformat. I'm trying to resize in test disk like you said in option two and I get here. I arbitrarily reduced the size from 7423628 (or what ever it was exactly) to 6423628 thinking that would be enough, now I get this screen (photo attached) and I'm wondering if this is correct? Also shouldn't it be after the first partition?

Thank you for your continued help.
Attachments
PSX_20160916_123401.jpg
PSX_20160916_123401.jpg (188.73 KiB) Viewed 8813 times

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: TestDisk scan: unable to write partition table

#7 Post by cgrenier »

Can you redo your test using latest testdisk 7.1-WIP ? Please copy and paste the testdisk.log content instead of the screenshots.

Iceking007
Posts: 15
Joined: 30 Nov 2012, 19:09

Re: TestDisk scan: unable to write partition table

#8 Post by Iceking007 »

Hello, I can't update to 7.1 because I can't afford internet at the moment, I have very little mobile data in which to upload this file. Please find a new quick search and deep search log attached.
testdisk.log.zip
(31.88 KiB) Downloaded 342 times
I forgot which file extension was required to attach a file, after trying a few I spent an hour cutting and pasting 8 pages of the log at a time only to find out 3/4 the way through it's too large. Then I saw I previously uploaded a .zip file (luckily I could compress it sufficiently enough as it was still too large). It might be useful to put the .zip file extension in the FAQ section.

Iceking007
Posts: 15
Joined: 30 Nov 2012, 19:09

Re: TestDisk scan: unable to write partition table

#9 Post by Iceking007 »

Okay I was able to get the new 7.1 and scan my drives.
Attachments
testdisk.log.zip
(29.98 KiB) Downloaded 369 times

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: TestDisk scan: unable to write partition table

#10 Post by cgrenier »

run testdisk, analyse, Quick Search, Stop, use 'a' to manually add the partition
MS Data 980832256 7423283191
set the added partition as P(rimary), on next screen, there should be the 2 partitions, write the partition table, in Advanced, select the second partition, choose Type, set the type to MS DATA and NTFS, Boot, RebuildBS, List, if you can see your files, choose Write, confirm, Quit and restart your computer

Locked