FreeBSD 10 installer and ZFS root

David Christensen dpchrist at holgerdanske.com
Tue Mar 11 01:48:56 UTC 2014


On 03/10/2014 12:51 PM, dteske at FreeBSD.org wrote:
> The installer makes ada0s1a a mirrored vdev so that any disk in the pool
> can be booted from. Imagine what would happen if you had only a single
> boot partition that was not mirrored and you lost that drive?

Okay.  If/ when a second disk is added as a mirror, ZFS will maintain 
the mirror.  But what about everything else -- partition table, boot 
manager/ loader(s), swap, root, whatever?


> And the installer is scriptable.
> Try executing the following command to see how it can be scripted...
> awk '/GLOB/{exit}/CONFIG/,/GLOB/&&/^[A-Z]+=/{print}' \
> 	/usr/libexec/bsdinstall/scripts/zfsboot | less

/usr/libexec/bsdinstall/scripts/zfsboot does not exist on my 
installation DVD:

	root at p43200:~ # mkdir /media/cdrom

	root at p43200:~ # mount_cd9660 /dev/cd0 /media/cdrom

	root at p43200:~ # ls /media/cdrom/usr/libexec/bsdinstall/scripts/zfsboot
	ls: /media/cdrom/usr/libexec/bsdinstall/scripts/zfsboot: No such file 
or directory


But /media/cdrom/usr/libexec/bsdinstall/zfsboot does:

	root at p43200:~ # find /media/cdrom/usr/libexec/bsdinstall/ -name zfsboot
	/media/cdrom/usr/libexec/bsdinstall/zfsboot

	root at p43200:~ # less /media/cdrom/usr/libexec/bsdinstall/zfsboot


It is clear that zfsboot is one piece in a much larger puzzle.


>> If the installer boot loader creates a RAM disk, copies the installer
>> suite to there, and then lights it off, I might be able to choose Shell
>> early on, edit the right script, and then re-launch the installer.
> Yes, or create a /etc/installerconfig that sets ZFSBOOT_* variables
> before kicking off "bsdinstall zfsboot" (and later the distextract, etc.).
> HINT: If /etc/installerconfig exits with failure status, nothing else is
> performed before reboot (allowing you to control the install 100% by
> calling the various parts to the installation).

Setting variables in a text file is a possibility.  But, not everything 
is controlled by a variable.  I crawled through zfsboot and found the 
spot where the root partition is created for MBR (lines 757-758). 
Unfortunately, there is no size variable (gpart uses the rest of the disk).


David



More information about the freebsd-questions mailing list