Subject: parted 2.3 assigns wrong GUIDs to GPT partitions
From: "Ulrich Windl" <[email-masked]>
To: <[email-masked]>
Date: Thu, 28 Jan 2016 13:54:04 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

(I discovered this old message being unsent for over a year; maybe it's still relevant; I didn't re-check)
Hi!

When creating GPT partitions, wrong GUIDs are assigned to the partition type:
---
> /usr/sbin/parted /tmp/gpt.img
WARNING: You are not superuser.  Watch out for permissions.
GNU Parted 2.3
Using /tmp/gpt.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /tmp/gpt.img will be destroyed and all data
on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) print
Model:  (file)
Disk /tmp/gpt.img: 1049kB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart ntfs ntfs 0% 25%
Warning: You requested a partition from 0.00B to 262kB.
The closest location we can manage is 17.4kB to 262kB.
Is this still acceptable to you?
Yes/No? y
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i
(parted) mkpart ext2 ext2 25% 50%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i
(parted) mkpart btrfs btrfs 50% 75%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i
(parted) mkpart swap linux-swap 75% 100%
Warning: You requested a partition from 786kB to 1048kB.
The closest location we can manage is 786kB to 1031kB.
Is this still acceptable to you?
Yes/No? y
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i
(parted) p
Model:  (file)
Disk /tmp/gpt.img: 1049kB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size   File system  Name   Flags
 1      17.4kB  262kB   245kB               ntfs
 2      262kB   524kB   262kB               ext2
 3      524kB   786kB   262kB               btrfs
 4      786kB   1032kB  245kB               swap

(parted) version

GNU Parted 2.3

Copyright (C) 1998 - 2006 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

(parted)
---

I use my own program to decode the GPT (irrelevant output removed):
---
Disk /tmp/gpt.img
Protective MBR:
    MBR Signature     =55 aa
    Unique Signature  =         0
    Partition 1:
        Boot Indicator:   non-bootable
        Starting Head     =         0
        Starting Sector   =         1
        Starting Cylinder =         0
        System ID         =      0xee
        Ending Head       =       254
        Ending Sector     =        63
        Ending Cylinder   =      1023
        Relative Sectors  =         1
        Total Sectors     =      2047
    GPT Header at LBA 1:
    EFI Signature               =OK
    Revision                    =1.0 (0x00010000)
    Header Size                 =92
    CRC Checksum                =0x1e722984
    Primary LBA                 =                   1
    Backup LBA                  =                2047
    First Usable LBA            =                  34
    Last Usable LBA             =                2014
    Disk GUID                   =ccc1a21b-2d8d-4be9-9f11-c80916d67687
    Partition Entry LBA         =                   2
    Number of Partition Entries =128
    Size of Partition Entry     =128
    Partition Entry Array CRC32 =0xbfb2cf38
    Partition Entry             =  1
        Partition Type GUID         =ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        Partition Entry GUID        =87ecc1e7-89ba-4f0c-b66e-1664489362f8
        Starting LBA                =                  34
        Ending LBA                  =                 511
    Partition Entry             =  2
        Partition Type GUID         =ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        Partition Entry GUID        =34ccc19e-7d32-474b-9d80-cb8390d14e77
        Starting LBA                =                 512
        Ending LBA                  =                1023
    Partition Entry             =  3
        Partition Type GUID         =ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        Partition Entry GUID        =cd96003d-d358-43e7-9555-845cf20c17a8
        Starting LBA                =                1024
        Ending LBA                  =                1535
    Partition Entry             =  4
        Partition Type GUID         =0657fd6d-a4ab-43c4-84e5-0933c84b4f4f
        Partition Entry GUID        =fbc96b01-a479-4222-95b3-6dc67834009b
        Starting LBA                =                1536
        Ending LBA                  =                2014
    Partition Entry             =  5
        Partition Type GUID         =Unused
[...]
---

So you see that everything except linux-swap uses the same GUID (Windows data). According to Wikipedia Linux should use a different GUID for its filesystems.

Regards,
Ulrich