Subject: Re: NetBSD domU cannot mount partitions
To: Silas Silva <silasdb@gmail.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-xen
Date: 02/06/2008 15:14:08
On Thu, Jan 31, 2008 at 12:31:41AM -0200, Silas Silva wrote:
> Hello all.
> 
> I finally could make my NetBSD domU machine boot. Jim Cipar helped me and I
> could get NetBSD 4.0 with the PAE kernel boot. I'm using one of the lastest
> built PAE kernels (the 28 jan snapshot)
> 
> I'm facing other category of problems, though. I hope you can help me, as I'm
> very new to xen and virtualization. dom0 is Linux.
> 
> First, I don't know what exactly I have to pass to the "disk=" parameter in
> the machine configuration. My configuration file is below:
> 
> kernel = "/boot/netbsd-XEN3PAE_DOMU-200801280002Z"
> memory = 832
> name = "mist"
> vif = [ 'mac=aa:00:00:00:00:11']
> disk = [ 'phy:/dev/sda2,sda2,w' ]
> root = 'xbd0d'
> 
> My root partition is actually xbd0a. But if I set root to the correct value,
> the kernel cannot mount it and ask me for the root device. No one device
> works, but when I type "xbd0d" the following happens:
> 
> It falls in the single user mode. It strangly cannot start /bin/sh and ask me
> for the shell path:
> 
> Enter pathname of shell or RETURN for /bin/sh: /bin/sh
> #
> 
> Then I take a look to some partitions
> 
> # disklabel xbd0
>  # /dev/rxbd0d:
> type: unknown
> disk: Logical Volume 
> label: 
> flags:
> bytes/sector: 512
> sectors/track: 128
> tracks/cylinder: 16
> sectors/cylinder: 2048
> cylinders: 151634
> total sectors: 310546432
> rpm: 3600
> interleave: 1
> trackskew: 0
> cylinderskew: 0
> headswitch: 0           # microseconds
> track-to-track seek: 0  # microseconds
> drivedata: 0 
> 
> 16 partitions:
> #        size    offset     fstype [fsize bsize cpg/sgs]
>  a:  10485760        63     4.2BSD   2048 16384     0  # (Cyl.      0*- 5120*)
>  b:   1048576  10485823       swap                     # (Cyl.   5120*- 5632*)
>  c: 293603877        63     unused      0     0        # (Cyl.      0*- 143361*)
>  d: 310546432         0     unused      0     0        # (Cyl.      0 - 151633)
>  e:   8000370 302536080 Linux Ext2      0     0        # (Cyl. 147722*- 151629*)
>  f:  10485760  11534399     4.2BSD   2048 16384     0  # (Cyl.   5632*- 10752*)
>  g:   1048576  22020159     4.2BSD   1024  8192     0  # (Cyl.  10752*- 11264*)
>  h:  20971457  23068735     4.2BSD   1024  8192     0  # (Cyl.  11264*- 21503)
>  i:  94371840  44040192     4.2BSD   1024  8192     0  # (Cyl.  21504 - 67583)
>  j:  37748736 138412032     4.2BSD   1024  8192     0  # (Cyl.  67584 - 86015)
>  k:  54525952 176160768     4.2BSD   1024  8192     0  # (Cyl.  86016 - 112639)
>  l:  31457280 230686720     4.2BSD   1024  8192     0  # (Cyl. 112640 - 127999)
>  m:  31459940 262144000     4.2BSD   1024  8192     0  # (Cyl. 128000 - 143361*)
> 
> As you can see, NetBSD can see other partitions, but when I try to mount that
> I get the "invalid block" error:
> 
> # mount /dev/xbd0a /mnt
> mount_ffs: /dev/xbd0a on /mnt: incorrect super block
> # mount /dev/xbd0g /mnt
> mount_ffs: /dev/xbd0g on /mnt: incorrect super block
> 
> I can boot netbsd from this partition perfectly when I startup the machine and
> chose the NetBSD entry in the grub menu, but I can't startup it from xen.
> 
> Have anybody faced simillar problems and can help me? What would be the
> correct configuration for a virtual machine running NetBSD on a Linux dom0? Is
> the disk= option right?

You did a native NetBSD install on this /dev/sda2, right ? If so the
problem you're seeing is expected; the disklabel at the start of sda2 has
offsets relative to the start of the disk, not the start of the partition.
Using
disk = [ 'phy:/dev/sda,sda,w' ]

may fix it.

-- 
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
     NetBSD: 26 ans d'experience feront toujours la difference
--