Bootloader on USB, FreeNAS on SSD

Joined
Jul 24, 2017
Messages
1
Hello!

I got an HP Proliant gen8 and i want to install FreeNAS on an SSD (The SSD is in the ODD slot). The Problem is that the proliant can't boot from the ODD slot with activated AHCI mode, but it can boot from an USB Stick. So i thought it would be a nice idea to have to bootloader on the USB Stick, and OS on the SSD. It worked like a charm with Windows Server, so it should probably work linux too. Since i am not an Linux guru, i hope you guys can help me.

- Does USB Sticks decrease performance drastically (on 2.0 port)?
- Would it help to have at least the swap file on the SSD?
- At the moment the ProLiant has an Celeron G1610T. What CPU is recommend for FreeNAS?

best regards
 
Last edited by a moderator:

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
This is not possible. The boot loader is installed on the same drive as the OS.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Since i am not an Linux guru
This isn't particularly relevant, as FreeNAS isn't Linux. Is there a reason the SSD can't be on a different port?
Would it help to have at least the swap file on the ssd?
Swap partitions are automatically created on the disks that comprise your pool. They shouldn't affect anything, because your system shouldn't be using swap in normal operation.
At the moment the ProLiant has an Celeron G1610T. What CPU is recommend for FreeNAS?
Depends on the use case. Serving files via SMB over a gigabit LAN to a few clients? Your Celeron is fine. Serving lots of clients over 10 GbE while running several VMs and playing a few 4K streams through Plex? It'll need something much bigger.
 

wblock

Documentation Engineer
Joined
Nov 14, 2014
Messages
1,506
A separate bootloader could chainload the loader from the nonbootable drive. This would be weird and possibly fragile, and best avoided.

Does USB Sticks decrease performance drastically (on 2.0 port)?
No, not really. It is just the operating system, and FreeNAS does not do a lot of writing to the boot device.

Would it help to have at least the swap file on the SSD?
Swap is on each of the storage drives. Having some on the SSD would be faster, but I don't think there is an easy way to set that up. Regardless, using much swap is usually an indicator that the system does not have enough RAM.

What CPU is recommend for FreeNAS?
It's best to put unrelated questions in a new thread with an appropriate title, so more people will see them.

Incidentally, FreeNAS is based on FreeBSD, not Linux.
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
This is not possible. The boot loader is installed on the same drive as the OS.

Technically you can do it. But it doesn't make sense. And it's probably very fragile. I've done it by accident before.

Just boot off the USB if you have to boot off USB.

Use the SSD for something else.
 

Bytesplit

Dabbler
Joined
Jul 24, 2017
Messages
12
And here we go for my first forum post.

The Gen8 has an ugly problem finding the correct disk/partition to boot from. This also made me crazy the last weeks...

While the installer booted just fine of the USB the actual install never did boot. When activating disk boot, the order is drive bay 1-4 then optical drive bay. But due to this BIOS bug it will grab the boot block of the first disk (ZFS pool) and stop with invalid boot sector.

So what I had to do is install a USB stick with only grub and have that chainload the FreeBSD bootloader on the SSD. Works just fine since today...

Edit: some short intro to getting grub on a USB stick
(You need a FreeBSD or Linux desktop for the following) Install grub2 from ports. I used grub2-pcbsd which has support for ZFS, but the other should work too.

Make a USB stick or microSD and format it to GPT and add two partitions:
Code:
gpart add -t bios-boot -s 512 da0
gpart add -t linux-data da0


Format the 2nd partition for grub files. I heard that EXT2 works best for BSD and Linux so I used that:
Code:
mkfs.ext2 /dev/da0p2
mount -t ext2fs /dev/da0p2 /mnt/boot


Now we make the grub folder to hold our config:
Code:
mkdir /mnt/boot/grub
grub-mkconfig -o /mnt/boot/grub/grub.cfg


The default scripts found in /usr/local/etc/grub.d/* will create a rather complicated grub.cfg with everything recognized on the current Hardware. This is not the HP Gen8 so actually things are useless.

My menuentry:
Code:
menuentry “FreeNAS 11“ --class freebsd --class bsd --class os {
	insmod zfs
	insmod ext2
	insmod part_gpt
	echo			Chainloading hd5 ...
	set root=(hd5)
	chainloader +1
}


hd5 refers to the 5th disk. 4 internal bays filled make the ODD bay number 5 in chain.

The chainloader loads the FreeBSD bootloader installed by FreeNAS and it works just fine with boot environments and updating.
 
Last edited by a moderator:

BloodyBonkers

Dabbler
Joined
Sep 17, 2017
Messages
21
A little late to the party, but is there a way to set up the menu entry so that it wil also boot if a drive is removed or added after initial setup?

I tried with 3 storage drives installed and to boot I had to change set root=(hd5) to set root=(hd4) in grub.cfg.

I barely know anything about grub. Is it possible to say, query the number of installed disks and select the highest number.
i.e. if there are 2 drives in the bays + the boot ssd in the odd slot, grub would select hd3. and if there are 3 drives in the bays + odd grub would select hd4.

I'd rather do more work to get a hassle free experience in the future than have to edit the grub.cfg to boot if a drive is removed for RMA return or whatever.
 

ThreeDee

Guru
Joined
Jun 13, 2013
Messages
700
...alternatively .. you can purchase a USB to SATA cable and run your SSD off of it. USB port provides enough power to run a 128'ish gb drive without issue. That's what I've been running for over 6 months now.
 

BloodyBonkers

Dabbler
Joined
Sep 17, 2017
Messages
21
That would probably work, but if I'm not mistaken that would prevent me from getting S.M.A.R.T. data from the drive. I already got it working as described by Bytesplit. My question was if there was a way to use a conditional function instead of a static value on set root in the grub.conf. I was thinking something among the lines of if/then/else, but I don't know if that works or how to format it.
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
@BloodyBonkers Don't think what you're asking is possible. But, assuming you have set a few seconds boot delay in grub, you have the chance to make a temp change to the root drive value by entering "edit" mode from the grub menu
 

BloodyBonkers

Dabbler
Joined
Sep 17, 2017
Messages
21
I didn't think editing the config was possible without fully booting first. What you said works.

I want it to be as easy as possible for the end user, which is my Grandpa. I want to automate anything that can be automated. such as booting even if the number of drives in the bays have changed.

I think it is possible since I have seen menu entries using if statements to add a kernel parameter to a specific kernel and only that kernel.
CentOS / RHEL 7 : How to add a kernel parameter only to a specific kernel
At the very least this shows that conditional statements are possible to use.
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
@BloodyBonkers Of course grub2 can have conditional statements, but you asked if you could "query the number of installed disks and select the highest number.", which i don't think is possible, or a least I don't know how you could. I suppose you could set the root to each possible hd value in turn in a "if else construct" assuming there is a some simple test which can determine which is the correct value - perhaps some kind of search test. Whether this could be turned into a function I don't know, you can pass parameters to functions in grub?

You might get some ideas by looking how this works: https://www.supergrubdisk.org/super-grub2-disk/
 

vafk

Contributor
Joined
Jun 22, 2017
Messages
132
I use for years the above configuration (@Bytesplit 24 Jul 2017) in grub.cfg on Micro-SD in HP Microserver Gen8 which then boots 5th disk (SDD). What needs to be changed for FreeNAS to continue booting without having to hit enter? Thank you.

menuentry “FreeNAS 11“ --class freebsd --class bsd --class os {
insmod zfs
insmod ext2
insmod part_gpt
echo Chainloading hd5 ...
set root=(hd5)
chainloader +1
}



**Edit: I found the solution. It needs to enter

set default="0"
set timeout="0"

before the menuentry command.
 
Last edited:

kabegtr

Cadet
Joined
Jul 20, 2020
Messages
6
I use for years the above configuration (@Bytesplit 24 Jul 2017) in grub.cfg on Micro-SD in HP Microserver Gen8 which then boots 5th disk (SDD). What needs to be changed for FreeNAS to continue booting without having to hit enter? Thank you.

menuentry “FreeNAS 11“ --class freebsd --class bsd --class os {
insmod zfs
insmod ext2
insmod part_gpt
echo Chainloading hd5 ...
set root=(hd5)
chainloader +1
}



**Edit: I found the solution. It needs to enter

set default="0"
set timeout="0"

before the menuentry command.

So i have my SSD on the ODD drive, i tryed this and got: Chainloading hd5... Error: invalid signature.

Can you share the cfg that you used? Or some idea why am i getting the error?
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
@kabegtr Did you install FreeNAS on your SSD in UEFI or BIOS mode? It needs to be BIOS mode. Also, remember GRUB will only enumerate the SSD as the 5th disk when all four HDD bays are occupied. When using less than four HDDs in your microserver, change hd5 to the appropriate number.
 

kabegtr

Cadet
Joined
Jul 20, 2020
Messages
6
So i have 4 HDDs + the SDD on position 5. I installed NAS for BIOS mode, i tested it by taking all the HDDs out. So the SSD with the system is working.

Today i made a bootable grub USB with Windows, added the bios.cfg like shown in the post above, and got the invalid signature message.. Im still stuck there i didn't find any solution.
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
What you have called "bios.cfg" should be named "grub.cfg" and exist in /boot/grub/ I don't konw what tool you may gave used in windows ( e.g rufus or etcher ? ) but you need to install GRUB2 for BIOS on your USB stick.
 

kabegtr

Cadet
Joined
Jul 20, 2020
Messages
6
The bios.cfg was a typo its grub.cfg. I did the installation from Windows, and the bootloader worked with my windows + linux dual boot setup. After i tested the USB, i added the entry for FreeNAS, the cfg file looks like this:

screenshot_159.png


Bios is set to AHCI, first bootable device is the usb, i saw FreeNAS in the grub menu, pressed enter and got the Chainloading hd5... Error: invalid signature. The SSD is on position 5 when the AHCI is loading.
Im sure i missed something with the cfg file. Or maybe there is something wrong with making a bootable device on Windows. :S
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
The config looks correct to me. But I suspect UEFI is in the mix if your GRUB USB drive can boot WIndows10 as AFAIK a BIOS-mode GRUB cannot boot an EFI-mode boot loader. Surely your microserver needs a BIOS-mode GRUB as I said above. If youl'e got a linux install why aren't you using that to create the USB boot drive you need? It should be straigh forward to do.
 
Top