[Bug 280884] wrong media size for 4k disks

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 17 Aug 2024 14:57:31 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280884

            Bug ID: 280884
           Summary: wrong media size for 4k disks
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: freebsd@nerdbynature.de

Booting 15.0-CURRENT (main-n271670-bd4f2023bb05) as a Xen DomU (hvm mode)
prints:

================================
# dmesg | grep xbd
xbd0: 49152MB <Virtual Block Device> at device/vbd/51712ata1: reset tp1 mask=03
ostat0=50 ostat1=00
xbd0: features: flush, write_barrier
xbd0: synchronize cache commands enabled.

xbd1: 30720MB <Virtual Block Device> at device/vbd/51728xbd0: disk error  on
xenbusb_front0
xbd1: features: flush, write_barrier
xbd1: synchronize cache commands enabled.
================================

But xbd0 (the first disk configured) is supposed to be 6 GB in size. The same
disks from the Xen Dom0 (running a Linux distribution):

================================
# lsblk -o NAME,SIZE,FSTYPE,TYPE,LOG-SEC,PHY-SEC /dev/vg0/freebsd-disk0
/dev/vgteamlite/freebsd-disk1
NAME                      SIZE FSTYPE     TYPE LOG-SEC PHY-SEC
vg0-freebsd--disk0          6G            lvm     4096    4096
vgteamlite-freebsd--disk1  30G zfs_member lvm      512     512
================================

NB: while a "disk error" is reported for xbd1, the disk can be used in FreeBSD
just fine. zpool import works and the correct size is reported.

Trying to partition xbd0 (the 6 GB disk) results in all kinds of errors:

================================
# gpart create -s gpt xbd0
xbd0: disk error cmd=write 1-8 status: ffffffff
gpart: Input/output error

# gpart list xbd0
Geom name: xbd0
modified: true
state: OK
fwheads: 255
fwsectors: 63
last: 12582906
first: 6
entries: 128
scheme: GPT
Consumers:
1. Name: xbd0
   Mediasize: 51539607552 (48G)
   Sectorsize: 4096
   Mode: r1w1e1

# gnop create -S 4k xbd0
GEOM_NOP: Device xbd0.nop created.
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff
xbd0: disk error cmd=read 12582849-12582880 status: ffffffff
xbd0: disk error cmd=read 12582910-12582917 status: ffffffff
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff
xbd0: disk error cmd=read 12582910-12582917 status: ffffffff
xbd0: disk error cmd=read 1-8 status: ffffffff
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff
xbd0: disk error cmd=read 2-17 status: ffffffff
xbd0: disk error cmd=read 2-17 status: ffffffff
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff

# file -Ls /dev/xbd0*
xbd0: disk error cmd=read 0-2039 status: ffffffff
xbd0: disk error cmd=read 255-262 status: ffffffff
/dev/xbd0:     ERROR: cannot read `/dev/xbd0' (Ixbd0: disk error cmd=read
0-2039nput/output erro status: ffffffff
xbd0: disk error cmd=read 2r)
55-262 status: ffffffff
/dev/xbd0.nop: ERROR: cannot read `/dev/xbd0.nop' (Input/output error)
================================


Trying to play tricks with sector sizes doesn't work either:

================================
# gnop destroy xbd0.nop
GEOM_NOP: Device xbd0.nop removed.

# gnop create -S 4096 /dev/xbd0
GEOM_NOP: Device xbd0.nop created.
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff
xbd0: disk error cmd=read 12582849-12582880 status: ffffffff
xbd0: disk error cmd=read 12582910-12582917 status: ffffffff
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff
xbd0: disk error cmd=read 12582910-12582917 status: ffffffff
xbd0: disk error cmd=read 1-8 status: ffffffff
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff
xbd0: disk error cmd=read 2-17 status: ffffffff
xbd0: disk error cmd=read 2-17 status: ffffffff
xbd0: disk error cmd=read 12582911-12582918 status: ffffffff

# zpool create -o ashift=12 zroot /dev/xbd0.nop
xbd0: disk error cmd=read 4-227 status: ffffffff
xbd0: disk error cmd=read 68-291 status: ffffffff
xbd0: disk error cmd=read 12582788-12583011 status: ffffffff
xbd0: disk error cmd=read 12582852-12583075 status: ffffffff
cannot create 'zroot': no such pool or dataset
================================

The same happens on FreeBSD 14.1, but switching to 15.0-CURRENT did not help.

-- 
You are receiving this mail because:
You are the assignee for the bug.