# GPT:Primary header thinks Alt. header is not at the end of the disk

**URL:** https://hub.mender.io/t/gpt-primary-header-thinks-alt-header-is-not-at-the-end-of-the-disk/2094
**Category:** General Discussions
**Tags:** yocto, partitioning, warrior, boot, uefi
**Created:** [June 23, 2020, 9:41am UTC](https://hub.mender.io/t/gpt-primary-header-thinks-alt-header-is-not-at-the-end-of-the-disk/2094 "2020-06-23T09:41:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![deffo](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@deffo](https://hub.mender.io/u/deffo)
#### Post date: [June 23, 2020, 9:41am UTC](https://hub.mender.io/t/gpt-primary-header-thinks-alt-header-is-not-at-the-end-of-the-disk/2094/1 "2020-06-23T09:41:42Z")

</div>

We’re getting GPT errors during boot process, what is wrong here?

Error is:

```
machine:/home/user# dmesg | grep -i gpt
Command line: BOOT_IMAGE=(hd0,gpt2)/boot/bzImage root=/dev/mmcblk0p2 rootwait
Kernel command line: BOOT_IMAGE=(hd0,gpt2)/boot/bzImage root=/dev/mmcblk0p2 rootwait
GPT:Primary header thinks Alt. header is not at the end of the disk.
GPT:61046783 != 61071359
GPT:Alternate GPT header not at the end of the disk.
GPT:61046783 != 61071359
GPT: Use GNU Parted to correct GPT errors.

```

Disk is:

```
Disk /dev/mmcblk0: 29 GB, 31268536320 bytes, 61071360 sectors
3786 cylinders, 256 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk0p1 0,0,2 1023,255,63 1 61046783 61046783 29.1G ee EFI GPT

```

Variables are:

```
MENDER_STORAGE_TOTAL_SIZE_MB_DEFAULT = "29820"
MENDER_STORAGE_DEVICE = "/dev/mmcblk0"
MENDER_STORAGE_TOTAL_SIZE_MB = "29820"
MENDER_BOOT_PART_SIZE_MB = "128"
MENDER_DATA_PART_SIZE_MB = "1024"
```

---

<div class="post-metadata">

### Author: ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)
#### Post date: [June 23, 2020, 2:32pm UTC](https://hub.mender.io/t/gpt-primary-header-thinks-alt-header-is-not-at-the-end-of-the-disk/2094/2 "2020-06-23T14:32:43Z")

</div>

try using sgdisk -e   
this should fix the GPT disk image before you image it to your target disk

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [June 24, 2020, 7:39am UTC](https://hub.mender.io/t/gpt-primary-header-thinks-alt-header-is-not-at-the-end-of-the-disk/2094/3 "2020-06-24T07:39:53Z")

</div>

> try using sgdisk -e  
> this should fix the GPT disk image before you image it to your target disk

This is only true if the “offline” image is the exact same size as the storage medium size.

GPT alternative headers are relative to the storage medium size, e.g they are at block position -1.

So you need to run `sgdisk -e` or `echo 'w' | fdisk /dev/mmcblk0` or similar on your device **once** to make sure the alternative GPT headers are written to the correct location.
