You have an ad0 disk. Create one slice covering the entire disk:

# fdisk -BI /dev/ad0

Initialize the BSDlabel:

# bsdlabel -wB /dev/ad0s1

Edit your label and create a small (like 256MB-512MB) 'a' partition and use the rest for the 'd' partition:

# bsdlabel -e /dev/ad0s1

Something like this will create 512MB 'a' partition and allocate the rest for the 'd' partition:

# /dev/ad0s1:
8 partitions:
#     size     offset  fstype
  a:  1048576  16      unused
  c:  *        0       unused
  d:  *        *       unused

The 'd' partition will be used for ZFS:

# zpool create tank ad0s1d

Create bootdir directory where the boot file system will be mounted:

# mkdir /tank/bootdir
# ln -s bootdir/boot /tank/boot

Create a UFS file system on /dev/ad0s1a and copy the /boot/ directory onto it:

# newfs /dev/ad0s1a
# mount /dev/ad0s1a /tank/bootdir
# cp -Rp /boot /tank/bootdir/

If the boot filesystem is already existing then make sure that /boot/zfs/zpool.cache still gets copied over.

Now don't forget to add zfs_load="YES" to /tank/boot/loader.conf.

Ok, you also need to tell your loader where your root file system is. You can do it by adding:

vfs.root.mountfrom="zfs:tank"

to /tank/boot/loader.conf or you can create /tank/bootdir/etc/fstab file with one entry only:

tank    /    zfs    rw    0    0

On your ZFS file system, your /etc/fstab (/tank/etc/fstab) should contains the line above and:

/dev/ad0s1a    /bootdir    ufs    rw    1    1

(and everything else, ie. your swap and other file systems)

At the end, set mount point to 'legacy' so ZFS won't try to mount it automatically:

# zfs set mountpoint=legacy tank

troubleshooting

Alternate way with GPT and full zfs (no UFS /boot) for 8.0-RELEASE

FreeBSD 8.0 and later have support for a full zfs-based system (i.e. without using an UFS /boot), so we can use the GPT partitioning scheme along with /boot/gptzfsboot. See lulf blog's entry: http://lulf.geeknest.org/blog/freebsd/Setting_up_a_zfs-only_system/ or https://www.dan.me.uk/blog/2010/02/08/booting-from-zfs-raid056-in-freebsd-8-0-release/

Automated installation with GPT and full zfs for 8.0-RELEASE

You may try the mfsbsd SE amd64 ISO image with the "zfsinstall" script located at: http://mfsbsd.vx.sk/

Automated install with GPT and Full ZFS with PXE

PXE: http://blogs.freebsdish.org/brd/2012/03/23/pxe-booting-freebsd-9/ Install: http://blogs.freebsdish.org/brd/2012/05/08/scripted-install-of-freebsd-9/

ZFSOnRoot (last edited 2013-03-05 19:50:33 by BradDavis)