Given that Apple has deprecated AFP for Time Machine backups in favor of SMB it would be beneficial to be able to use Samba to provide a network based backup destination. Apple has published the required capabilities for supporting Time Machine backups over SMB and can be found here: https://developer.apple.com/library/content/releasenotes/NetworkingInternetWeb/Time_Machine_SMB_Spec/ Looking through the code I think this probably fits the best in vfs_fruit.c as that module handles a large amount of other integrations for Mac OSX. I also have Wireshark captures of a working Time Machine backup to an OSX server and a non-working backup to a Samba server if that would be beneficial. I started attempting to implement the required features but I would appreciate some help with some of the pieces. I was able to change vfs_fruit to advertise the capability correctly but I can not determine if it is possible to flush the data when recieving an SMB2 FLUSH within the VFS layer. Is that possible? Based on what I can find in the captures I believe that all of the other features are implemented already including SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 and SMB2_CREATE_REQUEST_LEASE_V2. -Kevin
Please compress the pcap files with gzip --best and attach them to this bug report. Attaching you work in progress patch would also help. Thanks!
Here's some more stuff that nicely explains what F_FULLSYNC does on OS X: <http://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html> I remember I simply faked this for Netatalk.
Ralph, please ping me about this requirement. I've been talking to Apple directly about this. Jeremy.
Created attachment 12576 [details] Capture from a stock Samba 4.4.6 installation
Created attachment 12577 [details] Capture from a Samba version running the attached patch for capabilities
Created attachment 12578 [details] Capture from a working Mac OSX server providing Time capsule services
Created attachment 12579 [details] WIP: Samba capabilities patch This is a patch to advertise F_FULLSYNC to the client, but it does nothing beyond that at this time.
I was able to get the patch that I provided to work successfully for Time Machine backups. The reason that it was not working after applying the patch was due to not having durable file handles configured. After adding the following to my smb.conf file I was able to start a Time Machine backup. - durable handles = yes - kernel oplocks = no - kernel share modes = no - posix locking = no After the backup I will attempt to restore a file to verify functionality. After reading what Ralph mentioned regarding the F_FULLSYNC fnctrl, my personal opinion is that it is OK to fake it like I did in the patch but I would certainly like some concurrence from others with more knowledge on Samba internals. Thanks! Kevin
I did some more research on this and I believe that advertising the capability and taking no other action is an acceptable course of action. I went ahead and made it a configurable option, updated the man page, tested the code, and created a Github pull request for this issue. Here is the link to the PR: https://github.com/samba-team/samba/pull/64 Thanks! Kevin
Thanks for the patches and please keep pushing me to get them integrated. I need to discuss a few technical things with Jeremy related to this before I can start to do a review. So please stay tuned... :)
Thanks Ralph! I'll ping you in a week through this bug (if you prefer a different interval or communication method just let me know) for a status check/update. In the meantime if you think of anything that can be added or changed just let me know.
Hi Ralph, Have you had a chance to discuss this patch with Jeremy yet? Thanks, Kevin
User ping on this. Should I go down the route of applying Kevin's patch for now or await a proper implementation of the feature? I have been planning to migrate to SMB-based Time Machine backups, but was sorely disappointed to find out about the new fruity extension. :(
Hi Nick, The decision to apply it or not really depends on how much you want to trust your data to it. :) With that being said some changes are being discussed on the mailing list to ensure that backed up data is safe and consistent during events like power offs. I have been running the provided patch for my Mac's on a home server without any issues but it is also not my primary form of backups right now.
Another user ping on this as well. Are we any closer to having this functionality put into Samba so it can be used for Time Machine backups? I have an open enhancement request in the FreeNAS 10 bug tracker to track official support but it's currently pending this enhancement making into into the codebase.
Created attachment 13242 [details] Samba 4.5.9+ fullsync advertisement for vfs_fruit.c Updated patch file for samba 4.5.9+. The fix for bug 12479 introduced changes vfs_fruit.c that broke Kevin's original patch. I've updated the patchfile to apply the fullsync advertisement work around to accomodate.
Thanks Chris. Just a heads up you can pull an updated patch from https://github.com/samba-team/samba/pull/64.patch which should apply cleanly on master. I keep the pull request updated whenever I notice a breakage or need to make a change. Your patch, while it technically works, looks like it hard codes the option but the updated patch actually makes it a configurable value. That being said, let me know if you notice any breakage with my updated patch.
Thanks Kevin, I didn't think to look at your PR. I like that approach better than hardcoding it. Will try it out tonight, if there's no reply, then all went well. For folks who stumble upon this looking for Time Machine, aka TM, support in Samba, I'd go with Kevin's PR patch linked above.
Having issues with the fedora samba 4.5.10 package with the PR 64 patch. Getting a message from OS X that the samba server doesn't support the required capabilities. Attempted to wireshark the transaction, but not sure what bits I should be looking for. Kevin can you clue me in on the transcation and value I should be looking for? What other info would help? FYI - I've applied the patch to the rpm build, it applies successfully. I've also configured the TM share with fruit:time machine = yes, removed fruit:fullsync entry. Also removed the duplicate samba config items that fruit:time machine applies as well.
Chris if you move fruit:time machine to the global configuration section, rather than the per share configuration, does it work then?
Affirmative, it does work when it's in the global config. Working config, global config. [global] fruit:aapl = yes fruit:time machine = yes Previous, non working config per share. [time machine] fruit:aapl = yes fruit:time machine = yes
This will ship with Samba 4.8.