Bug 247367 - Sometimes, GPT-labeled partitions don't appear in /dev/gpt/ in a FreeBSD BHYVE guest
Summary: Sometimes, GPT-labeled partitions don't appear in /dev/gpt/ in a FreeBSD BHYV...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bhyve (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-virtualization (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-18 00:45 UTC by Sebastien Boisvert
Modified: 2020-06-18 00:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastien Boisvert 2020-06-18 00:45:48 UTC
Actual result
-------------

According to "glabel", my disk has 3 GPT labels:

root@nova:~ # gpart show -l
=>      40  41942960  vtbd0  GPT  (20G)
        40       216         - free -  (108K)
       256      1024      1  boot0  (512K)
      1280  39844608      2  root0  (19G)
  39845888   2097112      3  swap0  (1.0G)

But in /dev/gpt/, only boot0 is detected.

root@nova:~ # ls /dev/gpt
boot0


Also, "glabel refresh" fails too:

root@nova:~ # glabel refresh vtbd0
Can't refresh metadata from vtbd0: Operation not permitted.


I don't think that GPT labels depends on the type of disk (VirtIO, AHCI/SATA, 
, SCSI, and so on).


Expected result
---------------

I expect to see 3 entries in /dev/gpt/, namely:
- /dev/gpt/boot0
- /dev/gpt/root0
- /dev/gpt/swap0

I am only seeing /dev/gpt/boot0.


Why this is important
---------------------

This is annoying because in the BHYVE guest config file, I want to change
the disk type from virtio-blk to ahci-hd since virtio-blk does not support TRIM and ahci-hd does.

In Linux, I use /dev/disk/by-uuid/* to avoid using the /dev/something-not-portable.


BHYVE guest config
------------------

root@atlantis:~ # cat /tank/vm-bhyve/nova/nova.conf
loader="bhyveload"
cpu=1
memory=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0"
disk0_dev="zvol"
uuid="788979be-a7b4-11ea-a49d-a8a15906202d"
network0_mac="58:9c:fc:0c:50:9c"


Disk ZVOL in the BHYVE host
---------------------------

Inside the VM, only 5.4G is Used:

root@nova:~ # df -h /
Filesystem      Size    Used   Avail Capacity  Mounted on
/dev/vtbd0p2     18G    5.4G     12G    32%    /


But the FreeBSD 12.1 guest has a ZVOL with REFER=20.1G:

root@atlantis:~ # zfs list tank/vm-bhyve/nova/disk0
NAME                       USED  AVAIL  REFER  MOUNTPOINT
tank/vm-bhyve/nova/disk0  20.6G  5.04T  20.1G  -


Comparison with a Debian guest
------------------------------

Inside the VM, Used is 1.1G.

capside@capside:~$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       125G  1.1G  118G   1% /


And the corresponding ZVOL has a REFER=4.13G.

root@atlantis:~ # zfs list tank/vm-bhyve/capside/disk0
NAME                          USED  AVAIL  REFER  MOUNTPOINT
tank/vm-bhyve/capside/disk0   132G  5.17T  4.13G  -