Workaround for boot unattended with bios without customizable boot priority

Status
Not open for further replies.

arso

Cadet
Joined
Feb 20, 2016
Messages
6
Excuse me.

The obvious solution for my problem is to change the hardware. Instead I will use it, it is a small Fujitsu pc q9000 and can give me the adeguate storage capacity and performance.
All work fine except the bios that don't want remember the boot order between usb stick and the sata hard disk. Even after the change of bios setting, it save, automatically bios try to boot from the sata hard disk and not from usb. The bios is at the latest level available.
No isn't a general bios problem. It keep saved ALL choices EXCEPT the order within hard disks proirity. It keep proiority within network, cdrom, hard disk etc. The problem is not the battery.
To boot I must keeep connected a keybord and video, press F12 and choose manually the usb stick. The boot can't be UNATTENDED.

The hardware is not assembled, is is a small form factor pc Fujitsu esprimo q9000, it is based upon Intel chipset QM57, have Intel core I5 and have 8Gb of Ram. It have two sata internal port, one used for primary 2.5 inch HD, the second originally for optical now used with a caddy for the second 2.5 inch HD. Both HD is configured for a raid1 volume. The data stored in the volume is only for test so it can be lost.

It have also an eSata connector I will keep free for plug disk for external backup.

One my idea is to reduce the partition on the HD and obtain space for an ext3 small partition for use as boot and install grub on it.
More simple but I don't have idea to do it, install somthing ( like a stage1 grub ) on a MBR of the primary HD but I don't know how to obtain or build it to load and execute the stage1 or stage2 on the usb stick.

It is possible ? Someone have already documented this ? Are there more easy solutions ?

Thanks at all.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
None of this is coherent.

What does ext3 or MBR have to do with freenas?
 

arso

Cadet
Joined
Feb 20, 2016
Messages
6
None of this is coherent.

What does ext3 or MBR have to do with freenas?
The two HD sata are managed and used by FreeNas for a zpool. When are added to zpool ( volume ) are initialized by freenas code and the partition table and MBR of the disks are rewritten.
Only one partition exists for each HD and the MBR contain code only for display "This are a data disk for freenas " o somewhat like that.

A solution for this problem can help other people that are using system with bios a bit stupid.

Excuse me. My apology, I have seen now that on the boot usb stick there is only a ONE 0xEE partition and the boot directory is within it. There is no need to create one other partition. Now try to copy the boot directory on the HD and replace the MBR with the stage1. At this point the grub.cfg on the HD is customizable to swap the disk order and boot from usb stick. I don't know exactly to do this but can search how to do.
 
Last edited:

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
To wipe the disks, just boot into literally any linux distribution from USB and zero out the drive. I don't know what the purpose of this thread is for. None of it makes sense.
 

arso

Cadet
Joined
Feb 20, 2016
Messages
6
To wipe the disks, just boot into literally any linux distribution from USB and zero out the drive. I don't know what the purpose of this thread is for. None of it makes sense.
Excuse me for the bad english. When I say rewrite MBR intend replace only the first 446 bytes of the track zero. This part of the MBR contain the grub stage1 code. This action does not wipe the hard disk.
 

gpsguy

Active Member
Joined
Jan 22, 2012
Messages
4,472
I think the OP is trying to install the OS on his data drives, since he can't easily boot from his flash drive.

He knows the solution is to get supported hardware, but thinks he make FreeNAS work in a way it was intended to be used.


Sent from my phone
 

arso

Cadet
Joined
Feb 20, 2016
Messages
6
I think the OP is trying to install the OS on his data drives, since he can't easily boot from his flash drive.

He knows the solution is to get supported hardware, but thinks he make FreeNAS work in a way it was intended to be used.


Sent from my phone
Thank. I'm trying to put only what is need to BOOT on my data drive, not all OS. With grub available and customizable on the data drive i think to chain the boot and OS code on the USB.
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Thank. I'm trying to put only what is need to BOOT on my data drive, not all OS. With grub available and customizable on the data drive i think to chain the boot and OS code on the USB.

Wait. Are you trying to put the OS on it's own drive and put GRUB on a data drive to boot the OS?

Yeah, it won't end well...
 

arso

Cadet
Joined
Feb 20, 2016
Messages
6
With a bit of patience, a bit of luck and a bit of knowledge, without have NEVER used FreeBsd I have obtained to boot from sata HD.
As I have asked without having any suggestion my goal was to install only the bootloader on the first HD leaving OS ( FreeNas code on the USB stick ).
In this way future update to FreeNas, including the complete substitution of the USB stick can be done without altering the content of the HD.

This solution is suitable for small hardware where the main features aren't performance scalability but cost and reduced hardware resource.
If there is adeguate budget the first action is to get adeguate hardware, for my home I don't need to replicate a nas for high performance or capacity
and high power consumption.

In the following instruction I have used only one spare small HD, just to test if the method is correct.
However the content of the data stored on the data volumes is preserved.

I discourage to try this method if there aren't knowledge on linux freebsb shell commands and a bit of experience on these systems.
If there is someone with more experience on Freebsd systems that can give suggestion I'm here to learn.
Away from here point and click gurus.

First install FreeNas on usb stich, follow the steps to configure the storage for data adding volumes using the internal HDs.

Second, from web interface enable ssh and login to .

The followings are the command a brief comment is inserted before in bold

Detect the layout of the HD and the USB
[root@freenas] ~# gpart show
=> 34 30031183 da0 GPT (14G)
34 1024 1 bios-boot (512k)
1058 6 - free - (3.0k)
1064 30030152 2 freebsd-zfs (14G)
30031216 1 - free - (512B)

=> 34 312581741 ada0 GPT (149G)
34 94 - free - (47k)
128 4075520 1 freebsd-swap (2G)
4194432 308387336 2 freebsd-zfs (147G)
312581768 7 - free - (3.5k)

To obtain space reduce the swap partition of a few MB
[root@freenas] ~# swapinfo
Device 1K-blocks Used Avail Capacity
/dev/ada0p1.eli 2097152 0 2097152 0%

Disable use of wsap, to do with no system load
[root@freenas] ~# swapoff /dev/ada0p1.eli

Check no swap space used
[root@freenas] ~# swapinfo
Device 1K-blocks Used Avail Capacity
[root@freenas] ~#

Rechek partition on HD
[root@freenas] ~# gpart show ada0
=> 34 312581741 ada0 GPT (149G)
34 94 - free - (47k)
128 4194304 1 freebsd-swap (2.0G)
4194432 308387336 2 freebsd-zfs (147G)
312581768 7 - free - (3.5k)

Resize swap partition of a small amount of MB
[root@freenas] ~# gpart resize -i 1 -a 4k -s 1990M ada0

Chek partition on HD to sess the free space
[root@freenas] ~# gpart show ada0
=> 34 312581741 ada0 GPT (149G)
34 94 - free - (47k)
128 4075520 1 freebsd-swap (2G)
4075648 118784 - free - (58M)
4194432 308387336 2 freebsd-zfs (147G)
312581768 7 - free - (3.5k)

Add partition to store STAGE1 grub
[root@freenas] ~# gpart add -i 3 -t bios-boot -a 4k -s 1M ada0

Add partition to store STAGE2 grub
[root@freenas] ~# gpart add -i 4 -t freebsd -a 4k ada0

Rechek partition on HD
[root@freenas] ~# gpart show ada0
=> 34 312581741 ada0 GPT (149G)
34 94 - free - (47k)
128 4075520 1 freebsd-swap (2G)
4075648 2048 3 bios-boot (1.0M)
4077696 116736 4 freebsd (57M)
4194432 308387336 2 freebsd-zfs (147G)
312581768 7 - free - (3.5k)

Create mount point for grub STAGE2 files
[root@freenas] ~# cd /mnt
[root@freenas] /mnt# mkdir newboot

Create fylesystem for GRUB STAGE2 files
[root@freenas] /mnt# newfs /dev/ada0s4
/dev/ada0s4: 57.0MB (116736 sectors) block size 32768, fragment size 4096
using 4 cylinder groups of 14.28MB, 457 blks, 1920 inodes.
super-block backups (for fsck_ffs -b #) at:
192, 29440, 58688, 87936

Set bootable flag for HD
[root@freenas] /mnt# gpart set -a active ada0
active set on ada0

Rechek partition details on HD
[root@freenas] /mnt# gpart list ada0
Geom name: ada0
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 312581774
first: 34
entries: 128
scheme: GPT
Providers:
......
3. Name: ada0p3
Mediasize: 1048576 (1.0M)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 2086731776
Mode: r0w0e0
rawuuid: 4a32b1d1-da6b-11e5-bbbe-0001807e1c1d
rawtype: 21686148-6449-6e6f-744e-656564454649
label: 1
length: 1048576
offset: 2086731776
type: bios-boot
index: 3
end: 4077695
start: 4075648
4. Name: ada0s4
Mediasize: 59768832 (57M)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 2087780352
Mode: r0w0e0
rawuuid: 0d1b6da8-da6c-11e5-bbbe-0001807e1c1d
rawtype: 516e7cb4-6ecf-11d6-8ff8-00022d09712b
label: 1
length: 59768832
offset: 2087780352
type: freebsd
index: 4
end: 4194431
start: 4077696
Consumers:
1. Name: ada0
Mediasize: 160041885696 (149G)
Sectorsize: 512
Mode: r2w2e5

Check mount point
[root@freenas] /mnt# ll /mnt
total 18
drwxr-xr-x 4 root wheel 120 Feb 23 21:31 ./
drwxr-xr-x 19 root wheel 26 Feb 23 19:22 ../
drwxrwx--- 8 root wheel 8 Feb 23 21:31 Sata160gb/
-rw-r--r-- 1 root wheel 5 Feb 16 23:00 md_size
drwxr-xr-x 2 root wheel 0 Feb 23 21:31 newboot/

Mount Filesystem for STGAGE2 files
[root@freenas] /mnt# mount /dev/ada0s4 /mnt/newboot/

Install GRUB ON HD, MBR, stage1 on bios-boot partition and stage2 on partirion mounted as /mnt/newboot
[root@freenas] /boot# grub-install --target=i386-pc --recheck --debug --boot-directory=/mnt/newboot /dev/ada0

Create grub menu configuration file
[root@freenas] /boot# grub-mkconfig -o /mnt/newboot/grub/grub.cfg
[root@freenas] /boot#


Umount the stage2 partition
[root@freenas] /mnt# umount /mnt/newboot

Reboot, checking ia the boot occour from the HD
[root@freenas] /mnt# reboot

BOOT FROM INTERNAL HD WITH SAME GRUB MENU ENTRY OF GRUB FROM USB
AFTER BOOT LOGIN AGAIN

Check the partition state
[root@freenas] /mnt# gpart show
=> 34 30031183 da0 GPT (14G)
34 1024 1 bios-boot (512k)
1058 6 - free - (3.0k)
1064 30030152 2 freebsd-zfs (14G)
30031216 1 - free - (512B)

=> 34 312581741 ada0 GPT (149G)
34 94 - free - (47k)
128 4075520 1 freebsd-swap (2G)
4075648 2048 3 bios-boot (1.0M)
4077696 116736 4 freebsd (57M)
4194432 308387336 2 freebsd-zfs (147G)
312581768 7 - free - (3.5k)

[root@freenas] /mnt#
 
Status
Not open for further replies.
Top