Bug 203791 - gpart cannot show/list gpt partitions inside a gpt partition
Summary: gpart cannot show/list gpt partitions inside a gpt partition
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.2-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-15 15:01 UTC by Martin Birgmeier
Modified: 2015-12-13 16:39 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2015-10-15 15:01:42 UTC
On a GPT-partitioned disk in my server (ada3) I have three partitions (ada3s11, ada3s12, and ada3s13) for use in conducting experiments using VirtualBox. In the VirtualBox client, these partitions show up as disks which can then be used for various purposes.

In one test these partitions show up as ada0, ada1, and ada2 in the VB client, respectively.

In the VB client, ada1 and ada2 have been MBR-partitioned, whereas ada0 has been GPT-partitioned as follows.

(in the VB client; everything not containing "ada[012]" has been replaced by an ellipsis)

# gpart show
=>      34  41942973  ada0  GPT  (20G)
        34         6        - free -  (3.0K)
        40      1024     1  freebsd-boot  (512K)
      1064       984        - free -  (492K)
      2048   4194304     2  freebsd-zfs  (2.0G)
   4196352   4194304     3  freebsd-swap  (2.0G)
   8390656  33550336     4  freebsd-zfs  (16G)
  41940992      2015        - free -  (1.0M)

=>      63  41942977  ada1  MBR  (20G)
        63   4194241     1  fat32  (2.0G)
   4194304  37748736     4  freebsd  [active]  (18G)

...

=>       0  37748736  ada1s4  BSD  (18G)
         0   4194304       1  freebsd-zfs  (2.0G)
   4194304   4194304       2  freebsd-swap  (2.0G)
   8388608  29360128       4  freebsd-zfs  (14G)

...

=>      63  41942977  ada2  MBR  (20G)
        63   4194241     1  fat32  (2.0G)
   4194304  37748736     4  freebsd  [active]  (18G)

...

=>       0  37748736  ada2s4  BSD  (18G)
         0   4194304       1  freebsd-zfs  (2.0G)
   4194304   4194304       2  freebsd-swap  (2.0G)
   8388608  29360128       4  freebsd-zfs  (14G)

...

[0]# 

(on the server, outside the VB client; the VB client has been shutdown to allow access to the partitions; everything not containing "ada3" has been replaced by an ellipsis)

# gpart show
...

=>        34  3907029101  ada3  GPT  (1.8T)
          34          30        - free -  (15K)
          64         192     1  freebsd-boot  (96K)
         256    41943040    11  freebsd  (20G)
    41943296    41943040    12  freebsd  (20G)
    83886336    41943040    13  freebsd  (20G)
   125829376    23068672        - free -  (11G)
   148898048  2684354560     3  freebsd-zfs  (1.3T)
  2833252608   536870912     4  freebsd-zfs  (256G)
  3370123520   536870912     5  freebsd-zfs  (256G)
  3906994432       34703        - free -  (17M)

...

=>      63  41942977  ada3s11  MBR  (20G)
        63  41942977           - free -  (20G)

...

=>      63  41942977  ada3s12  MBR  (20G)
        63   4194241        1  fat32  (2.0G)
   4194304  37748736        4  freebsd  [active]  (18G)

=>       0  37748736  ada3s12s4  BSD  (18G)
         0   4194304          1  freebsd-zfs  (2.0G)
   4194304   4194304          2  freebsd-swap  (2.0G)
   8388608  29360128          4  freebsd-zfs  (14G)

...

=>      63  41942977  ada3s13  MBR  (20G)
        63   4194241        1  fat32  (2.0G)
   4194304  37748736        4  freebsd  [active]  (18G)

=>       0  37748736  ada3s13s4  BSD  (18G)
         0   4194304          1  freebsd-zfs  (2.0G)
   4194304   4194304          2  freebsd-swap  (2.0G)
   8388608  29360128          4  freebsd-zfs  (14G)

...

# 

The problem is that for ada3s11, gpart (executed on the server, VB not running) does not show the correct partitioning scheme (which is GPT), but only the compatibility MBR scheme. For ada3s12 and ada3s13, which are MBR schemes anyway, the output is the same (aside from naming differences) inside and outside VB.

The suggested solution is that gpart should first probe for a GPT scheme and only afterwards for an MBR scheme when probing for further partitioning schemes inside partitions.
Comment 1 Andrey V. Elsukov freebsd_committer freebsd_triage 2015-12-10 10:29:34 UTC
geom_part_gpt(4) doesn't support nesting GPT by design.
Comment 2 Martin Birgmeier 2015-12-13 16:39:32 UTC
Could you provide me with a pointer to the design - I am interested in understanding its rationale.

-- Martin