Link to home
Start Free TrialLog in
Avatar of 1gtx
1gtx

asked on

Booting custom kernel from USB (flash drive)

I'm trying to create a dual boot boot flash drive. The system supports booting from USB. I'm using a 2GB drive. No problem partitioning the USB into two equal 1GB slices and mounting at /mnt, Seem to be having a problem doing the installworld and getting it on the USB.

What I'm try to do is:
1) have a two bootable versions of Freebsd on a 2GB USB flash drive
2) Each bootable version is a custom kernel
3) As an extra bonus I'd like to use ZFS exclusively for the hard disk (e.g. boots from USB, and /usr, /home, etc. on the hard disk)

I've seen various fragments scattered around the net but so far I'm not having any luck. Any suggestions?
Avatar of srgilani
srgilani
Flag of Pakistan image

you want to use two different version or two different kernels ?
Avatar of 1gtx
1gtx

ASKER

Two separate kernels.

One kernel is the normal booting kernel for that machine. The second kernel is for updates. In other words any new kernel is built and placed on the second slice.

When ready to update, system is rebooted using new updated kernel (second slice). Now original kernel (slice one) becomes the backup. If something goes wrong or the newly built slice/kernel is defective, you can rollback to the the original kernel/slice with just a reboot using the the original slice.

Makes updates to a large number of duplicate computers fast and easy. No CPU cycles used doing make world etc. For updates select slice, reboot--Fast.

That's the idea anyway.

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of gheist
gheist
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 1gtx

ASKER

Actually you can boot from two slices, just not at the same time. That's the idea. One slice is active and the other is inactive. When upgrading the kernel you update the inactive kernel and then change it to be the active slice and the original slice becomes the inactive slice:

e.g. boot0cfg -s 2 da0 vs. the normal boot0cfg -s 1 da0

The ZFSOnRoot approach (using partition a of a slice on a usb and then booting the zfs for the harddrive with a small clone of the same slice mounted at the beginning of the zfs drive) is an interesting approach. I'm looking it over to see if it can be used as a framework for solving part of my problem.

Zfs is definitely useful for the rollback feature, but does not appear to give the same advantages as the multiple slice usb boot.

I appreciate the link. It has some unique ideas that I may be able to use.

Any other suggestions?
I am pretty sure that ZFS has no improvements over UFS that exhibit on 1GB flash filesystem.

BootMgr is able to select active partition at boot from keyboard.
Avatar of 1gtx

ASKER

You are correct on both counts.

Unfortunately I don't seem to be able to communicate what I'm trying to accomplish so I guess that this question will go unanswered.

I appreciate the attempts to help.
BootMgr is FreeBSD's boot selector. Easiest to install from sysinstall. If you have two (ZFS, UFS) partitions that can be alternated at boot time your setup quite resembles cisco's flash construct and lets you alternate to old system in case update fails.