APFS sparse image has issues when created on/moved to FreeNAS AFP share

vom

Dabbler
Joined
Nov 13, 2012
Messages
24
Hello all,

A few apologies upfront. Sorry if this is in the wrong forum. Not quite sure where it should go if not here. Also - this is likely an Apple specific issue (i.e. nothing to do with FreeNAS). However, I would think that folks here might have ran into this - and quite frankly there's likely more brainpower here than some of the other places I might post this. Again, I'm not assuming or blaming FreeNAS.

Okay - so my issue / question... I use Carbon Copy Cloner on my Mac to do my backups. I backup to a sparse image that lives out on FreeNAS (via AFP sharing). For the longest time (as well as currently) this image is HFS formatted. My Mac is running the latest macOS, and my internal drive is APFS format as is the default now. No issues with any of this. If I need to restore, I can copy and/or mount the .sparseimage and pull files/directories over at my leisure.

I wanted to try doing all of the above - but changing the destination sparseimage to an APFS formatted one. For testing, I used Disk Utility and created a blank APFS formatted sparseimage on my desktop. I made the size 1 TB, and copied some files into it. All of this worked as expected.

If I copy this sparseimage over (I safely unmounted it first) to my FreeNAS share, and I try to mount from there - I get a 'no useable partitions" error in Finder. I also tried to create the sparseimage there directly from Disk Utility and this resulted in an error.

Has anyone ran into this ? Am I doing something wrong or is this expected behavior ?

Thanks in advance for any wisdom.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
I can't reproduce. I created a 1TiB sparsebundle image locally hdiutil create -size 1T -fs APFS -type SPARSEBUNDLE -volname APFS_TEST APFS_TEST.sparsebundle and copied to NAS over SMB. Then I mounted it. Then I copied an ISO file to the sparsebundle. No problems.

Second test I created a 1TiB sparsebundle locally with same command. I mounted it locally and wrote a large file to it, unmounted, and copied to NAS. I was able to mount the remote copy successfully.
 

vom

Dabbler
Joined
Nov 13, 2012
Messages
24
I can't reproduce. I created a 1TiB sparsebundle image locally hdiutil create -size 1T -fs APFS -type SPARSEBUNDLE -volname APFS_TEST APFS_TEST.sparsebundle and copied to NAS over SMB. Then I mounted it. Then I copied an ISO file to the sparsebundle. No problems.

Second test I created a 1TiB sparsebundle locally with same command. I mounted it locally and wrote a large file to it, unmounted, and copied to NAS. I was able to mount the remote copy successfully.

Thanks for your reply and work to recreate this. One point however - I'm using sparse images - not sparse bundles. I think I've just hit the magic cocktail of something that doesn't work. I see all the talk about AFP deprecation / move to SMB etc. I think what I'm trying to do with APFS just isn't gonna happen the way I'm trying to do it.
 

vom

Dabbler
Joined
Nov 13, 2012
Messages
24
I wish I had another $anything-NAS to test with - so unfortunately no.

Also if it isn't clear yet - I'm a bit of an APFS noob. Learning some things the hard way it seems.

Certainly not apples to apples, but just for my own testing I made an APFS sparseimage on an external HDD. The HDD is formatted ExFAT. I successfully made an empty APFS sparseimage (I even set up encryption on it) and did like you - copy some .iso's etc, unount, remount etc. All textbook. My toxic cocktail seems to be:
  • APFS
  • Sparse Image
  • Network volume
I've tried this with AFP and SMB. In both of those cases I used as close to FreeNAS defaults as possible (i.e. no fiddling with advanced options for either)

I haven't tried NFS yet, but I don't know if I will put the effort into testing it.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
Okay. It also reports "no mountable filesystems" from a windows server. I haven't tried on a MacOS server, but if it works there it's because of Apple magic being tunneled over SMB. I'd say your path forward is to use sparsebundles instead of sparse images. Do note that with the default band size for sparsebundles, copies and deletions of them may be slow (because it's actually a directory full of small files). I hope this helps.

Ultimately, the bar that we're trying to reach is to reproduce the capabilities of a Windows SMB server.
 

vom

Dabbler
Joined
Nov 13, 2012
Messages
24
Okay. It also reports "no mountable filesystems" from a windows server. I haven't tried on a MacOS server, but if it works there it's because of Apple magic being tunneled over SMB. I'd say your path forward is to use sparsebundles instead of sparse images. Do note that with the default band size for sparsebundles, copies and deletions of them may be slow (because it's actually a directory full of small files). I hope this helps.

Thank you very much for taking the time to test this. Yes - I've considered the sparsebundle route. It's all tradeoffs one way or another I suppose. My main sticking point for sparseimages was that I could just copy the single huge file over once to a fresh install on my laptop and pluck files out at my leisure. With sparsebundle I'll have to access it via a NAS protocol.

Thanks again.
 
Top