See https://wiki.freebsd.org/RootOnZFS/ZFSBootPartition for more details. Script started on Tue Jan 16 08:40:32 2018 # PS1='[script]# ' !!! These are the two MBR slices created by Windows 10, half of ada0 is available for FreeBSD !!! [script]# gpart show ada0 => 63 134217665 ada0 MBR (64G) 63 1985 - free - (993K) 2048 1024000 1 ntfs [active] (500M) 1026048 66082816 2 ntfs (32G) 67108864 67108864 - free - (32G) !!! Now, add our FreeBSD slice !!! [script]# gpart add -t freebsd ada0 ada0s3 added !!! Here it is !!! [script]# gpart show ada0 => 63 134217665 ada0 MBR (64G) 63 1985 - free - (993K) 2048 1024000 1 ntfs [active] (500M) 1026048 66082816 2 ntfs (32G) 67108864 67108864 3 freebsd (32G) !!! Create a BSD disklabel within the FreeBSD slice !!! [script]# gpart create -s BSD ada0s3 ada0s3 created [script]# gpart show ada0 => 63 134217665 ada0 MBR (64G) 63 1985 - free - (993K) 2048 1024000 1 ntfs [active] (500M) 1026048 66082816 2 ntfs (32G) 67108864 67108864 3 freebsd (32G) !!! Yes, the disklabel is in place !!! [script]# gpart show ada0s3 => 0 67108864 ada0s3 BSD (32G) 0 67108864 - free - (32G) !!! Add our ZFS partition !!! [script]# gpart add -s 28G -t freebsd-zfs ada0s3 ada0s3a added !!! Add our swap partition !!! [script]# gpart add -t swap ada0s3 ada0s3b added !!! Show the resulting disklabel !!! [script]# gpart show ada0s3 => 0 67108864 ada0s3 BSD (32G) 0 58720256 1 freebsd-zfs (28G) 58720256 8388608 2 freebsd-swap (4.0G) !!! Load the ZFS module, and optionally set the ashift property to 12 !!! [script]# kldload zfs [script]# sysctl vfs.zfs.min_auto_ashift=12 vfs.zfs.min_auto_ashift: 9 -> 12 !!! Create our zpool, YMMV !!! [script]# zpool create -O mountpoint=legacy zroot /dev/ada0s3a !!! Create our initial BE, YMMV !!! [script]# uname -a FreeBSD 11.1-STABLE FreeBSD 11.1-STABLE #0 r327786: Wed Jan 10 22:26:38 UTC 2018 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 [script]# zfs create zroot/ROOT [script]# zfs create zroot/ROOT/20180110-r327786 [script]# zfs set mountpoint=/tmp/zroot zroot/ROOT/20180110-r327786 !!! The BE is temporary mounted at /tmp/zroot !!! [script]# df -ah Filesystem Size Used Avail Capacity Mounted on /dev/iso9660/11_1_STABLE_AMD64_CD 701M 701M 0B 100% / devfs 1.0K 1.0K 0B 100% /dev tmpfs 32M 124K 32M 0% /var tmpfs 20M 68K 20M 0% /tmp zroot/ROOT/20180110-r327786 27G 88K 27G 0% /tmp/zroot !!! Extract a minimum installation !!! [script]# cd /tmp/zroot [script]# tar xf /usr/freebsd-dist/base.txz [script]# tar xf /usr/freebsd-dist/kernel.txz [script]# tar xf /usr/freebsd-dist/lib32.txz !!! Ensure the ZFS module will be loaded by the loader !!! [script]# echo 'zfs_load="YES"' >> boot/loader.conf !!! Make a note of our swap partition !!! [script]# echo '/dev/ada0s3b none swap sw 0 0' >> etc/fstab !! Prepare our pool for export !!! [script]# cd /tmp [script]# zfs unmount -a [script]# zfs inherit mountpoint zroot/ROOT/20180110-r327786 [script]# zpool set bootfs=zroot/ROOT/20180110-r327786 zroot [script]# df -ah Filesystem Size Used Avail Capacity Mounted on /dev/iso9660/11_1_STABLE_AMD64_CD 701M 701M 0B 100% / devfs 1.0K 1.0K 0B 100% /dev tmpfs 32M 128K 32M 0% /var tmpfs 20M 68K 20M 0% /tmp [script]# zpool export zroot !!! Write the boot manager to the boot block in the MBR !!! [script]# gpart bootcode -b /boot/boot0 /dev/ada0 bootcode written to ada0 !!! Write /boot/zfsboot as two separate pieces to /dev/ada0s3{,a} !!! [script]# dd if=/boot/zfsboot of=/tmp/zfsboot1 count=1 1+0 records in 1+0 records out 512 bytes transferred in 0.000383 secs (1337758 bytes/sec) [script]# gpart bootcode -b /tmp/zfsboot1 /dev/ada0s3 bootcode written to ada0s3 [script]# dd if=/boot/zfsboot of=/dev/ada0s3a skip=1 seek=1024 128+0 records in 128+0 records out 65536 bytes transferred in 0.043591 secs (1503439 bytes/sec) !!! Import our pool !!! [script]# zpool import zroot [script]# zfs list -rt all NAME USED AVAIL REFER MOUNTPOINT zroot 742M 26.2G 88K legacy zroot/ROOT 742M 26.2G 88K legacy zroot/ROOT/20180110-r327786 742M 26.2G 742M legacy !!! Everything checks out, it's time for a reboot to assess the damage !!! [script]# exit Script done on Tue Jan 16 08:53:07 2018