I am making zpools on FreeBSD machine. While creating zpools I observe these two cases:

  1. If I take raw disks and create zpool then I am able to form zpools and they are working perfectly.

  2. If I format disks using gpart in freebsd-zfs format and then make zpool then also they are working perfectly.

What I am confused in, is which approach is better for creation of zpools?


It's better to use whole-disks with ZFS, when possible.
There's no need to partition in your use case.

  • 3
    What do you mean by your use case. Can you give some case where partitioning might be useful?
    – shivams
    Sep 15 '14 at 15:54
  • 4
    But why is it better to use whole-disks? Dec 18 '14 at 3:16
  • 1
    @leetNightshade Because there is no much point partitioning disks when you use ZFS with which file systems do not need their own partition(s). Moreover, when ZFS "own" the disk, it can enable the disk write cache to get better performance. See solarisinternals.com/wiki/index.php/…
    – jlliagre
    Apr 20 '15 at 9:47
  • 2
    @Grogi Any good evidence to back that up? Nov 10 '16 at 19:28
  • 4
    When I set up ZFS for the first time, reading this answer gave me a misleading impression about the cost/risk of partitioning, so I decided to use whole disks. In fact my "esoteric" configuration (mirroring drives of different sizes) would have benefited from the use of partitions, and it seems from the other answers that there is no cost – "using whole disks" just means that ZFS automatically partitions them for you.
    – sjy
    Nov 16 '19 at 0:42

Use one slice/partition dedicated for ZFS per physical disc and leave some space left unpartitioned. That way if you ever need to replace a drive and the replacement is 10 sectors smaller, you'll still be able to do it (http://www.freebsddiary.org/zfs-with-gpart.php).

That's what Solaris automatically does, that's what FreeNAS does (https://forums.freenas.org/index.php?threads/zfs-on-partitioned-disks.37079/) and thats ZoL does when you give it a whole disk - it will partition it...

The overhead to translate the position on the partition to the position on the actual device is negligible. So once the partition is correctly aligned to the physical sector boundary, there is no reason for it to behave differently than whole block device.

With ZoL, the only difference I am aware are is that ZoL will switch the disk scheduler to noop when whole disk was given to the vdev. Nothing stopping you from setting it manually.

There are some don't though... Don't create more partitions for ZFS per disk and if you decide to ignore the advice above, never ever build vdevs from them in same zpool. This will basically kill the performance, as ZFS will slice the data between the vdevs and sequential iops will turn into seek-nightmare...

  • 1
    Can you put some more light on zfs behaviour about seek-nightmare with disk slices being shared/used? Aug 16 '18 at 16:04
  • Simplest scenario - you build a pool from two vdevs, each a partition on the same harddisk. Now, you want to write a data chunk big enough that spans across both vdevs. Despite sequentially writing data, the drive has to seek between two separate locations to save it.
    – Grogi
    Aug 17 '18 at 17:32
  • Is this behaviour same if Pool_A uses(sda1,sdb1,sdc3) and Pool_B uses (sda2,sdb2,sdc3) Aug 19 '18 at 14:51
  • You don't have to write to them simultaneously... If you have the vdevs in one pool, there is nothing you can do...
    – Grogi
    Aug 19 '18 at 19:12

in my head this question arises because of doubt if i late can designate, what is on that disk... so when you create pool on whole drive (yes, with -f option, if needed), zpool practically create gpt partition table and partitions of Solaris, like this:

(fdisk -l ...)
Disklabel type: gpt
Disk identifier: 4CBE587E-23AF-8E4B-A7F0-B44AD6083171

Device          Start        End    Sectors  Size Type
/dev/sdd1        2048 3907010559 3907008512  1,8T Solaris /usr & Apple ZFS
/dev/sdd9  3907010560 3907026943      16384    8M Solaris reserved 1

so there really is no need to create partitions manually...

  • I do not consider what solaris does best practice on freebsd. For example in case of mirrors you can replace disks with a bigger ones and expand the pool size on the fly with one command or even automatically if configured as such.
    – cstamas
    Nov 25 '18 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.