Reaction score: 488
ddto the (maybe) first sector of the raw disks. However I've never tried playing with raw disks and ZFS, so I hope that someone who has could share some light on this.
No, ZFS support booting from dedicated disks. There's a zfsboot file that should be written upon disk first sector and ZFS reservation space to make it bootable.
man zfsbootsays this:
zfsboot is typically installed using dd(1). To install zfsboot on the ada0 drive: dd if=/boot/zfsboot of=/dev/ada0 count=1 dd if=/boot/zfsboot of=/dev/ada0 iseek=1 oseek=1024
dd if=/boot/zfsboot of=/dev/ada0 count=1
dd if=/boot/zfsboot of=/dev/ada0 iseek=1 oseek=1024
oseekare what I was seeking for
Export zroot, before installing boot code
Fixit# zpool export zroot
Install the boot1 stage:
Fixit# dd if=/mnt2/boot/zfsboot of=/tmp/zfsboot1 count=1
Fixit# gpart bootcode -b /tmp/zfsboot1 /dev/ad0s3
This may fail with an "operation not permitted" error message, since the kernel likes to protect critical parts of the disk. If this happens for you, run:
Fixit# sysctl kern.geom.debugflags=0x10
Install the boot2 zfs stage into the convienient hole in the ZFS filesystem on-disk format which is located just after the ZFS metadata (this is the seek=1024).
Fixit# dd if=/mnt2/boot/zfsboot of=/dev/ad0s3a skip=1 seek=1024
Import zroot to continue the install
Fixit# zpool import zroot
The main argument for using whole disks with ZFS on Solaris was to allow ZFS to use the disk cache. This does not apply on FreeBSD, as the FreeBSD implementation is able to use the disk cache even with partitions.
However, the main argument for using partitions for ZFS is about when it comes to replace a failed disk if you have a mirrored or raidz setup. The new disk needs to be the same size or bigger, but the problem is that not all drives stated as the same size (e.g. 4TB) have exactly the same number of sectors. If you by a replacement 4TB drive and it has 1 less sector, it can not be used to replace the failed disk if your ZFS setup is using the whole disk. That is why I create a big ZFS partition and a small swap partition at the end of the disk (you can vary the size of the small swap partition at the end of the disk if your new replacement disk is a bit smaller).
vanessa, I actually love GPT and personally see no reason why so many prefer MBR model. The former beats the later on all counts... unless it be necessity to use some obsolete OSes.I can also confirm now - it ®justworks
Here is the why:
1. Simplicity. You get rid of a whole complexity layer you don't have to manage - GPT!
2. Speed. There is no unified opinion here as whether a raw device is always faster. However one thing is sure: it can NOT be slower.
There's only one thing missing in all this picture: I haven't yet found out how I could boot Linux in this setup. Grub2 seems to be needing a dedicated partition, so whilst I keep my Linux installation in the same rpool with FreeBSD, in that case I have to use GPT-partitioned setup with bios-boot partition to host GRUB2 image. The problem is not only that the image needs to be embedded into bios-boot partition, but I'm yet to check if it will be able to distinguish a whole-disk ZFS pool at all.