Bug 225813

Summary: [geom][patch] gpart does not recognise Apple APFS partition type
Product: Base System Reporter: James Wright <james.wright>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Some People CC: cem
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
Patch for adding Apple APFS as a known GPT partition type none

Description James Wright 2018-02-10 22:29:11 UTC
Created attachment 190494 [details]
Patch for adding Apple APFS as a known GPT partition type

Apple APFS partition type is not recognised by gpart, e.g.

james macbook ~ % gpart show
=>       34  977104993  ada0  GPT  (466G)
         34          6        - free -  (3.0K)
         40     409600     1  efi  (200M)
     409640  546875000     2  !7c3457ef-0000-11aa-aa11-00306543ecac  (261G)
...

I have included a patch to add the Apple APFS magic guid to the known types, recompiled and tested with the following results;

james macbook ~ % gpart show
=>       34  977104993  ada0  GPT  (466G)
         34          6        - free -  (3.0K)
         40     409600     1  efi  (200M)
     409640  546875000     2  apple-apfs  (261G)

Please could someone review and test the patch for me?

Thanks,
James
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2018-02-11 02:35:13 UTC
Patch looks fine to me modulo gratuitously changed lines in gpt.h and possible ABI break by inserting at the front of 'enum g_part_alias'.
Comment 2 Conrad Meyer freebsd_committer freebsd_triage 2018-02-11 06:57:43 UTC
Thank you for submitting the patch.  I added a blurb to gpart.8 manual page as well.
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-02-11 06:57:44 UTC
A commit references this bug:

Author: cem
Date: Sun Feb 11 06:57:21 UTC 2018
New revision: 329119
URL: https://svnweb.freebsd.org/changeset/base/329119

Log:
  Add GUID and alias for Apple APFS partition

  PR:		225813
  Submitted by:	James Wright <james.wright AT jigsawdezign.com>

Changes:
  head/sbin/geom/class/part/gpart.8
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part.h
  head/sys/geom/part/g_part_gpt.c
  head/sys/sys/disk/gpt.h