I found it. It blows my mind. Let me just cry out here. (define (partition->dos-type partition) ;; Return the MBR partition type corresponding to the given PARTITION. ;; See: https://en.wikipedia.org/wiki/Partition_type. (let ((flags (partition-flags partition))) (cond ((member 'esp flags) "0xEF") (else "0x83")))) (define (partition->gpt-type partition) ;; Return the genimage GPT partition type code corresponding to PARTITION. ;; See https://github.com/pengutronix/genimage/blob/master/README.rst (let ((flags (partition-flags partition))) (cond ((member 'esp flags) "U") (else "L"))))