DaemonForums  

Go Back   DaemonForums > NetBSD > NetBSD Installation and Upgrading

NetBSD Installation and Upgrading Have trouble getting NetBSD on your toaster?

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 4th October 2021
dchmelik's Avatar
dchmelik dchmelik is offline
Real Name: David Chmelik
Port Guard
 
Join Date: Oct 2017
Location: USA
Posts: 28
Default can't determine partitions

I used NetBSD in the late 1990s - early '0s. I tried to install NetBSD 9.2. The installer, fdisk, disklabel all describe partitions differently--there's no consistency to know what matches in each. I have an NVMe SSD with nine partitions and want to install NetBSD on a logical partition in the extended one. How would I know which partition is which in the installer, or what matches in next steps in the installer or if I have to use an installation shell, in fdisk and disklabel?
__________________
David
homesite mirror (most uptime) / homesite (updated first)
Reply With Quote
  #2   (View Single Post)  
Old 5th October 2021
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Package Pilot
 
Join Date: Oct 2017
Location: Rome
Posts: 140
Default

Quote:
Originally Posted by dchmelik View Post
I used NetBSD in the late 1990s - early '0s. I tried to install NetBSD 9.2. The installer, fdisk, disklabel all describe partitions differently--there's no consistency to know what matches in each. I have an NVMe SSD with nine partitions and want to install NetBSD on a logical partition in the extended one. How would I know which partition is which in the installer, or what matches in next steps in the installer or if I have to use an installation shell, in fdisk and disklabel?

"Simply" put:
  • use gpt(8) to create GPT disks, edit the GPT partition layout, install GPT bootcode and create/edit/delete partition inside those disks, both on UEFI and BIOS firmware.
  • use fdisk(8) to create MBR disks, edit/fix the MBR, install the MBR bootcode, change the active partition, and create/edit/delete partitions within MBR disks, on BIOS firmware.
  • use disklabel(8) to create, edit and modify partitions within a 4.4BSD label. This applies to MBR disks, CGD cryptographic devices, and LVM volumes.
  • use zfs(8)/zpool(8) to manage ZFS storage pools.
  • use newfs(8) to format a partition
  • use resize_ffs(8) to resize FFSv1,2 partitions
__________________
“Mi casa tendrá dos piernas y mis sueños no tendrán fronteras„
Reply With Quote
  #3   (View Single Post)  
Old 5th October 2021
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Package Pilot
 
Join Date: Oct 2017
Location: Rome
Posts: 140
Default

To expand on my previous reply, and referring more specifically to your use case, first consider that a NVMe SSD will be presented as a disk array controller by the the ld(4) driver, and will show as ld* amid the attached wedges. Assuming that this SSD is actually the first available disk, it should be assigned a ld0 devnode.

Note that, unlike OpenBSD, NetBSD does not write a BSD label to the secondary GPT header, meaning there won't be any a-z slices for wd*, sd* and ld* disks (i.e., no ld0a, ld0b...), but just dk* logical disk wedges (dk1, dk2, dkn...), since the filesystem won't be structured as a single BSD label (partition) containing various slices, but as a set of standard independent partitions (similarly to Linux or Windows). I think this is meant to allow for better compatibility with other OSs. See dk(4).

Practically speaking, if your NVMe disk is attached at ld0 and has a GPT layout containing 9 partitions, including the EFI system partition, you should see something like:
Code:
# sysctl hw.disknames
 hw.disknames = ld0 dk0 dk1 dk2 dk3 dk4 dk5 dk6 dk7 dk8
Code:
# dkctl ld0 listwedges
  /dev/rld0: 9 wedges:
  dk0: EFI system, 262144 blocks at 2048, type: msdos
  ...
  dk8: 2dfc926e-42bd-43fb-9bb5-b227c2c3fc99, 2560000 blocks at 264192, type: ffs
Code:
gpt show ld0
 
      start       size  index  contents
          0          1         PMBR (active)
          1          1         Pri GPT header
          2         32         Pri GPT table
         34       4062         Unused
       4096     262144         GPT part - EFI system
     266248  134215680      1  GPT part - NetBSD FFSv1/FFSv2
  134219776   16539648      2  GPT part - NetBSD swap

        ...       ....      *  ...
At this point use gpt(8) to create or modify new partitions, or delete existing ones. For instance, you can add a partition occupying all the free space left on the SSD by:
Code:
# gpt add -a 2m -t ffs -l "netbsd” ld0
Otherwise, if you're dealing with a MBR disk (is that really the case? you mentioned extended/logical partitions), you can convert it to a GPT disk with `gpt migrate', otherwise you can inspect the disk with disklabel(8). Use `disklabel -iI ld0', to enter the interactive mode and type 'P' (uppercase) to print the current partition layout. Should be something like:
Code:
11 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:  62093312    458752     4.2BSD      0     0     0  # (Cyl.    224 -  30542)
 b:    262144    196608       swap                     # (Cyl.     96 -    223)
 c:  62552064         0     unused      0     0        # (Cyl.      0 -  30542)
 d:  62093312    458752     unused      0     0        # (Cyl.    224 -  30542)
e-k:        *         *          *      *     *        # (Cyl.      * -      *)
  • "a" is the root partition, partition type is "4.2BSD" (a slice in a BSD label)
  • "b" is traditionally the swap partition, partition type is "swap".
  • "c" is the space addressed by the MBR table on i386 and amd64.
  • "d" addresses the whole disk on x86/AMD64. Neither alter this one, or the one before.
  • e-k The other partitions, may be "4.2BSD" just like "a".
Type the letter of any partition (lowercase) to edit it, eventually type 'W' and 'Q' (uppercase) to write the new disk layout and exit, respectively.

Either way, you can format the newly created raw partition(s) (note the prepended 'r' below, before the device node indentifier) with newfs(8):
Code:
# newfs -O 2 -V2 -f 2048 /dev/rld0* # on MBR
# newfs -O 2 -V2 -f 2048 /dev/rdk*  # on GPT

`-O2'
will tell newfs to format the partitions as FFsv2. Naturally you can use FFSv1 for compatibility reasons (e.g. mount across BSDs), or use ZFS or LFS.
Quote:
Originally Posted by dchmelik View Post
[...] and want to install NetBSD on a logical partition in the extended one.
As far as I know BSDs require root to be on a primary partition and cannot be installed on an extended one. Depending on your goal, it would be better to use LVM on NetBSD. Also, see lvm(8).

If you still insist on creating an extended partition, use fdisk(8).

As a side note, to display a human-readable summary of the nvme0 IDENTIFY_CONTROLLER data, you can use:
Code:
# nvmectl identify nvme0
__________________
“Mi casa tendrá dos piernas y mis sueños no tendrán fronteras„

Last edited by Sensucht94; 5th October 2021 at 12:32 PM.
Reply With Quote
  #4   (View Single Post)  
Old 8th October 2021
dchmelik's Avatar
dchmelik dchmelik is offline
Real Name: David Chmelik
Port Guard
 
Join Date: Oct 2017
Location: USA
Posts: 28
Default

Obviously I use MBR; I can't stand UEFI, but maybe I won't be able to install NetBSD unless I switch. I think I could figure it out from the instructions above if I decide to.
__________________
David
homesite mirror (most uptime) / homesite (updated first)
Reply With Quote
  #5   (View Single Post)  
Old 8th October 2021
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Package Pilot
 
Join Date: Oct 2017
Location: Rome
Posts: 140
Default

Quote:
Originally Posted by dchmelik View Post
Obviously I use MBR; I can't stand UEFI, but maybe I won't be able to install NetBSD unless I switch. I think I could figure it out from the instructions above if I decide to.

The use of a GPT partition table is not limited to UEFI systems. You can use GPT on BIOS systems (as I do) and have up to 128 primary partitions. At least on NetBSD, this sort of setup is officially supported and the bootcode for that is provided at /usr/mdec/gptmbr.bin on the install media. The boot code is going to be automatically installed if you booted the installer in BIOS or Legacy Boot mode and picked out gpt as partition scheme during the installation. The topic is covered in the 'biosboot' subsection of the gpt(8) man page.
__________________
“Mi casa tendrá dos piernas y mis sueños no tendrán fronteras„
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pcmanfm-qt requires refresh to determine MIME type of new files brudan OpenBSD Packages and Ports 6 16th April 2019 03:28 PM
how to determine if kernel & userland are synchronized? daemonfowl OpenBSD General 4 10th May 2012 03:02 PM
Determine packet sizes Frothingdog OpenBSD General 7 26th July 2010 03:29 PM
partitions italogf FreeBSD Installation and Upgrading 5 7th July 2008 12:14 PM
URL evaluation tools to determine if serving malware dk_netsvil Off-Topic 0 30th June 2008 04:55 PM


All times are GMT. The time now is 07:19 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick