Question

I have been using hard links, as described here, for linking my important folders to my Dropbox. A very useful trick for backing up without messing up your preferred directory structure.

After my update the High Sierra, all the hard links where corrupted in such a way that all the files were lost.

This leaves me with a problem. How do I backup selected folders from my harddisk through Dropbox without changing my original file organization, without losing all my info this time. Does High Sierra support hard links? It seems not... what to do in such a case?

update

So both Dropbox and OneDrive need me to put files in a dedicated folder. It seems like hard links are no longer an option. In this case, I suppose I should switch to a dedicated service that does allow me to 'check' existing folders into the backup?

Was it helpful?

Solution

I've been successful been using Dropbox with folders "out of the root" using symlinks:

  • Stop Dropbox (quit the app)

  • Create a symlink to the destination folder anywhere within the Dropbox folder trees

  • Relaunch Dropbox

The link is synched into Dropbox as a folder in that position. Works great!

EDIT: Unfortunately, as @krim mentions on the comments below, Dropbox stopped supporting this workaround at the end of 2019 😿😭

OTHER TIPS

The method you described involves installing a third party ln command that allows you to ask the kernel to create a hard-link for a directory.

The ln command from coreutils ends up executing the linkat() function in the Darwin kernel, where the source code includes the following comment:

/*
 * Normally, linking to directories is not supported.
 * However, some file systems may have limited support.
 */

It is therefore generally not recommended to create hard-links to directories.

In regards to upgrading to High Sierra, your system will usually have its file system converted from HFS+ (which supports these hard-links in some cases) to APFS (which do not supports directory hard links). Therefore you will not have hard-links after conversion.

See the documentation from Apple on the subject here:

https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/APFS_Guide/FAQ/FAQ.html

Especially the following paragraph:

Directory hard links are not supported by Apple File System. All directory hard links are converted to symbolic links or aliases when you convert from HFS+ to APFS volume formats on macOS.

The conversion program is supposed to convert these hard-links into symbolic links (soft links). The symbolic links points to new entries created in /.HFS+ Private Directory Data/.

However it seems that there might be a bug involving the conversion since you've experienced loss of files. This might be due to the fact that hard linked directories are seldomly used, and cannot be created with the standard Apple supplied tools.

Therefore I think you should file a bug report with Apple using Radar.

You may do the opposite: move your folders into the Dropbox folder, then create symlinks to the locations you desire.

Example :

mv ~/Documents/cats ~/Dropbox/cats
ln -s ~/Dropbox/cats ~/Documents/cats

Happened across this post as I was trying to find a way to automate deletion of hard links. Thought I'd add my two cents.

I've been using Sugarsync for about 5 years to avoid exactly the problem you describe. It just backs up my files in their original directory structure. It's worked well.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top