All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: GParted Can't have a partition outside the disk!
PostPosted: July 20th, 2019, 17:08 
Offline

Joined: July 20th, 2019, 16:52
Posts: 7
Location: USA Hamilton Ohio
Hi there I have a Seagate 3Tb drive that had its partition table corrupted when the power supply in my computer had a catastrophic failure I used testdisk to wite the partition back to the drive but GParted gives me the error "Can't have a partition outside the disk!" the drive has 3906764800 Sectors and the end sector is beyond the total sectors on the drive it shows the end sector at 3907028991. How can I fix this?

this is what I got with fdisk

Quote:
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 1.8 TiB, 2000397852160 bytes, 3907027055 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: 66BA915F-B6D3-D04D-9E73-1ED82840EE3B

Device Start End Sectors Size Type
/dev/sdb1 264192 3907028991 3906764800 1.8T Microsoft basic data
Scorp@i7:~


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 20th, 2019, 17:31 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 11620
Location: Australia
I suspect that your BIOS may have stolen approximately 2000 sectors at the end of the drive for its own backup. This typically happens with GigaByte Express Recovery BIOS.

You can remove the HPA (Host Protected Area) with a tool such as HDAT2. Alternatively, you could use SeaTools to restore the drive's full native capacity.

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 20th, 2019, 17:35 
Offline

Joined: July 20th, 2019, 16:52
Posts: 7
Location: USA Hamilton Ohio
fzabkar wrote:
I suspect that your BIOS may have stolen approximately 2000 sectors at the end of the drive for its own backup. This typically happens with GigaByte Express Recovery BIOS.

You can remove the HPA (Host Protected Area) with a tool such as HDAT2. Alternatively, you could use SeaTools to restore the drive's full native capacity.


Will that preserve my data or is it destructive?


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 20th, 2019, 17:38 
Offline

Joined: July 20th, 2019, 16:52
Posts: 7
Location: USA Hamilton Ohio
Will that preserve my data or is it destructive and I'm using Linux if that makes it any different.


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 20th, 2019, 18:17 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 11620
Location: Australia
Removing the HPA is not data destructive. However, if this area has been overwritten by BIOS, then there may be some insidious damage. You could use dd to capture sectors 3907027054 - 3907029167 to a file and then examine the file with a hex editor.

BTW, is your drive a 3TB or 2TB model (your sector counts imply 2TB)?

If 3TB, then ...

GigaByte BIOS bug results in loss of 1TB capacity:
http://www.hddoracle.com/viewtopic.php?f=59&t=150

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 20th, 2019, 19:39 
Offline

Joined: July 20th, 2019, 16:52
Posts: 7
Location: USA Hamilton Ohio
Quote:
BTW, is your drive a 3TB or 2TB model (your sector counts imply 2TB)?


LOL both actually the original problem happened with the 3TB drive so when I got the power supply repaired I figured I would take the opportunity to switch from Linux Mint to MX Linux so I unplugged all the drives to make sure I didn't trash the wrong drive and I installed the new OS onto a 500GB WD drive. When I plugged all the drives back in Linux didn't recognize the 2TB drive and I'm like well damn, so I ran testdisk and wrote the partition table back to the drive rebooted and ran GParted and got the partition outside the disk error so now I have 2 drives and now I understand why because this is a GigaByte Express Recovery BIOS. So is it this 129MiB unallocated section at the front of the drive is that what BIOS grabbed?

BTW thanks for your help your bang on with the BIOS.


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 20th, 2019, 20:52 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 11620
Location: Australia
BIOS grabs the tail end of the drive and truncates the capacity by means of a HPA. However, I don't know whether the backup is written to the 2TB boundary or the 3TB boundary in the case of the bug.

The 129MiB section sounds like it may have originally been allocated to a Microsoft reserved partition.

How does DMDE see the partitions?

https://dmde.com/download.html

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 23rd, 2019, 23:22 
Offline

Joined: July 20th, 2019, 16:52
Posts: 7
Location: USA Hamilton Ohio
Thank you fzabkar for your generous help, HDAT2 solved the problem. I had to commit sacrilege and install windows 7 on a computer so I could make a bootable FreeDOS thumb drive. It fixed the problem perfectly however when I place the disk back in the computer with the Express Recovery BIOS it writes the HPA back to the drive wrecking it again. So I think to solve this problem I will have to fix the drives in the computer they come from and it should be fine as long as I don't change their physical location in the computer. I built this computer in 2007 so for some reason it will not boot a USB drive with FreeDOS, it will boot Linux just fine but HDAT2 will not run under Linux so I think I will try and make a Windows 7 ISO and boot it to run HDAT2 and that should work. If you have any suggestions, Im, all ears if not thanks for your help, you got me on the right path to solve this problem thanks again.


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 25th, 2019, 17:50 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 11620
Location: Australia
The only suggestion I have for resolving the truncation bug is to find a BIOS update, or check whether Express Recovery can be disabled.

As for booting a USB drive, you can either format your USB drive as a "Super Floppy" or a removable HDD. In the first case sector 0 contains a boot sector whereas in the second case sector 0 contains an MBR partition table. It may be that your BIOS prefers one particular format.

BTW, I would have thought that you could write a FreeDOS image to your USB drive using dd in Linux.

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 26th, 2019, 14:10 
Offline

Joined: July 20th, 2019, 16:52
Posts: 7
Location: USA Hamilton Ohio
fzabkar wrote:
BTW, I would have thought that you could write a FreeDOS image to your USB drive using dd in Linux.


Im still pretty green with Linux so when I was trying in to write the FreeDOS I tried MX Live USB maker and UNetbootin so I still have alot to learn.

Quote:
The only suggestion I have for resolving the truncation bug is to find a BIOS update, or check whether Express Recovery can be disabled.

I did check to see if they have a BIOS update that allows me to disable Express Recovery but had no joy.

Quote:
As for booting a USB drive, you can either format your USB drive as a "Super Floppy" or a removable HDD. In the first case sector 0 contains a boot sector whereas in the second case sector 0 contains an MBR partition table. It may be that your BIOS prefers one particular format.


I will check out the boot scheme for the FreeDOS and see how it is setup. I take it that I can do with GParted time to learn a bit more thanks for your help.


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: July 28th, 2019, 0:04 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 11620
Location: Australia
You could use hdparm to remove the HPA under Linux:
https://linux.die.net/man/8/hdparm

    hdparm -N3907029168 /dev/ice

Quote:
-N (uppercase)

Get/set max visible number of sectors, also known as the Host Protected Area setting. Without a parameter, -N displays the current setting, which is reported as two values: the first gives the current max sectors setting, and the second shows the native (real) hardware limit for the disk. The difference between these two values indicates how many sectors of the disk are currently hidden from the operating system, in the form of a Host Protected Area (HPA)….To change the current max (VERY DANGEROUS, DATA LOSS IS EXTREMELY LIKELY), a new value should be provided (in base10) immediately following the -N flag. This value is specified as a count of sectors, rather than the "max sector address" of the drive.

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: August 16th, 2019, 23:41 
Offline

Joined: August 16th, 2019, 19:21
Posts: 2
Location: Argentina
fzabkar wrote:
You could use hdparm to remove the HPA under Linux:
https://linux.die.net/man/8/hdparm

    hdparm -N3907029168 /dev/ice

Quote:
-N (uppercase)

Get/set max visible number of sectors, also known as the Host Protected Area setting. Without a parameter, -N displays the current setting, which is reported as two values: the first gives the current max sectors setting, and the second shows the native (real) hardware limit for the disk. The difference between these two values indicates how many sectors of the disk are currently hidden from the operating system, in the form of a Host Protected Area (HPA)….To change the current max (VERY DANGEROUS, DATA LOSS IS EXTREMELY LIKELY), a new value should be provided (in base10) immediately following the -N flag. This value is specified as a count of sectors, rather than the "max sector address" of the drive.

You know why i get "PA setting seems invalid (buggy kernel device driver?)" when i try to create a HPA on hpdarm?


Top
 Profile  
 
 Post subject: Re: GParted Can't have a partition outside the disk!
PostPosted: August 20th, 2019, 22:05 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 11620
Location: Australia
What command parameters did you use?

_________________
A backup a day keeps DR away.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group