NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

NetBSD & disks with 4K sector size



I'm trying to install NetBSD 9.3 as a PV (or NetBSD/10 as PVH[0]) Xen 
domain. The Dom0 is running Linux and serves the disks as LVM devices:

 $ lvs vg0/netbsd-disk{0,1}
  LV           VG  Attr       LSize
  netbsd-disk0 vg0 -wi-ao----  8.00g
  netbsd-disk1 vg0 -wi-ao---- 16.00g

However, early during installation the a curious thing happens: NetBSD 
thinks the root disk is way too big:

     Available disks
                │                          │                                           
                │>a: xbd0 (64G)            │                                           
                │ b: xbd1 (128G)           │                                           
                │ c: Extended partitioning │                                           
                │ x: Exit    

But if continued, the console is flooded with:

 [ 624.6300953] xbd1d: error reading fsbn 0 (xbd1 bn 0; cn 0 tn 0 sn 0)
 [ 624.6401076] xbd1: dos partition I/O error

And similarly for xbd0. And later the disk configuration process fails 
with:

 Status: Command failed                                                     
 Command: disklabel -w -r -f /tmp/disklabel.7603 xbd0 'xbd0' 'default label' 
 Hit enter to continue 
 disklabel: ioctl DIOCWDINFO: Input/output error

Sometimes "sysinst" even crashes and dumps core, but I was not able to 
analyze it as I don't know how to get it out of the DomU.

So, this is all very weird, and I have to say that This Worked Before: 
NetBSD was installed as a PV Xen domain on the same disk, but with a 
slightly different LVM setup, and *maybe* the sector size has changed to 
4k now. There's a Linux command "blockdev" that queries various disk 
parameters, for /dev/vg0/netbsd-disk0 (xbd0) it tells me:

16777216        --getsz - "get size in 512-byte sectors"
0               --getro - "get read-only"
0               --getdiscardzeroes - "get discard zeroes support status"
4096            --getss - "get logical block (sector) size"
4096            --getpbsz - "get physical block (sector) size"
4096            --getiomin - "get minimum I/O size"
0               --getioopt - "get optimal I/O size"
0               --getalignoff - "get alignment offset in bytes"
2560            --getmaxsect - "get max sectors per request"
4096            --getbsz - "get blocksize"
16777216        --getsize - "get 32-bit sector count (deprecated)
8589934592      --getsize64 - "get size in bytes"
256             --getra - "get readahead"
256             --getfra - "get filesystem readahead"
79              --getdiskseq - "get disk sequence number"

This all looks fine, 8 GB is the correct size here and both --getsz and 
--getsize64 add up. But maybe that 4096 sectory size is what throws NetBSD 
off.

So, my question is: does NetBSD work with 4k sector size disks? I found 
two[1][2] threads from 11 years ago, but nothing conclusive and with 
somewhat conflicting[3][4] information.

As an additional note: booting NetBSD as a HVM domain[5] works just fine 
and disk sizes are recognized correctly.

And ideas on how to tackle this?

Thanks,
Christian.

[0] https://mail-index.netbsd.org/port-xen/2020/05/02/msg009718.html
[1] https://mail-index.netbsd.org/tech-kern/2012/06/07/msg013321.html
[2] https://mail-index.netbsd.org/netbsd-users/2012/03/01/msg010168.html
[3] https://mail-index.netbsd.org/tech-kern/2012/06/07/msg013326.html
[4] https://mail-index.netbsd.org/tech-kern/2012/06/07/msg013328.html 
[5] https://wiki.netbsd.org/ports/xen/howto/#index1h2
-- 
BOFH excuse #206:

Police are examining all internet packets in the search for a 
narco-net-trafficker


Home | Main Index | Thread Index | Old Index