Hello Guest, if you are reading this it means you have not registered yet. Please take a second, Click here to register, and in a few simple steps you will be able to enjoy our community and use our OpenViX support section.
Results 1 to 12 of 12

Thread: The backup GPT table is corrupt

  1. #1

    Title
    Senior Member
    Join Date
    Nov 2017
    Posts
    201
    Thanks
    35
    Thanked 25 Times in 23 Posts

    The backup GPT table is corrupt

    I get this error when running parted on the internal drive:

    Code:
    ~# parted /dev/mmcblk0
    GNU Parted 3.4
    Using /dev/mmcblk0
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) print                                                            
    Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used.
    OK/Cancel?
    I checked and gdisk/sgdisk is not installed. What is recommended way to rebuild the backup GPT from the primary table?
    Kind regards,

    Mick

  2. #2
    ccs's Avatar
    Title
    ViX Beta Tester
    Join Date
    Sep 2014
    Posts
    5,836
    Thanks
    554
    Thanked 1,276 Times in 1,089 Posts
    Is /dev/mmcblk0 the internal drive?
    Last edited by ccs; 15-02-22 at 14:25.

  3. #3

    Title
    Senior Member
    Join Date
    Nov 2017
    Posts
    201
    Thanks
    35
    Thanked 25 Times in 23 Posts
    Quote Originally Posted by ccs View Post
    Is /dev/mmcblk0 the internal drive?
    Yes, it is:
    Code:
    ~# parted /dev/mmcblk0
    GNU Parted 3.4
    Using /dev/mmcblk0
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) print                                                            
    Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used.
    OK/Cancel? OK                                                             
    Model: MMC 4FPD3R (sd/mmc)
    Disk /dev/mmcblk0: 3909MB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags: 
    
    Number  Start   End     Size    File system     Name     Flags
     1      1049kB  4194kB  3146kB                  boot     msftdata
     2      4194kB  12.6MB  8389kB                  kernel1
     3      12.6MB  851MB   839MB   ext4            rootfs1
     4      851MB   860MB   8389kB                  kernel2
     5      860MB   1699MB  839MB   ext4            rootfs2
     6      1699MB  1707MB  8389kB                  kernel3
     7      1707MB  2546MB  839MB   ext4            rootfs3
     8      2546MB  2554MB  8389kB                  kernel4
     9      2554MB  3393MB  839MB                   rootfs4
    10      3393MB  3908MB  515MB   linux-swap(v1)  swap     swap
    EDIT: By "internal drive" I mean it is the SD card on which the OS is installed.
    Last edited by Mickkie; 15-02-22 at 15:56.
    Kind regards,

    Mick

  4. #4
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,578
    Thanks
    2,004
    Thanked 4,925 Times in 3,259 Posts
    So you are running the image from an SD card? What machine is this?
    Help keep OpenViX servers online.Please donate!

  5. #5

    Title
    Senior Member
    Join Date
    Nov 2017
    Posts
    201
    Thanks
    35
    Thanked 25 Times in 23 Posts
    Quote Originally Posted by Huevos View Post
    So you are running the image from an SD card? What machine is this?
    The machine is a Mut@nt HD51. The OS is running off an MMC card using the SD controller. That's how I bought it, I haven't changed anything.
    Kind regards,

    Mick

  6. #6

    Title
    Senior Member
    Join Date
    Nov 2017
    Posts
    201
    Thanks
    35
    Thanked 25 Times in 23 Posts
    OK, I fixed it. Brief steps in case others come across the same problem.

    1. Check if parted can read the main GPT table. Run it on the device:
    Code:
    ~# parted /dev/mmcblk0
    GNU Parted 3.4
    Using /dev/mmcblk0
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) print                                                            
    Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used.
    OK/Cancel? OK                                                             
    Model: MMC 4FPD3R (sd/mmc)
    Disk /dev/mmcblk0: 3909MB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags: 
    
    Number  Start   End     Size    File system     Name     Flags
     1      1049kB  4194kB  3146kB                  boot     msftdata
     2      4194kB  12.6MB  8389kB                  kernel1
     3      12.6MB  851MB   839MB   ext4            rootfs1
     4      851MB   860MB   8389kB                  kernel2
     5      860MB   1699MB  839MB   ext4            rootfs2
     6      1699MB  1707MB  8389kB                  kernel3
     7      1707MB  2546MB  839MB   ext4            rootfs3
     8      2546MB  2554MB  8389kB                  kernel4
     9      2554MB  3393MB  839MB                   rootfs4
    10      3393MB  3908MB  515MB   linux-swap(v1)  swap     swap
    The above output shows the primary table is sound, since I can see all the partitions, but the backup table is not OK.

    2. Install the package "gptfdisk" and run it:
    Code:
    ~# gdisk /dev/mmcblk0
    GPT fdisk (gdisk) version 1.0.8
    
    Caution: invalid backup GPT header, but valid main header; regenerating
    backup header from main header.
    
    Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
    on the recovery & transformation menu to examine the two tables.
    
    Warning! One or more CRCs don't match. You should repair the disk!
    Main header: OK
    Backup header: ERROR
    Main partition table: OK
    Backup partition table: ERROR
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: damaged
    
    ****************************************************************************
    Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
    verification and recovery are STRONGLY recommended.
    ****************************************************************************
    
    Command (? for help): p
    Disk /dev/mmcblk0: 7634944 sectors, 3.6 GiB
    Sector size (logical/physical): 512/512 bytes
    Disk identifier (GUID): F291D54B-F806-44C3-9011-91F4FB4D63D6
    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 7634910
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 4029 sectors (2.0 MiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048            8191   3.0 MiB     0700  boot
       2            8192           24575   8.0 MiB     8300  kernel1
       3           24576         1662975   800.0 MiB   8300  rootfs1
       4         1662976         1679359   8.0 MiB     8300  kernel2
       5         1679360         3317759   800.0 MiB   8300  rootfs2
       6         3317760         3334143   8.0 MiB     8300  kernel3
       7         3334144         4972543   800.0 MiB   8300  rootfs3
       8         4972544         4988927   8.0 MiB     8300  kernel4
       9         4988928         6627327   800.0 MiB   8300  rootfs4
      10         6627328         7632895   491.0 MiB   8200  swap
    3. Quit with 'q' without making any changes and create a dump of the GPT tables to be able to restore from it if something goes wrong.
    Code:
    :~# sgdisk -b /media/usb/backup/mmcblk0.gpt /dev/mmcblk0
    The operation has completed successfully.
    If you need to restore the original GPT table, replace '-b' with '-l' in the above command syntax.

    4. Run gdisk once more and press 'r' to enter the Recovery and Transformation menu. Then check if the backup table can be read and how it differs with the primary table, by pressing 'c' and then 'p' to view it. In my case the loaded backup table was empty, which explains why parted and gdisk outputs complained.

    5. I pressed 'd' to use the primary GPT header and then 'e' to rebuild the backup with the data in the primary table. 'v' will verify the currently loaded table is in good order. 'w' to write the backup table at the end of the disk and 'q' to quit. Careful to get these steps in the correct order, in case the corruption is on the primary table rather than the backup. You do not want to overwrite healthy data.

    A reboot showed all was fine and 'v' verified the status of the GPT table:
    Code:
    ~# gdisk /dev/mmcblk0
    GPT fdisk (gdisk) version 1.0.8
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    
    Command (? for help): p
    Disk /dev/mmcblk0: 7634944 sectors, 3.6 GiB
    Sector size (logical/physical): 512/512 bytes
    Disk identifier (GUID): F291D54B-F806-44C3-9011-91F4FB4D63D6
    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 7634910
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 4029 sectors (2.0 MiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048            8191   3.0 MiB     0700  boot
       2            8192           24575   8.0 MiB     8300  kernel1
       3           24576         1662975   800.0 MiB   8300  rootfs1
       4         1662976         1679359   8.0 MiB     8300  kernel2
       5         1679360         3317759   800.0 MiB   8300  rootfs2
       6         3317760         3334143   8.0 MiB     8300  kernel3
       7         3334144         4972543   800.0 MiB   8300  rootfs3
       8         4972544         4988927   8.0 MiB     8300  kernel4
       9         4988928         6627327   800.0 MiB   8300  rootfs4
      10         6627328         7632895   491.0 MiB   8200  swap
    
    Command (? for help): v
    
    No problems found. 4029 free sectors (2.0 MiB) available in 2
    segments, the largest of which is 2015 (1007.5 KiB) in size.
    Kind regards,

    Mick

  7. #7
    twol's Avatar
    Title
    Moderator
    Join Date
    Apr 2012
    Posts
    8,383
    Thanks
    987
    Thanked 2,888 Times in 2,243 Posts
    The HD51 doesn‘t have an sd card slot, so you are running off the eMMC - and in reality you didn‘t have an issue, Messing around with the eMMc is not a good idea due to the way they are formatted when flashed,.
    Gigablue Quad 4K & UE 4K
    .........FBC Tuners:
    ------------------> DUR-Line DCR 5-1-8-L4 Multiswitch to 1.5M dish(28.2E)
    ------------------> Spaun SUS 5581/33 NFA Multiswitch to 80 cm dish(19.2E)
    .......................> FBC & DVB-S2X into 90cm dish (27.5W) Opticum robust Unicable LNB
    AX HD61, Edision Osmio 4K+, Zgemma H9Combo, Octagon SF8008 , gbtrio4k, h9se using Legacy ports on multiswitches
    Zgemma H9 C/S into Giga4K

  8. #8
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,769
    Thanks
    235
    Thanked 1,656 Times in 1,305 Posts
    Quote Originally Posted by twol View Post
    The HD51 doesn‘t have an sd card slot, so you are running off the eMMC - and in reality you didn‘t have an issue, Messing around with the eMMc is not a good idea due to the way they are formatted when flashed,.
    Not doubting you, but I'd expect an eMMC to show up as an mtd* device.
    An mmcblk* is a MultiMedia Card (i.e. an SD card).
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  9. #9
    twol's Avatar
    Title
    Moderator
    Join Date
    Apr 2012
    Posts
    8,383
    Thanks
    987
    Thanked 2,888 Times in 2,243 Posts
    Quote Originally Posted by birdman View Post
    Not doubting you, but I'd expect an eMMC to show up as an mtd* device.
    An mmcblk* is a MultiMedia Card (i.e. an SD card).
    All the eMMC receivers ( mostly multiboot ) use mmcblk for their partitions, which is why there is additional code in HarddiskManger to handle the sf8008 ( and some zgemma boxes) which do have an sdcard which also uses mmcblk … just to make life interesting
    Gigablue Quad 4K & UE 4K
    .........FBC Tuners:
    ------------------> DUR-Line DCR 5-1-8-L4 Multiswitch to 1.5M dish(28.2E)
    ------------------> Spaun SUS 5581/33 NFA Multiswitch to 80 cm dish(19.2E)
    .......................> FBC & DVB-S2X into 90cm dish (27.5W) Opticum robust Unicable LNB
    AX HD61, Edision Osmio 4K+, Zgemma H9Combo, Octagon SF8008 , gbtrio4k, h9se using Legacy ports on multiswitches
    Zgemma H9 C/S into Giga4K

  10. The Following User Says Thank You to twol For This Useful Post:

    birdman (16-02-22)

  11. #10
    Joe_90's Avatar
    Title
    Moderator
    Join Date
    Mar 2014
    Location
    Wicklow, Ireland
    Posts
    4,100
    Thanks
    1,265
    Thanked 1,115 Times in 879 Posts
    Quote Originally Posted by birdman View Post
    Not doubting you, but I'd expect an eMMC to show up as an mtd* device.
    An mmcblk* is a MultiMedia Card (i.e. an SD card).
    My mutant and AX61Hd both show mmcblock* on their internal soldered eMMC flash 4GB storage. Similar setup on the removable MMC storage on my Odroid N2+.

    @Mickkie - I would echo what @twol says as regards playing around with various partitioning and fsck utilities on the eMMC storage. I don't think they all understand the internal partitioning schema and sometimes report errors where there are none which affect normal usage. I do recall seeing parted reporting GPT errors on my mutant HD51 and tried various utilities to clear the problem, but without success. It never affected the normal running of the box and I regularly installed four sets of images from OpenVix, ATV etc., and swapped them around the different partitions without problems.
    GB Quad Plus, Mut@nt HD51, AX HD61, 80cm dish and Supreme Dark motor. Sony STR-DN 1060, Sony UHP-H1 Bluray, Odroid N2+ (CoreElec), Monitor Audio Bronze 5.1 speakers

  12. #11

    Title
    Senior Member
    Join Date
    Nov 2017
    Posts
    201
    Thanks
    35
    Thanked 25 Times in 23 Posts
    Thank you all, I didn't recall seeing a SD slot when I had opened the box some years ago now to add a HDD, so I had assumed it was soldered on the board. I saw dmesg mentioning mmc - as twol advised it is an eMMC. This is what dmesg shows:
    Code:
    [    1.507261] sdhci: Secure Digital Host Controller Interface driver
    [    1.513459] sdhci: Copyright(c) Pierre Ossman
    [    1.517829] sdhci-pltfm: SDHCI platform and OF driver helper
    [    1.557588] mmc0: SDHCI controller on f03e0200.sdhci [f03e0200.sdhci] using ADMA
    snip ...
    
    [    1.700025] mmc0: new high speed MMC card at address 0001
    [    1.705854] mmcblk0: mmc0:0001 4FPD3R 3.64 GiB 
    [    1.710538] mmcblk0boot0: mmc0:0001 4FPD3R partition 1 4.00 MiB
    [    1.716648] mmcblk0boot1: mmc0:0001 4FPD3R partition 2 4.00 MiB
    [    1.722700] mmcblk0rpmb: mmc0:0001 4FPD3R partition 3 512 KiB
    [    1.731514]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10
    [    1.743526] EXT4-fs (mmcblk0p5): warning: mounting unchecked fs, running e2fsck is recommended
    [    1.753635] EXT4-fs (mmcblk0p5): mounted filesystem with ordered data mode. Opts: (null)
    I didn't know I wasn't meant to interfere with the partition tables on an eMMC. I've rebooted the box since and it seems to be OK so far - so thankfully partitions mmcblk0p1, mmcblk0p4 and mmcblk0p5 were not affected. Phew! I'll see what I get when I update to a later image soon on a different slot.
    Kind regards,

    Mick

  13. #12

    Title
    Senior Member
    Join Date
    Nov 2017
    Posts
    201
    Thanks
    35
    Thanked 25 Times in 23 Posts
    Quote Originally Posted by Mickkie View Post
    I didn't know I wasn't meant to interfere with the partition tables on an eMMC. I've rebooted the box since and it seems to be OK so far - so thankfully partitions mmcblk0p1, mmcblk0p4 and mmcblk0p5 were not affected. Phew! I'll see what I get when I update to a later image soon on a different slot.
    I had some time to look into this issue again today. I had originally started checking the partitions and filesystem because following some historical crashes I noticed dmesg reporting mmcblk0p5 needing fsck. Interestingly partition 5 was able to boot without any observable problems, either with the same or with a new image installed on it, but the warnings in dmesg continued.

    Then I ran parted, which reported "the backup GPT table is corrupt" as per #1 post above and this led me to restoring the backup table from the primary table as per #6 above. Having done this I came across a problem with partition 9 - filesystem headers missing or something like that, I can't recall exactly. I don't know if restoring the backup table on the drive caused some area on partition 9 to be overwritten, or if this was a long standing problem. I hadn't ever installed an image on slot 4 to notice anything wrong with this partition. Anyhow, I booted with the image on slot 1 and reformatted partition 9 as ext4, ran fsck on partition 5 which found and corrected some errors and finally rebooted with the image on slot 3. Since then I have installed new images on slots 2, 3 and 4. All boot and run without any problems. No more errors in dmesg.

    This story had a happy ending, but given the warnings by contributors to this thread I wouldn't recommend my solution to others.
    Kind regards,

    Mick

  14. The Following User Says Thank You to Mickkie For This Useful Post:

    twol (17-03-22)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.