Jump to content











Photo
- - - - -

Recommendations 4 Multi-boot Install Order Win, BSD, Linux

windows freebsd linux multi-boot

  • Please log in to reply
11 replies to this topic

#1 gentisle

gentisle
  • Members
  • 6 posts
  •  
    United States

Posted 11 September 2022 - 01:13 AM

Hi,

I've got an Asus laptop that I've installed Windows 7, 8.1, and 11. I want to put FreeBSD 13, and LinuxMint on it also. 2TB HDD, so plenty of space. But I'm curious about the order to install. Should I have installed FreeBSD first, then the different Windows, and finally Linux? If I've gotten this in the wrong order, and have to re-install, is it possible to do a backup of each Windows partition with the linux dd command, then restore them after I get FreeBSD installed? Anyone had experience with that. Thanks.

 

Currently, the partitions are (from my memory - not on that machine currently)

 

MS reserved 100 MB

Win 7            150 GB

Win 8.1         150 GB

Win 11          100 GB

 



#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 September 2022 - 12:13 PM

Are you booting BIOS (on a MBR disk) or UEFI (on a GPT disk)?

 

I am asking as if you are using a MBR style disk, unless you have taken particular precautions when partitioning the disk, you have probably used all the 4 primary partition slots in the MBR partition table, or maybe you have use an extended partition with several volumes in it. 

 

If you are using GPT there is no problem as all partitions are primary and up to 128 of them can be listed in the GPT table. (but you did not list the EFI boot partition - usually formatted FAT32 - unless you meant that the one you called "MS reserved" is the EFI one).

 

A partition is a contiguous extent on disk, and all addresses in it are relative to itself, exception made for the "Sectors Before" field in the PBR or bootsector.

 

And yes, you can copy a partition with dd and then re-deploy it at *any* address on disk, correcting - besides the partition table - that single address (for NTFS volume you need to correct also the $BootMirr which is a copy of the bootsector at the end of the volume - outside the volume but inside the partition), this is easy to do for primaries and a little bit more complex for logical volumes inside extended.

At least on MBR (but I believe on GPT it is not different) if you "move" a partition (or re-deploy a copy of it to a different address) in Windows there is also the need to correct the Registry about drive letter assignments.

But if you onlly dd-copy (to be on the safe side) a partition/volume and then re-deploy it to the same address there are no changes/corrections to be made.

 

In the case of UEFI, depending on the specific machine, you may be able to set the various EFI bootloaders in the NVRAM, otherwise you will need a bootmanager like GRUB2 (or grub4dos for UEFI, or both) to manage the multibooting, the issues may come from SecureBoot/TPM and similar.

 

Also it has to be seen what the BSD install procedure is, I am not familiar with it, but it seems like by default it creates an "own" EFI partition:

https://unix.stackex...on-uefi-machine

this can also be fixed or possibly by using a different install method avoid its creation. 

 

:duff:

Wonko



#3 gentisle

gentisle
  • Members
  • 6 posts
  •  
    United States

Posted 11 September 2022 - 11:45 PM

Wonko,

Thanks for that reply. I forgot to say GPT.Yes, the MS Reserved is the EFI partition. I should have booted the machine with a Linux live disc and written down all the numbers; it would have been more clear. Sorry.Yes, bsdinstall does create an EFI partition if you accept the defaults. But you can drop to the shell, and use gpart to configure the way you need.

 

I was thinking of doing a manual partitioning in FreeBSD because I want to install it in only ZFS partitions. But from all the pages I have been reading about dual booting, it seems, I will have to image the Windows partitions, then wipe, install FreeBSD and de-image the Windows partitions back to newly created ones. Thanks again.

gentisle



#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 12 September 2022 - 08:15 AM

I don't see why that should be needed.

 

I mean unless the good FreeBSD guys are "vandals" the install procedure should leave alone the "other" (NTFS) partitions, the one that may be affected is the EFI partition (with possible changes to the default EFI boot loader/ boot manager or similar).

 

For all the install knows, these volumes may be storage data ones, and I cannot believe that they would be affected.

 

If I were you, I would take the dd images[1] (as a precaution) but proceed to the FreeBSD install with the partitions still present, as said re-deploying such images to different addresses is possible, but not exactly easy-peasy.

 

:duff:

Wonko

 

[1] do image also the EFI partition AND the most important thing, the EFI partition table (usually it is the first 34 sectors of the disk, the MBR+GPT header+32 sectors with 4 partition records each), re-deploying a saved partition table on GPT is a bit complicated because you need to re-deploy it at the beginning of the disk and - reversed - at the end, but it is doable, personally I would make (still better safe than sorry) make the dd image of the 34 sectors but use a dedicated tool, gdisk:

https://www.rodsbook...disk/gdisk.html

would do nicely to make the backup (and if needed the restore) of the GPT partition table.



#5 gentisle

gentisle
  • Members
  • 6 posts
  •  
    United States

Posted 12 September 2022 - 10:24 PM

Thanks again Wonko for replying
Ok, sorry for not doing this earlier, but here are the real numbers from gparted. I'd upload the pic of it, but don't see a way to do that.
 
/dev/sda1   fat32 /boot/efi  100mb
 
/dev/sda2  ntfs Win7  149.90 gb
 
/dev/sda3  MS reserved 128mb
 
/dev/sda4  ntfs Win8.1  149.88gb
 
/dev/sda5 ntfs Win 11  120gb
 
 
 
I think Windows 8.1 created the reserved partition, though I wasn't paying attention.
 
Here is the output of gdisk which I already had:
 
gdisk64 -l \\.\physicaldrive0
GPT fdisk (gdisk) version 1.0.9
 
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present
 
Found valid GPT with protective MBR; using GPT.
Disk \\.\physicaldrive0: 3907029168 sectors, 1.8 TiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 5F6B6028-1F8A-11ED-ADBC-14DDA912F7AB
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3026225261 sectors (1.4 TiB)
 
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00
   2          206848       314574847   149.9 GiB   0700
   3       314574848       314836991   128.0 MiB   0C01  Microsoft reserved ...
   4       314836992       629147647   149.9 GiB   0700  Basic data partition
   5       629147648       880805887   120.0 GiB   0700  Basic data partition
======
I specifically used GPT, and during install, Windows 7 tried to MBR the disk, so I booted Hiren's CD and used the mbr2gpt utility in Win10 to convert it. I see it still says "w/protective MBR", but don't know if that matters with what I'm doing.
 
When you say the GPT partition table has to be reversed at the end of the disk, do you mean all the bytes are backwards in the sector compared to the main copy at the front of the disk?
Well, it looks like I have to wipe the disk anyway. I installed Linuxmint on a flash drive (to use as my maintenance disk), and I forgot that the Linuxmint install program ALWAYS seems to write grub to the 1st HDD no matter what. So I can no longer boot anything because I do not know grub, and have not been able to figure it out so far. I should have use plain Ubuntu.
 
gentisle

  • Darkr likes this

#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 13 September 2022 - 09:11 AM

About booting, in such a complex multi-boot setup, you'd better become familiar with GRUB2, as you will likely need it.

 

Since you are in EFI/UEFI all you need to do is to restore the Windows bootmgr.efi (that might be saved with another name, usually it is /EFI/Microsoft/Boot/bootmgfw.efi) but you should be able by choosing it when booting of you use the firmware features (possibly F12?).

 

Otherwise if you get to GRUB2 menu, you should be able to press "c" and get to command line, and from it chainload the windows bootmgr, should be something like:

root /dev/sda1

chainloader /dev/sda1//efi/Microsoft/Boot/bootmgfw.efi

boot

 

or

root (hd0,gpt1)

chainloader (hd0,gpt1)/efi/Microsoft/Boot/bootmgfw.efi

boot

 

From the Mint that you can boot you should be able to confirm that it is /dev/sda1 or (hd0,gpt1) and that the /efi/Microsoft/Boot/bootmgrfw.efi exists. be careful with CaSe SeNsItIVeNeSs.

 

If you google for "grub2 chainload windows bootmgrfw.efi" you will find more than a few related resourrces/examples.

 

The MS reserved partiton is fine, and yes that is probably coming from Windows 8, noone actually ever used it, it is said to be put by Microsoft to be used in some rare cases of shrinking/expanding partitions, but the good news are that it amounts essentially to 128 MB of unused disk space that creates no issues whatever (on current TB disks is not a problem to lose that tiny amount of space).

 

The "protective MBR" is normal (it is part of the specs), it is a "fake" partition table entry with ID 0xEE spanning the whole disk from sector 1 intended to avoid the BIOS firmware and any non-gpt enabled Operating Systems to access the GPT volumes (hence it is "protective").

 

The whole stuff (from sector lba1 to 33) is replicated (mirrored) at the end of the disk, it is partially reversed, here are  a couple clarifying pictures:

https://en.wikipedia...able_Scheme.svg

https://images.wonde...ition-table.png

 

But as said gdisk will take care of it if needed.

 

:duff:

Wonko

 

 



#7 gentisle

gentisle
  • Members
  • 6 posts
  •  
    United States

Posted 13 September 2022 - 04:38 PM

Thanks again. I did find a page that told me what to do with grub. Lately, I've been lucky with finding good answers when I search for them. Weird for me, but a blessing. I used these commands:

insmod part_gpt

insmod chain

set root=(hd1,gpt1)

chainloader /EFI/Microsoft/Boot/bootmgfw.efi

boot

 

And it would boot, however, it would reboot first, then I would re-issue those commands at the grub line, then it would boot the Windows I was trying to boot. So I de-activated those Windows installations and will start over. This time, I'll install in this order:

1. FreeBSD

2. Linuxmint

3. Windows 7

4. Window 8.1

5. Windows 11

 

I wanted to add at least one extended partition for Windows, and I'm still debating on Linuxmint or Kubuntu. I prefer KDE, and it doesn't put grub on the HDD without your permission. I've found plenty of pages describing how to make Windows boot manger boot other OS, and the same for FreeBSD, and Grub. When I first got this laptop in '16, I immediately put Linuxmint 17.3 on it, and never regretted it. I only regretted not having a good backup :(.

 

Those are good graphics that describe the GPT, thanks.



#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 13 September 2022 - 05:19 PM

In GPT there are not extended partitions (nor logical volumes inside them) anymore.

 

It is actually the only - in practice - good thing about GPT partitioning (together with the mirror/duplication at the end of the disk, all the rest are mostly overcomplicated solutions in search of a problem, starting from partition ID becoming GUID's, partition entry checksums, and what not) as the whole concept of Extended+logical volumes was essentially an ugly workaround, susceptible of a lot of possible issues.

 

All volumes are primary partitions in GPT, but as said you can have up to 128 of them, so no problem in making an extra partition for a storage/ data only volume (or for whatever other use).

 

In case you will end up using GRUB2 as "main" or "secondary" bootmanager, remember that added custom entries DO NOT go in grub.cfg (where everyone would put them) but rather in 40_custom :w00t: otherwise next grub upgrade will likely make a mess (pet peeve of mine):

 

https://news.ycombin...tem?id=31988624

 

If I were you I would consider - at least for emergency booting - a grub4dos for UEFI, it has become pretty stable and offers more flexibility than GRUB2.

 

:duff:

Wonko



#9 Darkr

Darkr

    Newbie

  • Members
  • 16 posts
  •  
    India

Posted 15 September 2022 - 07:29 PM

I don`t recommend You for this

If want to 4 multi boot system in 1 ssd you want to create your sdd Hybrid (gpt-active,mbr-Proctactive mode) not an good idea 

 

Easy way --  You can install Windows  in your first partition and you able to install Linux in other Partition

then you can use refind As your boot-loader the you can install osx in 128gb flash drive/external hdd

then install Bsd and android In 32 gb Flash drive

NOW Refind detected automatically 

 

 

like this

 

 

QOCDVe.png

 

 

 



#10 gentisle

gentisle
  • Members
  • 6 posts
  •  
    United States

Posted 15 September 2022 - 08:59 PM

Darkr,

Thanks for that info. I will definitely look into rEFInd, because an easy boot manager is a lot better, since all of this is difficult anyway.

gentisle



#11 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 16 September 2022 - 05:37 AM

I think in a mixed (Windows-Unix_Like) multiboot environment, installing Ventoy could be a better alternative, as 90%+ distros in distrowatch.com are supported, go to Ventoy site and read all info to see what it can do, also you could test or permanently use Ventoy installing it in a USB device first, boot from the USB device, and locate and boot any ISO or VHD files into the USB or your internal HD, and just keep the current boot loader or bootmanager installed into the HD.

 

It seems to me using VHDs is a very good way to have separated each Linux distro and each Windows version from each other, and forget about dealing with installation order or with the very hard to handle, automatically made (and frecuently self repairable) grub.cfg, that every Linux distro installs and overwites any other previous config, loader or bootmanager.

 

You can boot from Ventoy to install Windows OS versions, or boot also a WinPE WIM or ISO file located in a partition and by means of WinNTSetup install several Windows OSs in respective VHDs, (also Rufus could be usefull for this task), to later boot from each Windows OSs version installed on its respective VHDs.

 

You can test almost any Linux distro that exist, booting from its ISO file and you can use persistence (if available), to keep your favorite settings or additional programs/packages installed.  Also many Linux distros can be booted from VHDs, for more info see this page: Linux vDisk Boot Plugin

 

Some of Ventoy capabilities are:

 

Both MBR and GPT partition style are supported

Can be installed in USB/Local Disk/SSD/NVMe/SD Card

Directly boot from ISO/WIM/IMG/VHD(x)/EFI files, no extraction needed

For Linux based Isos booting, Persistence supported
Support to browse and boot ISO/WIM/IMG/VHD(x)/EFI files in local disk
No need to be continuous in disk for ISO/WIM/IMG/VHD(x)/EFI files

Windows auto installation supported

 

alacran


  • devdevadev likes this

#12 gentisle

gentisle
  • Members
  • 6 posts
  •  
    United States

Posted 16 September 2022 - 10:27 PM

alacran,

Thanks for that info. I have Ventoy and Rufus, but never dug deep into them to see what they would do. I've only used Rufus to "burn" an image to USB and I put a few distros on a disk with Ventoy. Guess, I've got a lot of reading to do.

And that WinNTSetup program looks interesting. I had searched long and hard for a way to make Windows 7 install disk boot from a USB stick, and never found anything that would work. No wonder Ventoy is asking for donations; it's a really powerful, versatile program. Thanks again.







Also tagged with one or more of these keywords: windows, freebsd, linux, multi-boot

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users