tech-kern archive

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

Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)



On Sat, Apr 10, 2021 at 03:17:35PM -0700, Greg A. Woods wrote:
> [...]
> # fdisk -F /images/FreeBSD-12.2-RELEASE-amd64-mini-memstick.img
> Disk: /images/FreeBSD-12.2-RELEASE-amd64-mini-memstick.img
> NetBSD disklabel disk geometry:
> cylinders: 49, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
> total sectors: 791121, bytes/sector: 512
> 
> BIOS disk geometry:
> cylinders: 49, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
> total sectors: 791121
> 
> Partitions aligned to 16065 sector boundaries, offset 63
> 
> Partition table:
> 0: EFI system partition (sysid 239)
>     start 1, size 1600 (1 MB, Cyls 0/0/2-0/25/26)
> 1: FreeBSD or 386BSD or old NetBSD (sysid 165)
>     start 1601, size 789520 (386 MB, Cyls 0/25/27-49/62/30), Active
> 2: <UNUSED>
> 3: <UNUSED>
> First active partition: 1
> Drive serial number: 2425393296 (0x90909090)
> 
> # fdisk vnd0
> fdisk: primary partition table invalid, no magic in sector 0
> fdisk: Cannot determine the number of heads
> Disk: /dev/rvnd0d
> NetBSD disklabel disk geometry:
> cylinders: 4096, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
> total sectors: 8388608, bytes/sector: 512
> 
> BIOS disk geometry:
> cylinders: 522, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
> total sectors: 8388608
> 
> Partitions aligned to 16065 sector boundaries, offset 63
> 
> Partition table:
> 0: <UNUSED>
> 1: <UNUSED>
> 2: <UNUSED>
> 3: <UNUSED>
> Bootselector disabled.
> No active partition.
> Drive serial number: 0 (0x00000000)

I can't reproduce this fdisk/disklabel on netbsd-9 nor -current.
fdisk on vnd0 gives me the same partition table as on the file.
FreeBSD fails to boot with the same error message.
The size of the disk is indeed 790528 in the xenstore (and the dom0's
kernel message) but I don't know where this comes from.
xbdback uses getdiskinfo() to get the device's size.
In vnd, the size comes from a VOP_GETATTR() on the file, so it looks
like VOP_GETATTR() returns the wrong size.
The file is definitively 791121 sectors long:
#dd if=FreeBSD-12.2-RELEASE-amd64-mini-memstick.img.orig of=FreeBSD-12.2-RELEASE-amd64-mini-memstick.img
791121+0 records in
791121+0 records out
#ls -l FreeBSD-12.2-RELEASE-amd64-mini-memstick.img
-rw-r--r--  1 root  wheel  405053952 Apr 11 11:56 FreeBSD-12.2-RELEASE-amd64-mini-memstick.img
#expr 405053952 / 512
791121

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index