[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Suggest a tool for decoding binary data



On 02/02/14 12:36, Kevin O'Gorman wrote:
> I've been working on homegrown backups for a while.  I like using
> standard UNIX tools because the backups are usable on any *NIX system.
> I'm about to tackle GPT partitioned disks, and want to decode the
> label.
> 
> I need it because i like to take dd-style dumps of the partition info,
> including the stuff at the end of the disk.  Since the label contains
> info about variable areas (the two partition lists) I need to decode
> these.
> 
> The data is little-endian, but I want my code to work on little- or
> big-endian machines.  I want it to be a script -- nothing compiled.
> 
> I've figured out that on my little-endian machines, I can use bash
> with something like
>     otherlabel=$(($(dd if=label bs=1 skip=32 count=8 | od -An -t d8) ))
> and I get the right answer, but only because the endianness of the
> data and of my machine are the same.  I want something that will also
> work on a big-endian machine, and I want it to be reasonably simple.
> 
> Any ideas?
> 


Maybe you could just grab the secondary GPT header and table?
16 KiB before the last logical sector of the disk and last 512 bytes

I'm not sure why you need to "decode" the data.

gfdisk will allow you to grab the "labels", but I don't know if you can
run it from a script (xdotool?).


Kind regards


Reply to: