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)
Depends on:
Reported: 2020-06-18 00:45 UTC by Sebastien Boisvert
Modified: 2020-06-18 00:45 UTC (History)
0 users

See Also:


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

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

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  -