2

My desktop has one (and only) 3TB hard drive with 5 partitions: 1. EFI, 2. Windows 7 SP1 (64-bit), 3. HP Factory Recovery partition, 4. a NTFS for data storage, and 5. Ubuntu 18.04.2 (64-bit). GRUB (v.2.02) is the bootloader.

As long as I boot into Windows 7, I always get a "secondary partition table overlapping the last partition by 4,294,966,385 blocks" warning and the last usable sector is reset to be 1,565,565,838 (which precedes the last sector 5,860,533,168 of the hard drive far too early). The same warning keeps coming back, whether I let Windows 7 to fix it or I fixed it by gparted in Ubuntu.

The questions I request for your kind help are two:

  1. Is there any solution or a way to prevent Windows 7 from wrongly reset the secondary GPT during the process of loading Windows?

  2. The misplacement of the secondary GPT causes that some of my files have zero bytes in file size now. Is there a way to restore these files, since the contents of these files are still there?

Below are the detailed error messages:

(1. Ubuntu Phase)
Let's say, the last booting OS is Ubuntu, and Gparted and Gdisk do not detect any partition error.

(2. Windows Phase)
Reboot. During loading Windows 7 and before showing the Windows desktop, it says:

Checking file system on E:
The type of the file system is NTFS.
Volume label is NTFS_DATA

One of your disks needs to be checked for consistency. You 
may cancel the disk check, but it is strongly recommended 
that you continue. To skip disk checking, press any key...

I continue and finish the recommended disk checking. After getting into Windows, I run CHKDSK.exe to check the disks again and get no error report. (By the way, I found some files now having zero bytes in file size as a result of the disk checking during the Windows loading phase.)

I open Windows' Disk Management. It can correctly recognize the full capacity of the hard drive as 2794.52GB. It can also recognize all of the partitions except the last one (because the last one is ext4).

However, I run gdisk64.exe (the Windows 64-bit version of GPT fdisk), and it signals a warning:

c:\gdisk>gdisk64 -l 0:
GPT fdisk (gdisk) version 1.0.4

The protective MBR's 0xEE partition is oversized! Auto-repairing.

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Warning! Secondary partition table overlaps the last partition by
4294966385 blocks!
You will need to delete this partition or resize it in another utility.
Disk 0:: 1565565872 sectors, 746.5 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1565565838
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00  EFI system partition
   2          206848      1925441535   918.0 GiB   0700  
   3      1925441536      1953521663   13.4 GiB    0700  
   4      1953523712      5650817023   1.7 TiB     0700  
   5      5650817024      5860532223   100.0 GiB   8300  

I shut down the PC and boot it into Windows 7 again. It does not ask for the same disk check as mentioned above during loading Windows. After getting into Windows, I open Windows' Disk Management, it can still correctly recognize the full capacity of the hard drive and the partitions. Nevertheless, gdisk64.exe still reports the same warning for the secondary partition table overlapping the last partition by 4,294,966,385 blocks, and the last usable sector is 1,565,565,838, which precedes the end sector of the last partition (5,860,532,223) far too early.

(3. Ubuntu Phase)
Reboot. In Ubuntu 18.04.2, I open gdisk and fdisk in the Terminal. They confirm that the same problem is there:

$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Warning! Secondary partition table overlaps the last partition by
4294966385 blocks!
Try reducing the partition table size by 17179865540 entries.
(Use the 's' item on the experts' menu.)
Disk /dev/sda: 5860533168 sectors, 2.7 TiB
Model: TOSHIBA DT01ACA3
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1565565838
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00  EFI system partition
   2          206848      1925441535   918.0 GiB   0700  
   3      1925441536      1953521663   13.4 GiB    0700  
   4      1953523712      5650817023   1.7 TiB     0700  
   5      5650817024      5860532223   100.0 GiB   8300  


$ sudo fdisk -l /dev/sda
Disk /dev/sda: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Device          Start        End    Sectors  Size Type
/dev/sda1        2048     206847     204800  100M EFI System
/dev/sda2      206848 1925441535 1925234688  918G Microsoft basic data
/dev/sda3  1925441536 1953521663   28080128 13.4G Microsoft basic data
/dev/sda4  1953523712 5650817023 3697293312  1.7T Microsoft basic data
/dev/sda5  5650817024 5860532223  209715200  100G Linux filesystem

I open gparted, and it pops up a warning message:

Not all of the space available to /dev/sda appears to be 
used, you can fix the GPT to use all of the space (an extra 
4294967296 blocks) or continue with the current setting?
[Fix] [Ignore]

I choose to let gparted fix the GPT. I then run gdisk again, and it gives no warning. The error was fixed, and the last usable sector is 5,860,533,134:

$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 5860533168 sectors, 2.7 TiB
Model: TOSHIBA DT01ACA3
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4973 sectors (2.4 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00  EFI system partition
   2          206848      1925441535   918.0 GiB   0700  
   3      1925441536      1953521663   13.4 GiB    0700  
   4      1953523712      5650817023   1.7 TiB     0700  
   5      5650817024      5860532223   100.0 GiB   8300

I reboot the PC and boot into Ubuntu again. gdisk and gparted do not detect any GPT error.

(4. Windows Phase)
I then try to boot to Windows 7. What happened in the above-mentioned Windows Phase happens again. During starting Windows, it does a "Checking file system on E:" and requests for a disk check for consistency. After that, both chkdsk and Disk Management show normal results without any warning, but gdisk64 still and again reports the same warning for the secondary partition table overlapping the last partition by 4,294,966,385 blocks. The last usable sector gets back to be 1,565,565,838 and precedes the last sector of the disk (5,860,533,168) far too early, though it was fixed and set to be 5,860,533,134 by gparted in the last reboot (Ubuntu Phase).

I think the fundamental problem here seemingly lies in Windows 7 setting up a secondary/backup GPT in a halfway point of the hard drive rather than letting the backup stay after the last partition. As I know, the "last usable sector" is where the secondary/backup GPT starts. The hard drive has 5,860,533,168 sectors in total. The last usable sector is 5,860,533,134 after gparted's fix but becomes back 1,565,565,838 after the process of loading Windows 7. The fact that my Windows 7 (SP1, 64-bit) can recognize the full capacity of the hard drive in the Disk Management does not help itself avoid resetting the backup GPT in a wrong place. I know how to reset the secondary GPT to where it should be, but I do not know how to prevent my Windows 7 from misplacing it during the loading OS phase.

Below are my questions: The misplacement of the secondary GPT causes that some of my files have zero bytes in file size now. Is there a way to restore these files, since the contents of these files are still there?

Is there a way to prevent Windows 7 from wrongly reset the secondary GPT during the process of loading Windows?

Please help.

  • I’d recommend you restart from scratch, without a protective MBR. Just plain GPT. – Daniel B May 29 at 10:19
1

5860533168 (Ubuntu sees it) is the real number of logical sectors. This needs 33 bits and if you try to store it in 32 bits then the most significant bit will be lost and the number will become 1565565872 (Windows uses it).

It looks like your Windows (or some parts of it) uses 32 bits where it should use more. Windows and Ubuntu struggle over where the secondary partition table should be placed. Ubuntu is right.

According to Microsoft [emphasis mine]:

Microsoft has investigated how Windows supports these large disks. The results reveal several issues that apply to all versions of Windows earlier than and including Windows 7 with Service Pack 1 and Windows Server 2008 R2 with Service Pack 1.

To this point, the following incorrect behavior is known to occur when Windows handles single-disk storage capacity of greater than 2 TB:

  • The numeric capacity beyond 2 TB overflows. This results in the system being able to address only the capacity beyond 2 TB. For example, on a 3 TB disk, the available capacity may be only 1 TB.
  • The numeric capacity beyond 2 TB is truncated. This results in no more than 2 TB of addressable space. For example, on a 3 TB disk, the available capacity may be only 2 TB.
  • The storage device is not detected correctly. In this case, it is not displayed in either the Device Manager or Disk Management windows.

I guess you got into this situation by cloning a disk that was small enough to not cause issues in Windows 7 SP1. Probably 1 GB (judging by the placement of the HP Factory Recovery partition which was at the end of the old disk).

The filesystem on the current Windows system partition was corrupted. It may be possible to repair its structures but you cannot be sure the corruption didn't affect important files. Even if it works now, corrupt files may cause problems in the future.

Warning: the following procedures may not be the best solution. I have never experienced your problem, so I have never tried to recover from it. This is just what I would try. You may want to wait for other answers (or comments) to appear.

If you still have the old disk with old data and if you are willing to drop whatever changes you did to the cloned copy of Windows, then you may proceed as follows:

  1. Disconnect the new disk (to avoid UUID conflicts), connect the old one.
  2. Boot the old Windows.
  3. Install updates, so your Windows is ready to fully support 3 TB disk. (Although this article mentions "incorrectly configured system settings, irregular entries in Registry, or Intel® Rapid Storage Technology" may also interfere).
  4. Clone again. I would clone only the old Windows partition to the already existing partition on the large disk; Ubuntu would stay intact; GRUB or/and EFI boot entry on the large disk may need to be updated to boot Windows properly.

If you cannot get back to your old Windows, you may try this:

  1. If possible, do not let Windows write the secondary partition table.
  2. Run chkdsk on the filesystem holding Windows (usually C:\). I'm not sure how safe this is. Note there's a part of your Windows partition that lies beyond what Windows thinks is the last sector, so the tool may or may not work properly. Connecting the disk to another (fully updated) Windows and running chkdsk there may be safer (but if you want to use a USB enclosure for this purpose, please mind some enclosures may cause trouble).
  3. Install updates, so your Windows is ready to fully support 3 TB disk.
  • I believe the quoted statement refers mostly to third-party storage drivers. I’d be very surprised if Windows 7 SP1 itself had such a limitation with standard AHCI drivers. – Daniel B May 29 at 16:29
  • Thank you, @kamil . In the 1st point of your last "if" paragraph, you mentioned "1. If possible, do not let Windows write the secondary partition table." This is exactly one of my main questions. Windows writes the table by itself, without asking for a user's permission, a little while after the computer starts loading Windows. Is there a way to cancel or avoid the writing? Would you please give me more details about how to achieve that? Thanks. – gto4168 May 31 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.