
To have my data secured I run (almost) daily
backups using a custom script to my NAS system. Over there, at the great, little Linux box, runs a script that does daily increments using
rsnapshot. There is also another script that keeps a copy on an external WebDAV server up-to date.
Implementing this was not that simple - as the NAS itself does not support mounting WebDAV servers natively I had to use a PHP script, which required patching the
PEAR WebDav Client (digest auth,
block size,
stat entries) but eventually I got it working at a reasonable speed (8k block size does not make sense for a HTTP based protocol!). The big benefits - my computers don't have to run to upload the data, the NAS is doing that work and it is running
24/7 anyway.
End of story, zero maintenance required.
Until I tried to switch from
Bingodisk to Apple's
iDisk.
For some reason the backup on the iDisk always included hidden files, despite the fact that they have not been changed and already existed on the disk. Some simple investigation has shown that the iDisk server simply did not return any file that started with a dot (.). But why?
Packet sniffing revealed that there are some differences between the PHP request and the one sent by OS X, but even after modifying the PHP code there were no hidden files included. Last difference - the mysterious
X-Source-Id header - but adding that also had no impact. Eventually, after digging in the
source code, I figured the change that is needed - as stated on top of the
InitUserAgentHeaderValue function:
IMPORTANT: The user-agent header MUST start with the
product token "WebDAVFS" because there are WebDAV servers
that special case this client.
Clear, concise and exactly what I needed to do - as soon as I sent this header iDisk responded with a file listing
including hidden files!
I still have no clue why iDisk makes this difference, but it is good to know how to be able to run full backups including hidden files over WebDAV!
Labels: english, mobileme, php, tech