Greeting, I had a bit time, free slice on the disk with MBR and the desire to play with the new installation of FreeBSD 9.0-RC1 .
Below is just a simple example ; there will be one ZFS filesystem on /, no swap, no keys for GELI, passphrase only. Nevertheless, I decided to share the method which can be used in different setups and configurations.
My setup consists of:
ada0 - hard drive
ada0s1 - slice will be used for ZFS
da0 USB stick - for booting
1. Boot with your FreeBSD install disk and choose “Lice CD†when prompted, login as root, no password is required.
2. This step is optional but it's a good idea.
3. bsdlabeling:
4. Loading the required modules:
5. Labeling partition:
6. Initiation and attachment GELI:
7. Creation ZFS pool and FS:
8. Installation FreeBSD:
You can select and install something else, please take a look at /usr/freebsd-dist/
9. USB stick, preparation:
10. Copying /boot to USB stick:
11. Creation fstab and loader.conf:
a) create /tmp/usbboot/boot/loader.conf and add the following lines:
b) create /mnt/etc/fstab:
12. Generation and recording zpool.cache to USB stick:
13. Change pool mountpoint to /
14. Finish.
* On boot the system will load kernel and modules from the USB stick and you'll be asked for passphrases to the GELI disk before the system will run.
Below is just a simple example ; there will be one ZFS filesystem on /, no swap, no keys for GELI, passphrase only. Nevertheless, I decided to share the method which can be used in different setups and configurations.
My setup consists of:
ada0 - hard drive
ada0s1 - slice will be used for ZFS
da0 USB stick - for booting
1. Boot with your FreeBSD install disk and choose “Lice CD†when prompted, login as root, no password is required.
2. This step is optional but it's a good idea.
Code:
dd if=/dev/urandom of=/dev/ada0s1
dd if=/dev/urandom of=/dev/da0
Code:
bsdlabel -w /dev/ada0s1
Code:
kldload geom_eli zfs
Code:
glabel label zrpool /dev/ada0s1a
Code:
geli init -b /dev/label/zrpool
geli attach /dev/label/zrpool
Code:
zpool create -O mountpoint=/mnt -O canmount=off zrpool /dev/label/zrpool.eli
zfs create -o mountpoint=legacy zrpool/FreeBSD
Code:
mount -t zfs zrpool/FreeBSD /mnt
tar -xf /usr/freebsd-dist/base.txz -C /mnt
tar -xf /usr/freebsd-dist/kernel.txz -C /mnt
9. USB stick, preparation:
Code:
fdisk -BI /dev/da0
bsdlabel -B -v /dev/da0s1
newfs /dev/da0s1a
Code:
mkdir /tmp/usbboot
mount /dev/da0s1a /tmp/usbboot
cp -Rp /mnt/boot /tmp/usbboot/
a) create /tmp/usbboot/boot/loader.conf and add the following lines:
Code:
geom_eli_load="YES"
zfs_load="YES"
# aesni_load="YES" # option see man aesni
vfs.root.mountfrom="zfs:zrpool/FreeBSD"
Code:
# cat > /mnt/etc/fstab
zrpool/FreeBSD / zfs rw 0 0
^D
Code:
zpool export zrpool
zpool import -o cachefile=/tmp/usbboot/boot/zfs/zpool.cache zrpool
Code:
zfs set mountpoint=/ zrpool
Code:
shutdown -r now