Greetings all,
I have a server running on Supermicro X9 series board. All the SATA ports are used by a (data) pool, the OS is installed on (internal) USB flash drive. I wanted to install some additional application, but the flash drive was getting rather full. Since there are unoccupied PCI slots on the board, my initial thought was to boot from SSD via PCI/M.2 adapter. However, a Supermicro engineer advised me that such is not supported by the X9 series.
I was thus wondering whether I could boot from the internal USB flash drive, and then somehow hand-over to the SSD on which I would install the OS. I have found a Wiki page https://wiki.freebsd.org/UEFI, so I think that the structure on the USB flash drive should look like the following:
Then I would install the remaining portion of the OS on the SSD:
I do not know how to continue from here. As best understood from reading loader(8), I need to install /boot/loader and configure /boot/loader.conf. Judging by the leading /, the /boot/loader is installed under the zpool, thus:
However, I am unsure how to let the efi bootcode know where to find the /boot/loader. The loader(8) contains in the section ZFS FEATURES:
but I do not remember ever setting either. The loader.conf(8) contains the following:
, in the /boot/loader.conf but I still do not understand how does the efi bootcode find it; furthermore, as noted above, there is no /etc/fstab. Therefore, any help would be appreciated.
Kindest regards,
M
I have a server running on Supermicro X9 series board. All the SATA ports are used by a (data) pool, the OS is installed on (internal) USB flash drive. I wanted to install some additional application, but the flash drive was getting rather full. Since there are unoccupied PCI slots on the board, my initial thought was to boot from SSD via PCI/M.2 adapter. However, a Supermicro engineer advised me that such is not supported by the X9 series.
I was thus wondering whether I could boot from the internal USB flash drive, and then somehow hand-over to the SSD on which I would install the OS. I have found a Wiki page https://wiki.freebsd.org/UEFI, so I think that the structure on the USB flash drive should look like the following:
Code:
# Set boot disk:
DISK="da0"
echo "Destroying old partitions on the destination drive"
gpart destroy -F $DISK
echo "Configuring zfs for ashift=12"
# Force ZFS to use 4k blocks, i.e., ashift=12 before creating the pool
sysctl -i vfs.zfs.min_auto_ashift=12
# Create the gpt structure on the drives.
echo "Partitioning the destination drive using gpt"
gpart create -s gpt $DISK
gpart add -t efi -l efiboot -a 4k -s 100M $DISK
# Format the efi partition to hold the the small MS-DOS efifilesystem for UEFI bootcode.
# Copy the FreeBSD /boot/boot1.efi bootcode file into the efi filesystem.
echo "Preparing the efi partition"
newfs_msdos /dev/ada0p1
mount -t msdosfs /dev/ada0p1 /mnt
mkdir -p /mnt/EFI/BOOT
cp /boot/boot1.efi /mnt/efi/boot/BOOTx64.efi
umount /mnt
Then I would install the remaining portion of the OS on the SSD:
Code:
#Set installation disk:
DISK="ada0"
echo "Destroying old partitions on the destination drive"
gpart destroy -F $DISK1
echo "Configuring zfs for ashift=12"
# Force ZFS to use 4k blocks, i.e., ashift=12 before creating the pool
sysctl -i vfs.zfs.min_auto_ashift=12
# Create the gpt structure on the drives.
echo "Partitioning the destination drive using gpt"
gpart create -s gpt $DISK1
gpart add -t freebsd-swap -l swap -a 1m -s 6G $DISK1
gpart add -t freebsd-zfs -l zfspool $DISK1
echo "Creating pool system"
# Create new ZFS root pool (/mnt, /tmp and /var are writeable)
zpool create -m none -R /mnt -f system /dev/DISK1{p1}
zfs set atime=off system
zfs set checksum=fletcher4 system
zfs set compression=lz4 system
echo "Configuring zfs filesystem"
# The parent filesystem for the boot environment. All filesystems underneath will be tied to a particular boot environment.
zfs create -o mountpoint=none system/BE
zfs create -o mountpoint=/ -o refreservation=2G system/BE/default
# Set bootfs
zpool set bootfs=system/BE/default system
# Datasets excluded from the bootenvironment:
. . .
# Temporary directory on a disk
zfs create -o mountpoint=/tmp -o exec=off -o setuid=off -o quota=6G system/tmp
# Set sticky bit to and make /tmp and /var/tmp accessible
chmod 1777 /mnt/tmp
chmod 1777 /mnt/var/tmp
# Set ftp for fetching the installation files
FTPURL="ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.1-RELEASE"
# Install the files
echo starting the fetch and install
cd /mnt/tmp
export DESTDIR=/mnt
for file in base.txz kernel.txz
do
echo fetching ${file}
fetch ${FTPURL}/${file}
echo extratcting ${file}
cat ${file} | tar --unlink -xpJf - -C ${DESTDIR:-/}
rm ${file}
done
echo "finished with fetch and install"
# Create /etc/fstab file with encrypted swap
cat << EOF > /mnt/etc/fstab
# Device Mountpoint FSType Options Dump Pass#
/dev/$DISK1{p2}.eli none swap sw 0 0
EOF
I do not know how to continue from here. As best understood from reading loader(8), I need to install /boot/loader and configure /boot/loader.conf. Judging by the leading /, the /boot/loader is installed under the zpool, thus:
Code:
# Create /boot/loader
cat << EOF >> /mnt/boot/loader.conf
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
zfs_load="YES"
vfs.zfs.min_auto_ashift=12
EOF
However, I am unsure how to let the efi bootcode know where to find the /boot/loader. The loader(8) contains in the section ZFS FEATURES:
If /etc/fstab does not have an entry for the root filesystem and
vfs.root.mountfrom is not set, but currdev refers to a ZFS filesystem,
then loader will instruct kernel to use that filesystem as the root
filesystem.
but I do not remember ever setting either. The loader.conf(8) contains the following:
Regretfully, I cannot understand how this helps. I can set the variable, presumably:vfs.root.mountfrom
Specify the root partition to mount. For example:
vfs.root.mountfrom="ufs:/dev/da0s1a"
loader(8) automatically calculates the value of this tun-
able from /etc/fstab from the partition the kernel was
loaded from. The calculated value might be calculated in-
correctly when /etc/fstab is not available during loader(8)
startup (as during diskless booting from NFS), or if a dif-
ferent device is desired by the user. The preferred value
can be set in /loader.conf.
The value can also be overridden from the loader(8) command
line. This is useful for system recovery when /etc/fstab
is damaged, lost, or read from the wrong partition.
Code:
vfs.root.mountfrom="zfs:/dev/ada0p1
Kindest regards,
M