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

2022-09-29 Thread Pham Ngoc-Dung
I rebuilt the kernel as you suggested. It booted up, but the Linux 
partitions are not detected. The root and swap partitions of NetBSD, 
however, is now on /dev/dk0 and dk1.


On 9/29/22 12:50 AM, Brad Spencer wrote:

You also want this -> DKWEDGE_METHOD_BSDLABEL as well as (or even
instead of) DKWEDGE_METHOD_MBR.  That cause a wedge to be added for each
disklabel entry which should the system to find your root filesystem.
It appears that with just DKWEDGE_METHOD_MBR the system didn't notice
where its root fs was at.  In fact, you may need to leave out
DKWEDGE_METHOD_MBR and just use DKWEDGE_METHOD_BSDLABEL if your
disklabel contains information about all of the native NetBSD
filesystems and the linux ones.

You will have to change everything in your /etc/fstab to use /dev/dkN
notation rather than /dev/wd0M notation, but that isn't too hard to do.


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

2022-09-29 Thread Martin Husemann
On Thu, Sep 29, 2022 at 08:25:00PM +0700, Pham Ngoc-Dung wrote:
> I tried dkctl. But it said "/dev/rwd0: addwedge: Device busy" every time.
> However, I noticed that when I booted from the installation drive, the Linux
> partitions appeared.

Try "dkctl wd0 listwedges" and see if they are already there.

> Maybe dk wedges only works with drives that weren't the
> root drive.

No, they work everywhere but you can't create overlapping/duplicate wedges.

Martin


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

2022-09-29 Thread Pham Ngoc-Dung

Hi.

I looked back into the disklabel. Then I found mbrlabel(8) mentioned in 
this (https://silas.net.br/tech/netbsd/netbsd-tips.html). But, I didn't 
see this command popping up in similar questions, so I was hesitated to 
try, in fear that maybe I'm blindly executing it.


I also made a post on the NetBSD reddit where I got a "confirmation" 
(sorry, I didn't know the right word) that I should use mbrlabel.
I did 'mbrlabel -r -w wd0' and the partition I need to mount is now on 
/dev/wd0e.


#sizeoffset fstype
 a:  60835840   6557696 4.2BSD
 b:   6270976  67393536   swap
 c:  67106816   6557696 unused
 d: 976771055 0 unused
 e:262144  2048 Linux Ext2

I wanna thank you, Brad and Martin for helping me with this problem. 
This is my first time writing to a mailing list so I was really nervous.


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

2022-09-29 Thread Brad Spencer


Pham Ngoc-Dung  writes:

> I rebuilt the kernel as you suggested. It booted up, but the Linux 
> partitions are not detected. The root and swap partitions of NetBSD, 
> however, is now on /dev/dk0 and dk1.
>
> On 9/29/22 12:50 AM, Brad Spencer wrote:
>> You also want this -> DKWEDGE_METHOD_BSDLABEL as well as (or even
>> instead of) DKWEDGE_METHOD_MBR.  That cause a wedge to be added for each
>> disklabel entry which should the system to find your root filesystem.
>> It appears that with just DKWEDGE_METHOD_MBR the system didn't notice
>> where its root fs was at.  In fact, you may need to leave out
>> DKWEDGE_METHOD_MBR and just use DKWEDGE_METHOD_BSDLABEL if your
>> disklabel contains information about all of the native NetBSD
>> filesystems and the linux ones.
>> 
>> You will have to change everything in your /etc/fstab to use /dev/dkN
>> notation rather than /dev/wd0M notation, but that isn't too hard to do.


That probably means that the disklabel does not include the Linux
filesystems... probably...  look closely at 'disklabel wd0' or whatever
your disk is called and see if anything Linux is there.
DKWEDGE_METHOD_BSDLABEL should create a wedge for every filesystem
described in the disklabel.  But...  as someone else mentioned, you
don't have to use wedges at all if the disklabel contains a description
of the Linux filesystems.  You can just mount the filesystems directly
as wd0N.


-- 
Brad Spencer - b...@anduin.eldar.org - KC8VKS - http://anduin.eldar.org


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

2022-09-29 Thread Pham Ngoc-Dung

I tried dkctl. But it said "/dev/rwd0: addwedge: Device busy" every time.
However, I noticed that when I booted from the installation drive, the 
Linux partitions appeared. Maybe dk wedges only works with drives that 
weren't the root drive. But that doesn't sound right since I was able to 
get the partitions detected as dk* the first time I rebuilt the kernel.


On 9/29/22 1:16 AM, Martin Husemann wrote:


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