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

ZFSOnRoot (last edited 2008-07-04 23:12:57 by CySchubert)