]> git.ipfire.org Git - thirdparty/util-linux.git/commit
fdisk: add GPT support
authorDavidlohr Bueso <dave@gnu.org>
Thu, 27 Sep 2012 07:50:27 +0000 (09:50 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 27 Sep 2012 11:38:14 +0000 (13:38 +0200)
commit766d5156c43b784700d28d1c1141008b2bf35ed7
tree18fb6ef0dde41c5152369a973c71bb4349e0b659
parent2b1a43cf170292a7360a90428f798cdb38e1cc1a
fdisk: add GPT support

This patch allows fdisk to handle GUID partition tables, based on the latest UEFI specifications
version 2.3.1, from June 27th, 2012. The following operations are supported:

  - Probing (detects both protective and hybrid MBRs)
  - Writing to disk
  - Listing used partitions
  - Adding partitions
  - Deleting partitions
  - Data integrity verifications (for both headers and partitions).

A few considerations:
  - Currently we do not fix invalid primary headers -- we just abort!
  - Header checksums are updated upon every change (ie: add/delete partitions), this allows us
    to mathematically verify the changes on-the-fly, and not only when writing to disk, like
    most other related tools do.
  - We are extremly picky when writing to disk, any error aborts the opeartion.
  - When creating a new partition, the following GUIDs are available:
     http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs

For test cases, the gpt.img from libblkid tests, scsi_debug and my own hard drive (/dev/sda) were used.
For the image, all operations were tested successfully, and for /dev/sda all except write, which
was not tested - hey, I'm not suicidal!

[kzak@redhat.com: - add get/set partition type functions
                  - use unified on strings based table for partition types
                  - add partition type to table list function]

Tested-and-reviewed-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/Makemodule.am
fdisks/cfdisk.c
fdisks/fdisk.c
fdisks/fdisk.h
fdisks/gpt.c
fdisks/gpt.h
fdisks/sfdisk.c
fdisks/utils.c