"HFS formatted ZVOL On ZFS", howto?

New to OpenZFS on OS X (Or ZFS in general)? Ask your questions here!

"HFS formatted ZVOL On ZFS", howto?

Postby nodarkthings » Thu Jun 22, 2017 5:24 am

Hi!
I've been using ZFS for a few years now, pools, datasets, and sparsebundles on them.
I've seldom seen mentioned "HFS formatted ZVOL On ZFS" (like here > https://openzfsonosx.org/wiki/FAQ#Q.29_Can_Time_Machine_backups_be_stored_on_ZFS.3F) but I don't get the procedure and can't find any info about it, anywhere included on this forum or on the FAQ.

So,
1) do I still have to start with the regular "sudo zpool create..." and then format the pool with Disk Utility? Or is it a different secret procedure?
2) then, must I fear any issue with an already partitioned disk with mixed HFS and ZFS partitions/pools on it? (or is it possible at all?)
3) is there any benefit compared to a sparsebundle on a ZFS volume?

Thanks for any clarification. ;)
nodarkthings
 
Posts: 175
Joined: Mon Jan 26, 2015 10:32 am

Re: "HFS formatted ZVOL On ZFS", howto?

Postby lundman » Fri Jun 23, 2017 4:10 pm

In ZFS, if you have a pool, you can create as many datasets, and as many ZVOLs, as you want. Dataset being a full ZFS filesystem, and ZVOL is a virtual hard disk volume, which you can use as you please.

To create a ZFS dataset you use
zfs create [ -o options ... ] pool/datasetname


To create a new ZVOL, of 100G in size
zfs create -V 100G [ -o options ... ] pool/zvolname


which will then create a new /dev/diskX node for you. You can't partition it, but you can format it as hfs/fat32/ntfs etc, as you please.

Note that creating its size as 100G does not immediately use 100G, usage will grow as you use blocks in your zvol. You can pre-reserve the 100G is you really wanted to, but that is generally only done when you put swap on a ZVOL (you don't want disk-full on a pageout request...) using the -o refreservation=100G option.

Naturally things like -o compression=lz4 still work on ZVOLs, which is very nice. Compressed hfs on a ZVOL is faster than hfs on the same disk. [1]

Lund


[1] made up, I have no idea.
User avatar
lundman
 
Posts: 1338
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: "HFS formatted ZVOL On ZFS", howto?

Postby nodarkthings » Sat Jun 24, 2017 1:21 am

Thanks a lot! :)
I thought ZVOLs and Pools were different names for the same thing... :oops:

As I already use huge sparsebundles instead (to avoid a few issues I had when those volumes were datasets), would there be any benefit of reorganizing again my stuff with ZVOLs, or can I leave it out for now? Would there be any change, performancewise?
nodarkthings
 
Posts: 175
Joined: Mon Jan 26, 2015 10:32 am

Re: "HFS formatted ZVOL On ZFS", howto?

Postby nodarkthings » Sun Jun 25, 2017 5:56 am

Well, I can partially answer to myself, as I've done a few tests:

ZVOL vs Sparsebundle - size :
- sparsebundle created out of an existing 50 Gb HFS partition: 39.42 Gb; 50 Gb 'capacity' in Finder's info
- 40 Gb ZVOL: appears as 42.95 Gb in Disk Utility; 42,61 Gb 'capacity' in Finder's info

ZVOL vs Sparsebundle - speed :
- Copy of a 2.35 Gb folder
• ZVOL > HFS : 40s
• sparsebundle > HFS : 40s
• HFS > dataset : 40s
• HFS > ZVOL : 24s to 1mn
• HFS > sparsebundle : 41s

Conclusion: identical read speed but great variability for ZVOL write speed!
Sizewise, 6 Gb more for the sparsebundle (if created out of an existing HFS partition).

N.B.: I've tried to avoid any flaw in my testing procedure, repeating each test a few times to make them as consistent as possible...
nodarkthings
 
Posts: 175
Joined: Mon Jan 26, 2015 10:32 am

Re: "HFS formatted ZVOL On ZFS", howto?

Postby MacFormatik » Wed Jul 12, 2017 5:02 am

There are some issues i experienced using Zvols....

First one is this... which i never tested, so I don't know if its true.
http://jrs-s.net/2016/06/16/psa-snapsho ... han-zvols/

Second:
You can't shrink a Zvol after you used its space inside HFS....
with Sparsbundles you can shrink it back when the space is no longer needed.
User avatar
MacFormatik
 
Posts: 2
Joined: Sun May 01, 2016 7:25 am

Re: "HFS formatted ZVOL On ZFS", howto?

Postby nodarkthings » Wed Jul 12, 2017 5:51 am

Great! So 2 points for sparsebundles, I'd say. :D
nodarkthings
 
Posts: 175
Joined: Mon Jan 26, 2015 10:32 am

Re: "HFS formatted ZVOL On ZFS", howto?

Postby madison437 » Sat Jun 01, 2019 10:21 am

BTW, are there any recommendations for O3X as regards setting up the "volblocksize" option for:

1) Formatting the ZVOL as APFS for general usage?

2) Formatting the ZVOL as APFS for a use case of storing "archive" files of around 500 MB each?

Any insights welcome.

-- madison
madison437
 
Posts: 7
Joined: Wed Jul 29, 2015 2:06 pm

Re: "HFS formatted ZVOL On ZFS", howto?

Postby madison437 » Sat Jun 01, 2019 8:43 pm

Using a couple of benchmarking tools, it appears that the default of 128k for both cases is the winner.

I may continue to try other benchmarking tools, and share if it makes sense.

P.S. The man page for "zfs" lists the default as "8 Kbytes". I think this is probably true in the Illumos branch. I believe the default for ZoL is also 128k, which makes sense since that is upstream for O3X.

-- madison
madison437
 
Posts: 7
Joined: Wed Jul 29, 2015 2:06 pm

Re: "HFS formatted ZVOL On ZFS", howto?

Postby nodarkthings » Tue Jan 09, 2024 10:44 am

Just a few thoughts... :)
After many years using datasets and sparsebundles in them, I gave a new try to ZVOLs and I better understand their relevance: they are a bit slower, yes, but have not the drawbacks of datasets (Finder view not sticky, need for workarounds through features, etc.) and have the benefits of sparsebundles without an additional step to mount them (they mount when importing the pool).
Moreover, with v2, setting compression=zstd is a nice addition.
From the comments above, volblocksize was editable before but now is readonly (I see its value at 16K in my test with HFS+), and refreservation defaulted to none, now it's set to the same value you set when you create the ZVOL.
I haven't tested them with APFS format, but anyway my short test gives me a new perspective for using ZVOLs.
nodarkthings
 
Posts: 175
Joined: Mon Jan 26, 2015 10:32 am


Return to Absolute Beginners Section

Who is online

Users browsing this forum: No registered users and 4 guests