openzfsonosx / zfs

OpenZFS on OS X
https://openzfsonosx.org/
Other
824 stars 72 forks source link

Permanent Version Storage #152

Open ilovezfs opened 10 years ago

ilovezfs commented 10 years ago

Need to figure out how to support permanent version storage. Currently we get this error message.

The document “foo.txt” is on a volume that does not support permanent version storage.

Your changes have been saved and you will not be able to access older versions of this document once you close it. To undo your changes, click Revert.
emory commented 10 years ago

This could facilitate user home directories on ZFS for users that use iCloud and related services.

JMoVS commented 9 years ago

maybe as a starting point, this could be helpful: http://arstechnica.com/apple/2011/07/mac-os-x-10-7/14/#versioning-internals

I'll look into this a little and also test whether creating/manipulating the hidden folder is enough

JMoVS commented 9 years ago

ok, so judging the article and some poking, it is implemented as a folder at the root of the volume, called .DocumentRevisions-V100. Inside are:

Looking into the metadata file, we need a volume UUID for the corresponding ZFS dataset. This might be related to #116. Correct me if I'm wrong. I checked what kind of UUID is meant by comparing the UUID in the file with the UUID of diskutil info / | grep UUID. As ZFS datasets don't have dev entries and can't be accessed via diskutil, I don't know of a way to get a volume UUID (or whether it has one).

I'll keep on investigating further a little bit ;-)

lundman commented 9 years ago

Yes, 116 does indeed add UUID on the device, and a /dev entry for each mount.

grahamperrin commented 9 years ago

I submitted an enhancement request (ER) to Apple on 2012-03-20 whilst testing pre-release build 12A154q of OS X 10.8.0,

permanent version storage should be supported on ZFS

From the summary at the time:

.DocumentRevisions-V100 is owned by root:wheel and permissions for the volume can not be ignored but the system reports that permanent version storage is not supported.

Please allow permanent version storage on ZFS.

lundman commented 8 years ago

https://github.com/openzfsonosx/zfs/commit/78c2484fdaef

This moves us along one more step, the errors is now:

May 24 16:28:35 icgi-vip kernel[0]: ZFS: vnop_exchange start
May 24 16:28:35 icgi-vip kernel[0]: ZFS: vnop_exchange copy small->temp
May 24 16:28:35 icgi-vip kernel[0]: ZFS: vnop_exchange copy large->small
May 24 16:28:35 icgi-vip kernel[0]: ZFS: vnop_exchange copy temp->large
May 24 16:28:35 icgi-vip kernel[0]: ZFS: vnop_exchange copy done
May 24 16:28:35 icgi-vip kernel[0]: ZFS: vnop_exchange removing tmp file
May 24 16:28:35 icgi-vip kernel[0]: ZFS: vnop_exchange OK
May 24 16:28:35 icgi-vip kernel[0]: ZFS: vnop_exchange: 0
May 24 16:28:35 icgi-vip TextEdit[1815]: NSFileVersion tried to tried to add a new generation and failed. Versioned file URL: file:///Volumes/tester/Desktop/test1.rtf, contents URL: file:///Volumes/tester/Desktop/test1.rtf.sb-6e01643d-EjZdN2, error: Error Domain=GSLibraryErrorDomain Code=2 "not a staged path" UserInfo={NSDescription=not a staged path}
May 24 16:28:35 icgi-vip TextEdit[1815]: NSDocument failed to preserve the old version of a document. Here's the error:
    Error Domain=GSLibraryErrorDomain Code=2 "not a staged path" UserInfo={NSDescription=not a staged path}
May 24 16:28:35 icgi-vip TextEdit[1815]: <Document: 0x7f84f9478230>: An error occurred while attempting to preserve the backup file at file:///Volumes/tester/Desktop/test1.rtf.sb-6e01643d-EjZdN2: Error Domain=GSLibraryErrorDomain Code=2 "not a staged path" UserInfo={NSDescription=not a staged path}
JMoVS commented 5 years ago

Currently, there is no user GUI warning at all on a dataset with

com.apple.mimic_hfs    on                   
com.apple.devdisk      on