NTFS Error: size boot_sector > partition

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
Locked
Message
Author
xavier23
Posts: 3
Joined: 22 Jul 2019, 21:54

NTFS Error: size boot_sector > partition

#1 Post by xavier23 »

I have a 1TB disk with FAT/NTFS partitions. I tried to shrink the main NTFS partition from 999GB down to 150GB using ntfsresize and parted.

Before operations:

Code: Select all

root@ubuntu:/home/ubuntu# parted /dev/sda print
Model: ATA ST1000LM035-1RK1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                          Flags
 1      1049kB  106MB   105MB   fat32        EFI system partition          boot, esp
 2      106MB   123MB   16.8MB               Microsoft reserved partition  msftres
 3      123MB   999GB   999GB   ntfs         Basic data partition          msftdata
 4      999GB   1000GB  1074MB  ntfs         Basic data partition          diag


Commands issued for resize of the filesystem and partitions as follows:

Code: Select all

root@ubuntu:/home/ubuntu# ntfsresize -s 148G /dev/sda3
[code]
Output of NTFSRESIZE:
[code]
Current volume size: 999007711744 bytes (999008 MB)
Current device size: 999007715328 bytes (999008 MB)
New volume size    : 147999998464 bytes (148000 MB)
.....
Space in use       : 85624 MB (8.6%)
Collecting resizing constraints ...
Needed relocations : 185404 (760 MB)
.....
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sda3'.
parted command issue:

Code: Select all

root@ubuntu:/home/ubuntu# parted /dev/sda
OUTPUT of parted:

Code: Select all

(parted) 
Unit?  [compact]? kb                                                      
(parted) print                                                            
...

Number  Start        End           Size         File system  Name                          Flags
 1      1049kB       105906kB      104858kB     fat32        EFI system partition          boot, esp
 2      105906kB     122683kB      16777kB                   Microsoft reserved partition  msftres
 3      122683kB     999130399kB   999007715kB  ntfs         Basic data partition          msftdata
 4      999130399kB  1000204141kB  1073742kB    ntfs         Basic data partition          diag

(parted) resizepart 3 148000008
....                                                       
(parted) quit                                                             
Information: You may need to update /etc/fstab.
I have removed some output for easy reading

And As it says in the confirmation of ntfsresize I can use testdisk if I made a mistake, (thats why I found testdisk :lol: )

Code: Select all

IMPORTANT: When recreating the partition, make sure that you
  1)  create it at the same disk sector (use sector as the unit!)
  2)  create it with the same partition type (usually 7, HPFS/NTFS)
  3)  do not make it smaller than the new NTFS filesystem size
  4)  set the bootable flag for the partition if it existed before
Otherwise you won't be able to access NTFS or can't boot from the disk!
If you make a mistake and don't have a partition table backup then you
can recover the partition table by TestDisk or Parted's rescue mode.
Now the operations are completed the problem is to mount or access the ntfs partiton as originally stated.

Here are the key facts:
  • partition ends at 289062515 (verified by testdisk/fdisk/parted)
    Parted gives partition size 288822900
    Testdisk gives size boot_sector 289062497 > partition 288822900
    Last sector according to `mount /dev/sda3 /mnt/windows` is 289062495
So the size boot_sector is > size partition as shown in the testdisk error. I suppose then the boot_sector must be within the partition size and this is why I cannot mount my NTFS partition anymore.

So is it is the problem with my NTFS boot sector has been destroyed and i need to recreate it? Any help is gladly appreciated.

I feel like there is some hope in getting my files back since maybe only the MFT or boot sector has been destroyed but my files are still there?

Testdisk output:

Code: Select all

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 1000 GB / 931 GiB - CHS 121601 255 63
Current partition structure:
     Partition                  Start        End    Size in sectors

 1 P EFI System                  2048     206847     204800 [EFI system partition]
No FAT, NTFS, ext2, JFS, Reiser, cramfs or XFS marker
 2 P MS Reserved               206848     239615      32768 [Microsoft reserved partition]
 2 P MS Reserved               206848     239615      32768 [Microsoft reserved partition]
Error: size boot_sector 289062497 > partition 288822900
No FAT, NTFS, ext2, JFS, Reiser, cramfs or XFS marker
 3 P MS Data                   239616  289062515  288822900 [Basic data partition]
 3 P MS Data                   239616  289062515  288822900 [Basic data partition]
 4 P Unknown               1951426560 1953523711    2097152 [Basic data partition]
COMMENTS:

When I try to mount here's what happens:

Code: Select all

root@ubuntu:/home/ubuntu# mount /dev/sda3 /mnt/windows
Failed to read last sector (289062495): 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?
Output of ntfsresize --info:

Code: Select all

root@ubuntu:/home/ubuntu# ntfsresize --info /dev/sda3
ntfsresize v2017.3.23AR.3 (libntfs-3g)
Failed to read last sector (289062495): 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).
ERROR(22): Opening '/dev/sda3' as NTFS failed: Invalid argument
The device '/dev/sda3' doesn't have a valid NTFS.
Maybe you selected the wrong partition? Or the whole disk instead of a
partition (e.g. /dev/hda, not /dev/hda1)? This error might also occur
if the disk was incorrectly repartitioned (see the ntfsresize FAQ).

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

Re: NTFS Error: size boot_sector > partition

#2 Post by cgrenier »

Run TestDisk, select the disk, Advanced, select the NTFS partition, Boot, RebuildBS, List.
If you can see your files, choose Write, confirm, Quit and reboot your computer.
Try again to mount your NTFS partition.

Locked