[LEDE-DEV] [RFC] creating LEDE GPT image using raw GPT partition dump

Alberto Bursi alberto.bursi at outlook.it
Sat Jul 15 14:05:46 PDT 2017



On 07/15/2017 09:28 PM, Torbjorn Jansson wrote:
> On 2017-07-15 16:50, Alberto Bursi wrote:
>>
>> Since I don't know enough C to add GPT to the current binary tool used
>> to make the mbr for the images, I am experimenting with dumping the main
>> GPT partition table (first 2-ish MB) from a drive formatted like the
>> target image, then assemble the image with dd like is done for sdcard or
>> x86 images.
>>
>
> I'm no expert on GPT but doesn't GPT also store some things at the end 
> of the disk too?
>
> The reason i ask is because I'm sure i once ran into problems with 
> that when changing from GPT to MBR using tools that wasn't fully GPT 
> aware and knew how to clear GPT.
> i think i ended up with an MBR partition layout but with GPT leftovers 
> and some tools complained.

Yes, GPT stores a backup partition table at the end of the disk. Since 
it's a backup, the system works fine without if there is a primary 
partition table that works fine.
It can (and should) be re-created easily on first LEDE boot by using 
Gdisk tool and a startup script.

The fact that most MBR tools don't delete the backup table can also be 
seen as a feature, as it allows easy recovery of the partitions in the 
disk if it was handled wrong and the primary table got hosed.

-Alberto


More information about the Lede-dev mailing list