7

I've installed MacZFS, I've read the FAQ and Getting Started section, but I've still troubles to understand how to simply format the external drive into ZFS on OSX. I'm confused with zpools, can anybody explains what are the zpools and how to format the drive?

I've tried also to use Disk Utility ZFS-Dumodule, but without success.

Is there any simple command to format the hard drive or to use Disk Utility for that?

My drive is: /dev/disk5.

Related:

3

The getting started page you posted a link to explains how to create a simple one disk pool.

This is the only thing you need to do. Creating a pool will automatically create a file system with the same name as the pool, which is what you call formatting a drive.

In your case, you can run from the command line:

diskutil partitiondisk /dev/disk5 GPTFormat ZFS %noformat% 100%
zpool create extdrive /dev/disk5s2

and you'll have a new volume named extdrive available.

If you happen to run software with inconsistent file naming, like Adobe products and possibly Nikon capture, you might want to create a dedicated file system with case insensitivity set using something like:

zfs create -o casesensitivity=insensitive -o normalization=formD  extdrive/data
1

I'm not so familiar with ZFS on Mac, so I'll try and speak on ZFS in general.

ZFS is a software-based volume manager that you can use to 'virtually' RAID a number of disks together.

The resultant storage volume that is created, is referred to as a zpool.

  • For example, you can take 2x raw disks [2x 3TB disks for example] and create a zpool (mirrored) via: zpool create MyPool mirror /dev/sda /dev/sdb

  • It's possible you might not have raw disks; in this case you can force ZFS to use preformatted disks by using the -f flag: zpool create -f MyPool mirror /dev/sda /dev/sdb

  • In your case, with a single preformatted disk, you can try forcing the creation of a zpool via: zpool create -f MyPool /dev/sda

  • Some disks use a 4k sector size. You might choose to create your zpool using a 4k sector size to maintain proper alignment: zpool create -f -o ashift=12 MyPool /dev/sda

Now let's assume you have a zpool called MyPool with total pool capacity of 3TB (mirrored 2x 3TB drives).

Creating A Filesystem:

  • From that raw 'pool' of storage, you can now create a filesystem. Your OS will be able to use/read/write the filesystem... NOT the pool.
  • create a ZFS filesystem on your pool via: zfs create MyPool/Videos
  • Now you should have a zfs filesystem called 'Videos' residing in /MyPool/Videos
  • You can freely read and write to /MyPool/Videos, share it over the network, set permissions, etc.

Creating a Virtual Block Device:

  • If you want, you can also create a virtual block device from your zpool via: zfs create -V 100GB MyPool/TestDevice
  • TestDevice will be a virtual device with 100GB capacity, and it generally resides in: /dev/zvol/MyPool/TestDevice
  • You can create any filesystem you want on TestDevice (HFS, EXT4, NTFS, etc), mount it, then use it!

You can create a bunch of Filesystems/Virtual-block-devices on your pool, and use them all very differently.

  • For example, you can have a zpool with multiple filesystems/virtual-devs tuned accordingly to Videos, TimeMachine-backups, Databases, etc respectively.
  • All these filesystems/virtual-devs would share from the same pool of storage. All data on the pool is redundant and dynamically protected against bit-rot.
1

First, find your device node:

$ diskutil list
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *4.0 TB     disk1
   1:               Windows_NTFS My Book                 4.0 TB     disk1s1

Then format your HDD (where /dev/disk1 is your device node from above command):

$ zpool create -f -O casesensitivity=insensitive -O normalization=formD WD_4TB /dev/disk1
checking path '/dev/disk1'

You may be able to improve performance for some workloads by setting ashift=12. This tuning can only be set when the pool is first created and it will result in a decrease of capacity. For additional detail on why you should set this option when using Advanced Format drives see section 1.15 How does ZFS on Linux handles Advanced Format disks?

  • For a modern 4 TB drive, we might assume that Advanced Format is used, in which case it will be appropriate to also specify an ashift property value at time of creation of the pool. – Graham Perrin Dec 19 '13 at 8:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .