I'm working on a system to automatically back up my computer using rsync and the Google Drive app (I have a Macintosh computer). (This app creates a directory whose contents are saved to the Google Drive cloud.) The idea of the backup system is to (automatically) copy files to the Google Drive directory (using rsync, preferably) then upload the directory to the cloud.

This system has a major drawback, however: memory waste. Every file that I backup has to be copied to a second location in my computer, doubling the space the file uses. It would be much more memory efficient to make hard links instead of copies. I would like to duplicate my directory tree using hard links, then update the duplicate when the original changes.

Can I use rsync to make hard links instead of copies? I think this might be possible with the link--dest= option, but I can't figure it out.

Edit: A few clarifications, in response to feedback.

  1. This question has been listed as a duplicate of rsync --link-dest not working as expected with symlinks. I don't understand why the questions are the same. I gather that the similarity has to do with using the --link-dest= option to create hardlinks. But this is what I don't understand how to do! So I'm not satisfied with the duplicate question. It seems like using --link-dest= to make hardlinks only works if you already have a backup to compare it to.
  2. I'm not computer proficient compared to the users of this site. If the answer to my question is something like "this is easy, just read the man page for rsync more carefully" or something like that, I'll do it.
  3. I'm perfectly happy using some other bash utility to achieve the functionality I'm looking for! I just happen to like rsync, but I'm open to other options. JdeBP has suggested using pax, for example.
  • 1
    You've excessively limited yourself by restricting your toolset to rsync in the question. pax in copy mode is a tool that you could be using, for example.
    – JdeBP
    Jun 30, 2016 at 7:31
  • A minor quibble. It wouldn't be more memory efficient to use hard links. But it would be more disk storage efficient. Jun 30, 2016 at 9:49
  • @JdeBP I should have said this in the post, but I'm very open to using other tools besides rsync! I just have no idea what I'm doing. I'll look into pax.
    – user134824
    Jun 30, 2016 at 13:08
  • @roaima I was unaware of the distinction. Thank you for clarifying.
    – user134824
    Jun 30, 2016 at 13:13

1 Answer 1


The usual method is (writing from memory):

NEWBACKUP=`date +%s` # or some other format
rsync -aH --delete "$SOURCE" "$NEWBACKUP"

Check out Easy Automated Snapshot-Style Backups with Linux and Rsync

There is also a --link-dest option to rsync that I've never investigated properly.

  • In the third line, is it still possible that rsync will make duplicate copies? It seems like this will delete files that no longer exist but then use standard rsync behavior to copy modified files instead of hardlinking them.
    – user134824
    Jun 30, 2016 at 13:37
  • The script I gave is for creating a self-contained backup on another disk (presumably removable or remote); sorry if that was not what you wanted.
    – Law29
    Jun 30, 2016 at 13:53

Not the answer you're looking for? Browse other questions tagged .