NetBSD-Users archive

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

Re: Use of disklabel, MBR and GPT



I have a few clarifications...

> Maybe this is trivial, but during the installation of NetBSD a
> disklabel is actually nested inside a primary MBR partition.

This is true for some architectures (like amd64), but others do use plain
disklabel on a disk without any MBR. This also works on amd64 when you
do not need to boot from the disk.

> As you may note, the use of MBR is never abandoned. This is done for two
> reasons:
> 
> - to grant the compatibility with PC/DOS (and other OSs like Windows
>   this way can still use the same disk);
> - to grant a regular boot on PC/IBM hardware (where, without a valid
>   MBR, the BIOS could not even try to search a bootloader on the disk).

Yes and no - newer sysinst versions allow to kill the whole disk content
(including the MBR and whatver partitions exists), and start from scratch
(as if the disk had been totaly wiped before). Use with care - this kills
all data on the disk.

> Whatever choices the user makes, in the end there will be an MBR primary
> partition dedicated exclusively to NetBSD.

If you pick MBR partitioning, yes. If you select GPT, it is different
(as you mentioned below).

> It may seem that this disklabel, nested into an MBR primary partition,
> is used to further divide internally this partition: so, for another MBR
> primary partition on the same disk, there may be another disklabel which
> can be used the same way. This is wrong.

Right. There is (a maximum of) one disklabel per disk. On architectures
supporting MBR the kernel will use the one from the first MBR NetBSD
partition (if it exists), or the global one - but in general we try
to avoid confusion and place it inside the NetBSD MBR partition.

The (single) disklabel can then describe partitions outside of the NetBSD
partition too (as seen when setting up (U)EFI booting on disks with MBR
partitioning -  the EFI boot partition shows up in the disklabel).

> When the machine is booted with NetBSD, disklabel is the only way NetBSD
> looks at the disk, the *entire* disk; MBR in this case is not considered
> at all.

That is kind of correct once the kernel is running. For the bootstrap process
(finding and loading the kernel) the MBR is important (both for BIOS and
UEFI boots).

> GPT is available to partition a system disk when performing a UEFI
> installation:
> 
>  <https://wiki.netbsd.org/Installation_on_UEFI_systems/>
> 
> but IIRC a traditional BIOS installation does not offer GPT.

This is not true - you can select GPT for boot disks with both firmwares.

> As well, if a new disk is added to an existing NetBSD system (so, it is
> not a boot disk), it may be partitioned using only disklabel, not MBR or
> GPT.

Actually you have three choices: GPT, MBR+disklabel, disklabel.

You did not stress the (from my POV) most important points of all this mess:

 - if you need the disk to be accessible from other systems, you need to
   use a partitioning scheme they understand. MBR works for DOS and older
   windows, GPT works for nearly everything newer. Disklabel only works
   for older Unix systems or NetBSD.
 - if your disk is larger than 2TB you can not use MBR (you may have luck
   with some systems upto 4TB, but the "portability" is lost), nor can
   you use disklabel. Select GPT (sysinst knows about the size limits
   and will avoid non-working selections).

The topic is confusing, thanks for summarizing!

Martin


Home | Main Index | Thread Index | Old Index