Boot loader setup for two drive systems, power switches

Hello all. I have a custom setup with power switches for SATA1 and SATA2 (Tap into +5 (red) and +12 (yellow) power. I asked MSI tech support about how to use these power switches safely. Power the computer completely down, fans off, etc.

SATA 1 -> SSD (MS Windows)
SATA 2 -> Magnetic Drive (Linux)

I’v tried to swap cables: SATA1=MD SATA2= SSD

Linux booted, but MSWIN gave a boot error. So, I had to switch back. It looks like MSWIN won’t boot anywhere but SATA1. ?? Is there anyway to fix that? MSI tech support can’t figure it out.

SWITCH 1 = SATA1 power
SWITCH 2 = SATA2 power

So, your wondering why? Security. Separate drives: more security, partition failures, etc.

I can isolate windows from linux by turn the power off. No smart viruses can read anything off the linux drive if it’s power is off. You see the effect in the boot menu.

#note this I use when I need to virus scan mswin drives.
SSD (SATA1) = on
MD (SATA2)= on

SSD (SATA1) = on

MD (SATA2)= on

Once I change the power switches before bootup, any changes in boot drive order are erased by the bios. So, I have to use the bios boot menu everytime I have both switches on. If you follow this, how do I use the grub menu to work with this complex setup?

Hi
I would imagine it’s to do with the BIOS, drive detection and boot order…

Why not just disable the relevant controller in either OS to offline the device?

What booting method is being used Legacy or UEFI?

https://www.msi.com/Motherboard/support/970-GAMING.html#down-manual

Disable the device in the BIOS. No feature to do that. That’s why I added the power switches.
However, you can make SATA port a hot plug and unplug.

What booting method is being used Legacy or UEFI?

Boot Mode Select [LEGACY+UEFI]
Sets the system boot mode from legacy or UEFI architecture depending on OS
installation requirement. This item will become unselectable and will be configured
automatically by BIOS when “Windows 8/ 8.1 Feature” is enabled.
[UEFI] Enables UEFI BIOS boot mode support only.
[LEGACY+UEFI] Enables both Legacy BIOS boot mode and UEFI BIOS boot.

LEGACY+UEFI boot

What is the difference? What is UEFI boot? I know boot linux has it’s own method and mswin has boot MBR.

SATA 1: on
SATA 2: on

Set the boot order to SATA 2. Power down and change power switch config SATA 1 on only. Boot to windows and shut down. Change switches to both on. Boot order returns to SATA 1 first. It means have have to use the bios boot menu every time I change switch configs.

Hi
No disable the controller in the operating system, In Windows device properties, find the relevant drive and disable it, then it won’t see it…

In Linux, no worries, don’t mount it…

If you used UEFI and secure boot, you could have separate EFI partitions on each drive and boot from those, even if not secure boot at least with GPT disk the MBR is protected, so no chance of a win boot virus…

As I said, smart viruses will just turn it back on or the hacker will soon after creating a backdoor. I like my switches idea better, hardware fix. :wink:

[QUOTE}If you used UEFI and secure boot, you could have separate EFI partitions on each drive and boot from those, even if not secure boot at least with GPT disk the MBR is protected, so no chance of a win boot virus…[/QUOTE]

I used default settings for both linux and mswin. I didn’t do an LVM setup on linux install. I’v read that you can’t use secure boot with linux.

UFEI is used instead of a bios. I still enter a bios to change settings. EFI boot partition? Should I be using EFEI only in the bios?

Sure you can. I’m using it.

At least opensuse, Fedora and Ubuntu support secure-boot. There are probably others (including, I assume, RedHat and SuSE Enterprise). But some distros do not support it.

If an intruder can mod your boot stack then he already owns you. Also nothing stops him from modifying the stack it just stops you from booting when he does. :open_mouth: Secure boot is a scam

In the BIOS/UEFI, should I set it to UEFI boot or UEFI + LEGACY?

Personally, I would go with UEFI. It can always be changed later if the need arises.

I wouldn’t go that far. It probably makes it harder to push a pirated windows version on an unwitting customer.

But it doesn’t offer any real value to the linux user (other than the ability to test whether it works with your system).

OK, back to my original problem. How do I install and/or fix suse to work with this. So, it boots to linux no matter the switch setup.

Install the boot loader, when both switches are on? So, the boot loader is on SATA 1 and SATA 2 drives?

If only linux (SATA 2) is on, it reads grub off SATA 2. If both switches are on, it reads GRUB off SATA 1.

Hi
Have two grub eg /boot partitions on each drive. The way I do it with a RAID setup is to use dd to keep the non active one up to date. So you only need to run the install on one drive, then use dd and tweak it to work with the second drive.

How do do that? Turn both switches on boot to linux. Use yast-boot loader to restore the boot loader. That should get it to boot from SATA 1. Is it installed on SATA 2?

Do I turn on each switch on SATA 1 and/or SATA 2? I know how to install the boot loader for linux. How do I get the boot loader on both drives? Install grub on a windows only drive. ??

SATA 1 and 2 on: boots from SATA 1
Boot loader on SATA 1

SATA 1 on: boots from SATA 1

SATA 2: boots from SATA 2
Boot loader on SATA 2

RAID? Raid is used for duplicating drives for backups.

Hi
You would need a partition on each drive of both the same size eg 500MB set to boot and formatted to say ext3 or ext4.

You only need to use dd to copy the existing data from the partition to the new one, no need to install. You would need to add a chainloder entry for windows (assuming it’s installed on sda mbr?) and set the bootflag to on for both devices.

My RAID reference was how I use in RAID setup, btw RAID is NOT a substitute for a backup :wink:

Perhaps if you fire up linux with both drives on and show the output from;


fdisk -l

Hi
Speaking of bootflags, wonder if that is the issue, not being set on the windows drive… the fdisk -l should clarify.

I need to clarify this setup. I’ll answer the fdisk question next message.

SATA 1: Installed mswin and separate partition NTFS
SATA 2: opensuse uses full drive, I’ll add a backup partition later.

SATA 1 on
SATA 2 off

Boots straight to mswin (Windows 10)

SATA 1 off
SATA 2 on

Boots to linux

SATA 1 on
SATA 2 on

Boots to windows. BIOS will default to SATA 1. Changing UEFI boot settinsg to boot from SATA 2, stays until you change switches. So, have to UEFI boot menu every time.

FYI, hopefully I will have to time and access tomorrow.

Hi
Ahh, UEFI that changes the logic somewhat…

So you have two efi partitions on each disk.

If the respective efi entries refer to the opposite disk, plus I’m guessing the opensuse directory doesn’t exist on the windows disk when you boot it will go direct to windows.

Can you boot to openSUSE with both drives on and post the output from;


efibootmgr -v
gdisk -l /dev/sda
gdisk -l /dev/sdb

Then need to mount both of the efi partition on the windows disk and check contents…

An easy way to solve is boot from a third device that is efi the partition eg SD card or USB device…

FYI, I tried setting the bios setup to UEFI only. There were no drives in the boot menu. ??

fdisk -l

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4c334934

Device     Boot     Start        End   Sectors   Size Id Type
/dev/sda1  *         2048  840017919 840015872 400.6G  7 HPFS/NTFS/exFAT
/dev/sda2       840017920 1260922879 420904960 200.7G  7 HPFS/NTFS/exFAT

Disk /dev/sdb: 931.5 GiB, 1000203804160 bytes, 1953523055 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x128e423c

Device     Boot    Start        End    Sectors   Size Id Type
/dev/sdb1           2048    4208639    4206592     2G 82 Linux swap / Solaris
/dev/sdb2  *     4208640   88100863   83892224    40G 83 Linux
/dev/sdb3       88100864 1953521663 1865420800 889.5G 83 Linux
efibootmgr -v
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
modprobe efivars
gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present                                                                                                                                                                                                                           
  GPT: present                                                                                                                                                                                                                               
                                                                                                                                                                                                                                             
Found valid MBR and GPT. Which do you want to use?                                                                                                                                                                                           
 1 - MBR                                                                                                                                                                                                                                     
 2 - GPT                                                                                                                                                                                                                                     
 3 - Create blank GPT                                                                                                                                                                                                                        
                                                                                                                                                                                                                                             
Your answer: 1                                                                                                                                                                                                                               
Disk /dev/sda: 1953525168 sectors, 931.5 GiB                                                                                                                                                                                                 
Logical sector size: 512 bytes                                                                                                                                                                                                               
Disk identifier (GUID): 3E54D2F5-9D2C-4354-ACBB-82BABF90493F                                                                                                                                                                                 
Partition table holds up to 128 entries                                                                                                                                                                                                      
First usable sector is 34, last usable sector is 1953525134                                                                                                                                                                                  
Partitions will be aligned on 2048-sector boundaries                                                                                                                                                                                         
Total free space is 692604269 sectors (330.3 GiB)                                                                                                                                                                                            
                                                                                                                                                                                                                                             
Number  Start (sector)    End (sector)  Size       Code  Name                                                                                                                                                                                
   1            2048       840017919   400.6 GiB   0700  Microsoft basic data                                                                                                                                                                
   2       840017920      1260922879   200.7 GiB   0700  Microsoft basic data                                                                                                                                                                

gdisk -l /dev/sda                                                                                                                                                                                            
GPT fdisk (gdisk) version 0.8.8                                                                                                                                                                                                              
                                                                                                                                                                                                                                             
Partition table scan:                                                                                                                                                                                                                        
  MBR: MBR only                                                                                                                                                                                                                              
  BSD: not present                                                                                                                                                                                                                           
  APM: not present                                                                                                                                                                                                                           
  GPT: present                                                                                                                                                                                                                               
                                                                                                                                                                                                                                             
Found valid MBR and GPT. Which do you want to use?                                                                                                                                                                                           
 1 - MBR                                                                                                                                                                                                                                     
 2 - GPT                                                                                                                                                                                                                                     
 3 - Create blank GPT                                                                                                                                                                                                                        

Your answer: 2
Using GPT and creating fresh protective MBR.
Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): A1834162-A630-4BDA-9BDE-FDCB06C17B47
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 1953525101 sectors (931.5 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name

gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. 
***************************************************************

Disk /dev/sdb: 1953523055 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): B5413946-885C-4A94-8FE2-A0FDF4DF3D21
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953523021
Partitions will be aligned on 2048-sector boundaries
Total free space is 3372 sectors (1.6 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         4208639   2.0 GiB     8200  Linux swap
   2         4208640        88100863   40.0 GiB    8300  Linux filesystem
   3        88100864      1953521663   889.5 GiB   8300  Linux filesystem

FYI…

Opensuse dvd update install works. The internet I use switched from DSL to cable. It’s offline. I’m going to try to reinstall opensuse from a blank drive. With only SATA 1(LINUX) on. Else, I could reinstall as SATA 1 and SATA 2. I’ll see if I get the internet working again.

I have the internet working again. So, what should I do?

Do an update install with SATA 2 only and/or SATA 1&2?

Doing both should give me a grub menu on either one? I can do an upgrade install on SATA 2 only (linux). How do get grub on a windows only drive? I’m looking over messages. I’m still not clear.