tech-kern archive

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

Re: Can't mount root partition after rebuilding kernel with DKWEDGE_METHOD_MBR



On Wed, Sep 28, 2022 at 04:52:43PM +0000, Pham Ngoc-Dung wrote:
> Hi. On my hard drive (wd0, MBR), I have 3 partitions originally for Linux, including a boot partition (ext2 formatted), and another partition with NetBSD installed.
> For a reason I wanted to mount the Linux boot partition, which should have been easy since ext2 is supported by NBSD. But except fdisk where it showed up, I couldn't find it anywhere, nor a way to mount it.
> A little bit more of research, then I found out about dk(4). I tried to rebuild the kernel with DKWEDGE_METHOD_MBR uncommented. It did boot from that kernel, but it couldn't mount my root device, However the 3 Linux partitions were now detected: 
> 
> [4.8364408] wd0 at atabus0 drive 0
> [4.8364408] wd0: <ST500LT012-9WS142>
> [4.9467467] dk0 at wd0: "wd0e"
> [4.9467467] dk1 at wd0: "wd0f"
> [4.9467467] dk2 at wd0: "wd0h"
> [5.0676107] boot device: wd0
> [5.0676107] root on wd0a dumps on wd0b
> [5.0676107] vfs_mountroot: can't open root device
> [5.0676107] cannot mount root, error = 16
> [5.0676107] root device (default wd0a): 
> 
> Is there a workaround or a fix to this behavior?

You can hardwire / to dk2 (or whichever it is), but actually simpler is
to not use a kernel with DKWEDGE_METHOD_MBR and instead do the setup
at runtime from userland: find the start sector and size of the partition
you want from fdisk output and use "dkctl addwedge ..." to configure it
as dkN, then mount that dkN.

Martin


Home | Main Index | Thread Index | Old Index